00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020 #include <videosource.h>
00021 #include <iostream>
00022 #include <iniparser.h>
00023 #include <qapplication.h>
00024 #include <fstream>
00025 #include "glbox.h"
00026 #include "vobj_tracker_view.h"
00027
00028 using namespace std;
00029
00030 int main(int argc, char **argv) {
00031 QApplication a( argc, argv );
00032
00033
00034 IniParser parser(0);
00035
00036
00037
00038
00039
00040 VideoSourceFactory factory;
00041 factory.registerParameters(&parser);
00042
00043 const char *vs_ini = "videosource.ini";
00044
00045 for (int i=1; i<argc-1; ++i) {
00046 if (strcmp(argv[i],"-vs")==0) {
00047 vs_ini = argv[++i];
00048 }
00049 }
00050
00051 if (!parser.parse(vs_ini)) {
00052 cerr << "warning: unable to read " << vs_ini << ", generating an example one.\n";
00053 parser.dumpExampleFile(const_cast<char *>(vs_ini));
00054 }
00055
00056
00057 VideoSource *vs = factory.construct();
00058
00059 if (vs==0) {
00060 cerr << "Unable to open video source!\n";
00061 return 2;
00062 }
00063
00064 vobj_tracker_view *glbox = new vobj_tracker_view(0, "GLBox", vs);
00065
00066 for (int i=1; i<argc; i++) {
00067 if (i<argc-1) {
00068 if (strcmp(argv[i],"-t")==0) {
00069 glbox->tree_fn = argv[++i];
00070 continue;
00071 } else if (strcmp(argv[i],"-d")==0) {
00072 glbox->descriptors_fn = argv[++i];
00073 continue;
00074 } else if (strcmp(argv[i],"-v")==0) {
00075 glbox->visual_db_fn = argv[++i];
00076 continue;
00077 } else if (strcmp(argv[i],"-vs")==0) {
00078 ++i;
00079 continue;
00080 } else if (strcmp(argv[i],"-c")==0) {
00081 glbox->clusters_fn = argv[++i];
00082 continue;
00083 }
00084 }
00085 if (strcmp(argv[i],"-r")==0) {
00086 glbox->record_movie = true;
00087 } else if (strcmp(argv[i],"-l")==0) {
00088 glbox->learning = false;
00089 } else {
00090 cout << "Unknown command line parameter: " << argv[i] << endl;
00091 cout << "Available options are:\n"
00092 " -t <tree file>\n"
00093 " -d <output descriptor file>\n"
00094 " -v <visual database file>\n"
00095 " -c <clusters file>\n"
00096 " -r : record images in the folder 'out'\n"
00097 " -s <script>\n"
00098 " -l : disable incremental learning\n"
00099 " -B : binary tf-idf\n"
00100 " -M : min tf-idf\n";
00101 }
00102 }
00103
00104
00105 glbox->show();
00106
00107 a.connect( &a, SIGNAL(lastWindowClosed()), &a, SLOT(quit()) );
00108 int r= a.exec();
00109 cout << "bye bye\n";
00110 delete glbox;
00111 return r;
00112 }
00113