3 #include <visp3/core/vpConfig.h> 4 #if defined(VISP_BUILD_DEPRECATED_FUNCTIONS) 6 #include <visp3/core/vpIoTools.h> 7 #include <visp3/gui/vpDisplayGDI.h> 8 #include <visp3/gui/vpDisplayOpenCV.h> 9 #include <visp3/gui/vpDisplayX.h> 10 #include <visp3/io/vpImageIo.h> 12 #include <visp3/mbt/vpMbEdgeKltMultiTracker.h> 13 #include <visp3/mbt/vpMbEdgeMultiTracker.h> 15 #include <visp3/io/vpVideoReader.h> 17 int main(
int argc,
char **argv)
19 #if defined(VISP_HAVE_OPENCV) && (VISP_HAVE_OPENCV_VERSION >= 0x020100) 21 std::string opt_videoname =
"teabox.mpg";
24 for (
int i = 0; i < argc; i++) {
25 if (std::string(argv[i]) ==
"--name" && i + 1 < argc)
26 opt_videoname = std::string(argv[i + 1]);
27 else if (std::string(argv[i]) ==
"--tracker" && i + 1 < argc)
28 opt_tracker = atoi(argv[i + 1]);
29 else if (std::string(argv[i]) ==
"--help") {
30 std::cout <<
"\nUsage: " << argv[0]
31 <<
" [--name <video name>] [--tracker " 32 "<0=egde|1=keypoint|2=hybrid>] [--help]\n" 40 if (!parentname.empty()) {
41 objectname = parentname +
"/" + objectname;
44 std::cout <<
"Video name: " << opt_videoname << std::endl;
45 std::cout <<
"Tracker requested config files: " << objectname <<
".[init, cao]" << std::endl;
46 std::cout <<
"Tracker optional config files: " << objectname <<
".[ppm]" << std::endl;
61 #if defined(VISP_HAVE_X11) 63 #elif defined(VISP_HAVE_GDI) 68 display->init(I, 100, 100,
"Model-based tracker");
74 #ifdef VISP_HAVE_MODULE_KLT 75 else if (opt_tracker == 1)
81 std::cout <<
"klt and hybrid model-based tracker are not available " 82 "since visp_klt module is missing" 90 if (opt_tracker == 0 || opt_tracker == 2) {
102 #ifdef VISP_HAVE_MODULE_KLT 103 if (opt_tracker == 1 || opt_tracker == 2) {
130 tracker->
initClick(I, objectname +
".init",
true);
160 std::cerr <<
"Catch a ViSP exception: " << e << std::endl;
165 std::cout <<
"Install OpenCV and rebuild ViSP to use this example." << std::endl;
171 std::cout <<
"Nothing to run, deprecated tutorial." << std::endl;
174 #endif //#if defined(VISP_BUILD_DEPRECATED_FUNCTIONS) void setMaxFeatures(int maxCount)
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)
virtual void loadModel(const std::string &modelFile, bool verbose=false, const vpHomogeneousMatrix &T=vpHomogeneousMatrix())
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 setSampleStep(const double &s)
static void displayText(const vpImage< unsigned char > &I, const vpImagePoint &ip, const std::string &s, const vpColor &color)
virtual void initClick(const vpImage< unsigned char > &I, const std::string &initFile, bool displayHelp=false, const vpHomogeneousMatrix &T=vpHomogeneousMatrix())
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)
virtual void display(const vpImage< unsigned char > &I, const vpHomogeneousMatrix &cMo, const vpCameraParameters &cam, const vpColor &col, unsigned int thickness=1, bool displayFullModel=false)=0
void setMu1(const double &mu_1)
void setQuality(double qualityLevel)
void open(vpImage< vpRGBa > &I)
virtual void getPose(vpHomogeneousMatrix &cMo) const
virtual void setCameraParameters(const vpCameraParameters &cam)
void setMaskSize(const unsigned int &a)
void setPyramidLevels(int pyrMaxLevel)
static void display(const vpImage< unsigned char > &I)
The vpDisplayOpenCV allows to display image using the OpenCV library. Thus to enable this class OpenC...
Generic class defining intrinsic camera parameters.
Main methods for a model-based tracker.
void acquire(vpImage< vpRGBa > &I)
void setWindowSize(int winSize)
void initPersProjWithoutDistortion(double px, double py, double u0, double v0)
void setMu2(const double &mu_2)
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, const vpImagePoint &offset=vpImagePoint(0, 0))
Wrapper for the KLT (Kanade-Lucas-Tomasi) feature tracker implemented in OpenCV. Thus to enable this ...
void setThreshold(const double &t)
void setFileName(const std::string &filename)
void setRange(const unsigned int &r)
Make the complete stereo (or more) tracking of an object by using its CAD model.
void setBlockSize(int blockSize)
virtual void setDisplayFeatures(bool displayF)
Model based stereo (or more) tracker using only KLT.
virtual void getCameraParameters(vpCameraParameters &cam) const