#include <visp3/core/vpConfig.h>
#include <visp3/gui/vpDisplayX.h>
#include <visp3/gui/vpDisplayGDI.h>
#include <visp3/gui/vpDisplayOpenCV.h>
#include <visp3/mbt/vpMbEdgeTracker.h>
#include <visp3/io/vpVideoReader.h>
#include <visp3/vision/vpKeyPoint.h>
#include <visp3/core/vpIoTools.h>
int main(int argc, char ** argv) {
#if defined(VISP_HAVE_OPENCV) && ((VISP_HAVE_OPENCV_VERSION >= 0x020400) || defined(VISP_HAVE_FFMPEG))
try {
std::string videoname = "teabox.mpg";
for (int i=0; i<argc; i++) {
if (std::string(argv[i]) == "--name")
videoname = std::string(argv[i+1]);
else if (std::string(argv[i]) == "--help") {
std::cout << "\nUsage: " << argv[0] << " [--name <video name>] [--help]\n" << std::endl;
return 0;
}
}
if(! parentname.empty())
objectname = parentname + "/" + objectname;
std::cout << "Video name: " << videoname << std::endl;
std::cout << "Tracker requested config files: " << objectname
<< ".[init,"
#ifdef VISP_HAVE_XML2
<< "xml,"
#endif
<< "cao or wrl]" << std::endl;
std::cout << "Tracker optional config files: " << objectname << ".[ppm]" << std::endl;
#if defined(VISP_HAVE_X11)
#elif defined(VISP_HAVE_GDI)
#elif defined(VISP_HAVE_OPENCV)
#else
std::cout << "No image viewer is available..." << std::endl;
return 0;
#endif
display.
init(I, 100, 100,
"Model-based edge tracker");
bool usexml = false;
#ifdef VISP_HAVE_XML2
usexml = true;
}
#endif
if (! usexml) {
}
tracker.
initClick(I, objectname +
".init",
true);
std::string detectorName = "FAST";
std::string extractorName = "ORB";
std::string matcherName = "BruteForce-Hamming";
std::string configurationFile = "detection-config.xml";
#if (defined(VISP_HAVE_OPENCV_NONFREE) || defined(VISP_HAVE_OPENCV_XFEATURES2D))
detectorName = "SIFT";
extractorName = "SIFT";
matcherName = "BruteForce";
configurationFile = "detection-config-SIFT.xml";
#endif
if(usexml) {
#ifdef VISP_HAVE_XML2
#endif
} else {
}
std::vector<cv::KeyPoint> trainKeyPoints;
double elapsedTime;
keypoint_learning.
detect(I, trainKeyPoints, elapsedTime);
std::vector<vpPolygon> polygons;
std::vector<std::vector<vpPoint> > roisPt;
std::pair<std::vector<vpPolygon>, std::vector<std::vector<vpPoint> > > pair = tracker.
getPolygonFaces(
false);
polygons = pair.first;
roisPt = pair.second;
std::vector<cv::Point3f> points3f;
for(std::vector<cv::KeyPoint>::const_iterator it = trainKeyPoints.begin(); it != trainKeyPoints.end(); ++it) {
}
if(usexml) {
#ifdef VISP_HAVE_XML2
#endif
} else {
}
double error;
bool click_done = false;
if(keypoint_detection.
matchPoint(I, cam, cMo, error, elapsedTime)) {
}
click_done = true;
break;
}
}
if (! click_done)
#ifdef VISP_HAVE_XML2
#endif
#if defined(VISP_HAVE_COIN3D) && (COIN_MAJOR_VERSION == 3)
SoDB::finish();
#endif
}
std::cout << "Catch an exception: " << e << std::endl;
}
#else
(void)argc;
(void)argv;
std::cout << "Install OpenCV or ffmpeg and rebuild ViSP to use this example." << std::endl;
#endif
return 0;
}