2 #include <visp3/core/vpIoTools.h> 3 #include <visp3/gui/vpDisplayGDI.h> 4 #include <visp3/gui/vpDisplayOpenCV.h> 5 #include <visp3/gui/vpDisplayX.h> 6 #include <visp3/io/vpImageIo.h> 7 #include <visp3/io/vpVideoReader.h> 8 #include <visp3/mbt/vpMbEdgeKltTracker.h> 10 int main(
int argc,
char **argv)
12 #if defined(VISP_HAVE_OPENCV) && (VISP_HAVE_OPENCV_VERSION >= 0x020100) 15 std::string videoname =
"teabox.mp4";
17 for (
int i = 0; i < argc; i++) {
18 if (std::string(argv[i]) ==
"--name")
19 videoname = std::string(argv[i + 1]);
20 else if (std::string(argv[i]) ==
"--help" || std::string(argv[i]) ==
"-h") {
21 std::cout <<
"\nUsage: " << argv[0] <<
" [--name <video name>] [--help] [-h]\n" << std::endl;
28 if (!parentname.empty())
29 objectname = parentname +
"/" + objectname;
31 std::cout <<
"Video name: " << videoname << std::endl;
32 std::cout <<
"Tracker requested config files: " << objectname <<
".[init," 34 <<
"cao or wrl]" << std::endl;
35 std::cout <<
"Tracker optional config files: " << objectname <<
".[ppm]" << std::endl;
45 #if defined(VISP_HAVE_X11) 46 vpDisplayX display(I, 100, 100,
"Model-based hybrid tracker");
47 #elif defined(VISP_HAVE_GDI) 48 vpDisplayGDI display(I, 100, 100,
"Model-based hybrid tracker");
49 #elif defined(VISP_HAVE_OPENCV) 52 std::cout <<
"No image viewer is available..." << std::endl;
93 tracker.
initClick(I, objectname +
".init",
true);
111 std::cout <<
"Catch a ViSP exception: " << e << std::endl;
113 #ifdef VISP_HAVE_OGRE 114 catch (Ogre::Exception &e) {
115 std::cout <<
"Catch an Ogre exception: " << e.getDescription() << std::endl;
121 std::cout <<
"Install OpenCV and rebuild ViSP to use this example." << std::endl;
virtual void setKltOpencv(const vpKltOpencv &t)
void setMovingEdge(const vpMe &me)
void setMaxFeatures(int maxCount)
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())
virtual unsigned int getClipping() const
virtual void setAngleDisappear(const double &a)
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 display(const vpImage< unsigned char > &I, const vpHomogeneousMatrix &cMo, const vpCameraParameters &cam, const vpColor &col, unsigned int thickness=1, bool displayFullModel=false)
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
virtual void setOgreShowConfigDialog(bool showConfigDialog)
void setMinDistance(double minDistance)
error that can be emited by ViSP classes.
virtual void setClipping(const unsigned int &flags)
static void flush(const vpImage< unsigned char > &I)
virtual void setFarClippingDistance(const double &dist)
void setMu1(const double &mu_1)
void setQuality(double qualityLevel)
virtual void loadConfigFile(const std::string &configFile, bool verbose=true)
void open(vpImage< vpRGBa > &I)
virtual void setOgreVisibilityTest(const bool &v)
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...
virtual void track(const vpImage< unsigned char > &I)
Generic class defining intrinsic camera parameters.
void acquire(vpImage< vpRGBa > &I)
void setWindowSize(int winSize)
virtual void setAngleAppear(const double &a)
static double rad(double deg)
virtual void setCameraParameters(const vpCameraParameters &cam)
void initPersProjWithoutDistortion(double px, double py, double u0, double v0)
virtual void getCameraParameters(vpCameraParameters &cam) const
Hybrid tracker based on moving-edges and keypoints tracked using KLT tracker.
void setMu2(const double &mu_2)
virtual void getPose(vpHomogeneousMatrix &cMo) const
void setMaskBorder(const unsigned int &e)
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)
void setBlockSize(int blockSize)
virtual void setDisplayFeatures(bool displayF)
virtual void setNearClippingDistance(const double &dist)