simple.cpp
Go to the documentation of this file.
00001 //command line parameters
00002 #include "cmd_line/cmd_line.h"
00003 
00004 //detectors
00005 #include "detectors/datamatrix/detector.h"
00006 #include "detectors/qrcode/detector.h"
00007 
00008 //tracking
00009 #include "libauto_tracker/tracking.h"
00010 #include "libauto_tracker/threading.h"
00011 #include "libauto_tracker/events.h"
00012 
00013 //visp includes
00014 #include <visp/vpImageIo.h>
00015 #include <visp/vpVideoReader.h>
00016 #include <visp/vpMbEdgeKltTracker.h>
00017 #include <visp/vpMbKltTracker.h>
00018 #include <visp/vpMbEdgeTracker.h>
00019 #include <visp/vpDisplayX.h>
00020 
00021 int main(int argc, char**argv)
00022 {
00023   //Parse command line arguments
00024   CmdLine cmd(argc,argv);
00025 
00026   if(cmd.should_exit()) return 0; //exit if needed
00027 
00028   //Read video from a set of images, a single image or a camera
00029   vpImage<vpRGBa> I;
00030   vpVideoReader reader;
00031   vpMbTracker* tracker;
00032 
00033   vpCameraParameters cam = cmd.get_cam_calib_params();
00034   if(cmd.get_verbose())
00035     std::cout << "loaded camera parameters:" << cam << std::endl;
00036 
00037   std::string filenames((cmd.get_data_dir() + cmd.get_input_file_pattern()));
00038   if(cmd.get_verbose())
00039     std::cout << "Loading: " << filenames << std::endl;
00040   reader.setFileName( filenames.c_str() );
00041 
00042   reader.setFirstFrameIndex(2);
00043   reader.open(I);
00044 
00045   //init display
00046   vpDisplayX* d = new vpDisplayX();
00047   d->init(I);
00048   //init hybrid tracker
00049   detectors::DetectorBase* detector = NULL;
00050   if (cmd.get_detector_type() == CmdLine::ZBAR)
00051     detector = new detectors::qrcode::Detector;
00052   else if(cmd.get_detector_type() == CmdLine::DTMX)
00053     detector = new detectors::datamatrix::Detector;
00054 
00055   if(cmd.get_tracker_type() == CmdLine::KLT)
00056     tracker = new vpMbKltTracker();
00057   else if(cmd.get_tracker_type() == CmdLine::KLT_MBT)
00058     tracker = new vpMbEdgeKltTracker();
00059   else if(cmd.get_tracker_type() == CmdLine::MBT)
00060     tracker = new vpMbEdgeTracker();
00061 
00062   tracking::Tracker t(cmd,detector,tracker);
00063 
00064   t.start();
00065   reader.acquire(I);
00066 
00067   t.process_event(tracking::select_input(I));
00068   for(int iter=0;(iter<reader.getLastFrameIndex()-1); iter++){
00069     reader.acquire(I);
00070     t.process_event(tracking::input_ready(I,cam,iter));
00071   }
00072 
00073   t.process_event(tracking::finished());
00074 }


visp_auto_tracker
Author(s): Filip Novotny
autogenerated on Fri Aug 28 2015 13:36:44