1 #include <visp3/gui/vpDisplayGDI.h>
3 #include <visp3/gui/vpDisplayOpenCV.h>
4 #include <visp3/gui/vpDisplayX.h>
5 #include <visp3/io/vpImageIo.h>
6 #include <visp3/core/vpIoTools.h>
8 #include <visp3/mbt/vpMbEdgeMultiTracker.h>
9 #include <visp3/mbt/vpMbEdgeKltMultiTracker.h>
11 #include <visp3/io/vpVideoReader.h>
13 int main(
int argc,
char** argv)
15 #if defined(VISP_HAVE_OPENCV) && (VISP_HAVE_OPENCV_VERSION >= 0x020100)
17 std::string opt_videoname =
"teabox.mpg";
20 for (
int i=0; i<argc; i++) {
21 if (std::string(argv[i]) ==
"--name" && i+1 < argc)
22 opt_videoname = std::string(argv[i+1]);
23 else if (std::string(argv[i]) ==
"--tracker" && i+1 < argc)
24 opt_tracker = atoi(argv[i+1]);
25 else if (std::string(argv[i]) ==
"--help") {
26 std::cout <<
"\nUsage: " << argv[0] <<
" [--name <video name>] [--tracker <0=egde|1=keypoint|2=hybrid>] [--help]\n" << std::endl;
33 if(! parentname.empty()) {
34 objectname = parentname +
"/" + objectname;
37 std::cout <<
"Video name: " << opt_videoname << std::endl;
38 std::cout <<
"Tracker requested config files: " << objectname
39 <<
".[init, cao]" << std::endl;
40 std::cout <<
"Tracker optional config files: " << objectname <<
".[ppm]" << std::endl;
55 #if defined(VISP_HAVE_X11)
57 #elif defined(VISP_HAVE_GDI)
62 display->init(I, 100, 100,
"Model-based tracker");
68 #ifdef VISP_HAVE_MODULE_KLT
69 else if (opt_tracker == 1)
75 std::cout <<
"klt and hybrid model-based tracker are not available since visp_klt module is missing" << std::endl;
82 if (opt_tracker == 0 || opt_tracker == 2) {
94 #ifdef VISP_HAVE_MODULE_KLT
95 if (opt_tracker == 1 || opt_tracker == 2) {
122 tracker->
initClick(I, objectname +
".init",
true);
153 std::cerr <<
"Catch a ViSP exception: " << e << std::endl;
158 std::cout <<
"Install OpenCV and rebuild ViSP to use this example." << std::endl;
virtual void setDisplayFeatures(const bool displayF)
Class that defines generic functionnalities for display.
virtual void track(const vpImage< unsigned char > &I)=0
static bool getClick(const vpImage< unsigned char > &I, bool blocking=true)
void setHarrisFreeParameter(double harris_k)
Implementation of an homogeneous matrix and operations on such kind of matrices.
void setMaskNumber(const unsigned int &a)
Display for windows using GDI (available on any windows 32 platform).
void setMaxFeatures(const int maxCount)
void setSampleStep(const double &s)
static void displayText(const vpImage< unsigned char > &I, const vpImagePoint &ip, const std::string &s, const vpColor &color)
Use the X11 console to display images on unix-like OS. Thus to enable this class X11 should be instal...
Class that enables to manipulate easily a video file or a sequence of images. As it inherits from the...
static const vpColor none
void setMinDistance(double minDistance)
error that can be emited by ViSP classes.
Hybrid stereo (or more) tracker based on moving-edges and keypoints tracked using KLT tracker...
static void flush(const vpImage< unsigned char > &I)
void setMu1(const double &mu_1)
void setQuality(double qualityLevel)
void initPersProjWithoutDistortion(const double px, const double py, const double u0, const double v0)
void open(vpImage< vpRGBa > &I)
virtual void display(const vpImage< unsigned char > &I, const vpHomogeneousMatrix &cMo, const vpCameraParameters &cam, const vpColor &col, const unsigned int thickness=1, const bool displayFullModel=false)=0
virtual void setCameraParameters(const vpCameraParameters &camera)
void setMaskSize(const unsigned int &a)
static void display(const vpImage< unsigned char > &I)
The vpDisplayOpenCV allows to display image using the OpenCV library. Thus to enable this class OpenC...
virtual void getCameraParameters(vpCameraParameters &camera) const
Generic class defining intrinsic camera parameters.
Main methods for a model-based tracker.
void acquire(vpImage< vpRGBa > &I)
void setFileName(const char *filename)
virtual void initClick(const vpImage< unsigned char > &I, const std::string &initFile, const bool displayHelp=false)
void setPyramidLevels(const int pyrMaxLevel)
static void displayFrame(const vpImage< unsigned char > &I, const vpHomogeneousMatrix &cMo, const vpCameraParameters &cam, double size, const vpColor &color=vpColor::none, unsigned int thickness=1, vpImagePoint offset=vpImagePoint(0, 0))
void setMu2(const double &mu_2)
void setWindowSize(const int winSize)
virtual void loadModel(const char *modelFile, const bool verbose=false)
Wrapper for the KLT (Kanade-Lucas-Tomasi) feature tracker implemented in OpenCV. Thus to enable this ...
virtual void getPose(vpHomogeneousMatrix &cMo_) const
void setBlockSize(const int blockSize)
void setThreshold(const double &t)
void setRange(const unsigned int &r)
Make the complete stereo (or more) tracking of an object by using its CAD model.
Model based stereo (or more) tracker using only KLT.