#include <visp3/core/vpIoTools.h>
#include <visp3/gui/vpDisplayGDI.h>
#include <visp3/gui/vpDisplayOpenCV.h>
#include <visp3/gui/vpDisplayX.h>
#include <visp3/io/vpImageIo.h>
#include <visp3/mbt/vpMbGenericTracker.h>
#include <visp3/io/vpVideoReader.h>
int main(int argc, char **argv)
{
#if defined(VISP_HAVE_OPENCV) && (VISP_HAVE_OPENCV_VERSION >= 0x020100)
try {
std::string opt_videoname = "teabox.mpg";
std::string opt_modelname = "teabox.cao";
int opt_tracker = 0;
for (int i = 0; i < argc; i++) {
if (std::string(argv[i]) == "--video")
opt_videoname = std::string(argv[i + 1]);
else if (std::string(argv[i]) == "--model")
opt_modelname = std::string(argv[i + 1]);
else if (std::string(argv[i]) == "--tracker")
opt_tracker = atoi(argv[i + 1]);
else if (std::string(argv[i]) == "--help") {
std::cout << "\nUsage: " << argv[0]
<< " [--video <video name>] [--model <model name>] "
"[--tracker <0=egde|1=keypoint|2=hybrid>] [--help]\n"
<< std::endl;
return 0;
}
}
if (!parentname.empty())
objectname = parentname + "/" + objectname;
std::cout << "Video name: " << opt_videoname << std::endl;
std::cout << "Tracker requested config files: " << objectname << ".[init,"
#ifdef VISP_HAVE_XML2
<< "xml,"
#endif
<< "cao or wrl]" << std::endl;
std::cout << "Tracker optional config files: " << objectname << ".[ppm]" << std::endl;
#if defined(VISP_HAVE_X11)
#elif defined(VISP_HAVE_GDI)
#else
#endif
display->init(I, 100, 100, "Model-based tracker");
if (opt_tracker == 0)
#ifdef VISP_HAVE_MODULE_KLT
else if (opt_tracker == 1)
else
#else
else {
std::cout << "klt and hybrid model-based tracker are not available since visp_klt module is not available. "
"In CMakeGUI turn visp_klt module ON, configure and build ViSP again."
<< std::endl;
return 0;
}
#endif
bool usexml = false;
#ifdef VISP_HAVE_XML2
usexml = true;
}
#endif
if (!usexml) {
if (opt_tracker == 0 || opt_tracker == 2) {
}
#ifdef VISP_HAVE_MODULE_KLT
if (opt_tracker == 1 || opt_tracker == 2) {
}
#endif
}
tracker.
initClick(I, objectname +
".init",
true);
break;
}
#ifdef VISP_HAVE_XML2
#endif
#if defined(VISP_HAVE_COIN3D) && (COIN_MAJOR_VERSION >= 2)
SoDB::finish();
#endif
delete display;
std::cout << "Catch a ViSP exception: " << e << std::endl;
}
#ifdef VISP_HAVE_OGRE
catch (Ogre::Exception &e) {
std::cout << "Catch an Ogre exception: " << e.getDescription() << std::endl;
}
#endif
#else
(void)argc;
(void)argv;
std::cout << "Install OpenCV and rebuild ViSP to use this example." << std::endl;
#endif
}