 |
Visual Servoing Platform
version 3.2.0
|
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) {
99 dynamic_cast<vpMbEdgeMultiTracker *>(tracker)->setMovingEdge(me);
102 #ifdef VISP_HAVE_MODULE_KLT
103 if (opt_tracker == 1 || opt_tracker == 2) {
112 dynamic_cast<vpMbKltMultiTracker *>(tracker)->setKltOpencv(klt_settings);
113 dynamic_cast<vpMbKltMultiTracker *>(tracker)->setKltMaskBorder(5);
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)
Use the X11 console to display images on unix-like OS. Thus to enable this class X11 should be instal...
virtual void setDisplayFeatures(const bool displayF)
void setMinDistance(double minDistance)
void setMaxFeatures(const int maxCount)
virtual void loadModel(const std::string &modelFile, const bool verbose=false, const vpHomogeneousMatrix &T=vpHomogeneousMatrix())
Hybrid stereo (or more) tracker based on moving-edges and keypoints tracked using KLT tracker.
Generic class defining intrinsic camera parameters.
void setMu2(const double &mu_2)
virtual void getPose(vpHomogeneousMatrix &cMo_) const
virtual void track(const vpImage< unsigned char > &I)=0
void setQuality(double qualityLevel)
void setHarrisFreeParameter(double harris_k)
void setThreshold(const double &t)
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
Display for windows using GDI (available on any windows 32 platform).
void setRange(const unsigned int &r)
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))
Make the complete stereo (or more) tracking of an object by using its CAD model.
The vpDisplayOpenCV allows to display image using the OpenCV library. Thus to enable this class OpenC...
Wrapper for the KLT (Kanade-Lucas-Tomasi) feature tracker implemented in OpenCV. Thus to enable this ...
void open(vpImage< vpRGBa > &I)
Class that enables to manipulate easily a video file or a sequence of images. As it inherits from the...
Model based stereo (or more) tracker using only KLT.
static void display(const vpImage< unsigned char > &I)
static void displayText(const vpImage< unsigned char > &I, const vpImagePoint &ip, const std::string &s, const vpColor &color)
void setMaskNumber(const unsigned int &a)
virtual void setCameraParameters(const vpCameraParameters &camera)
void setBlockSize(const int blockSize)
void setWindowSize(const int winSize)
static const vpColor none
void setPyramidLevels(const int pyrMaxLevel)
virtual void getCameraParameters(vpCameraParameters &camera) const
void setSampleStep(const double &s)
static void flush(const vpImage< unsigned char > &I)
Main methods for a model-based tracker.
static bool getClick(const vpImage< unsigned char > &I, bool blocking=true)
virtual void initClick(const vpImage< unsigned char > &I, const std::string &initFile, const bool displayHelp=false, const vpHomogeneousMatrix &T=vpHomogeneousMatrix())
Implementation of an homogeneous matrix and operations on such kind of matrices.
void setMu1(const double &mu_1)
Class that defines generic functionnalities for display.
void setMaskSize(const unsigned int &a)
error that can be emited by ViSP classes.
void acquire(vpImage< vpRGBa > &I)
void setFileName(const char *filename)
void initPersProjWithoutDistortion(const double px, const double py, const double u0, const double v0)