 |
Visual Servoing Platform
version 3.2.0
|
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/vpMbKltTracker.h>
10 int main(
int argc,
char **argv)
12 #if defined(VISP_HAVE_OPENCV) && (VISP_HAVE_OPENCV_VERSION >= 0x020100)
15 std::string videoname =
"teabox.mpg";
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") {
21 std::cout <<
"\nUsage: " << argv[0] <<
" [--name <video name>] [--help]\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,"
36 <<
"cao or wrl]" << std::endl;
37 std::cout <<
"Tracker optional config files: " << objectname <<
".[ppm]" << std::endl;
46 #if defined(VISP_HAVE_X11)
48 #elif defined(VISP_HAVE_GDI)
50 #elif defined(VISP_HAVE_OPENCV)
53 std::cout <<
"No image viewer is available..." << std::endl;
57 display.init(I, 100, 100,
"Model-based keypoint tracker");
92 tracker.
loadModel(objectname +
"-triangle.cao");
94 tracker.
initClick(I, objectname +
".init",
true);
112 #ifdef VISP_HAVE_XML2
115 #if defined(VISP_HAVE_COIN3D) && (COIN_MAJOR_VERSION >= 2)
119 std::cout <<
"Catch a ViSP exception: " << e << std::endl;
121 #ifdef VISP_HAVE_OGRE
122 catch (Ogre::Exception &e) {
123 std::cout <<
"Catch an Ogre exception: " << e.getDescription() << std::endl;
129 std::cout <<
"Install OpenCV and rebuild ViSP to use this example." << std::endl;
Use the X11 console to display images on unix-like OS. Thus to enable this class X11 should be instal...
virtual void setAngleDisappear(const double &a)
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())
static double rad(double deg)
virtual unsigned int getClipping() const
Generic class defining intrinsic camera parameters.
virtual void setOgreVisibilityTest(const bool &v)
Model based tracker using only KLT.
virtual void setOgreShowConfigDialog(const bool showConfigDialog)
virtual void getPose(vpHomogeneousMatrix &cMo_) const
void setQuality(double qualityLevel)
void setHarrisFreeParameter(double harris_k)
Display for windows using GDI (available on any windows 32 platform).
void setCameraParameters(const vpCameraParameters &cam)
virtual void track(const vpImage< unsigned char > &I)
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))
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...
virtual void loadConfigFile(const std::string &configFile)
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)
virtual void setKltOpencv(const vpKltOpencv &t)
void setBlockSize(const int blockSize)
virtual void setAngleAppear(const double &a)
void setWindowSize(const int winSize)
void setKltMaskBorder(const unsigned int &e)
static const vpColor none
void setPyramidLevels(const int pyrMaxLevel)
virtual void getCameraParameters(vpCameraParameters &camera) const
virtual void setClipping(const unsigned int &flags)
static void flush(const vpImage< unsigned char > &I)
virtual void setNearClippingDistance(const double &dist)
virtual void setFarClippingDistance(const double &dist)
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)
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.
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)