40 #include <visp3/core/vpConfig.h>
42 #if defined(VISP_HAVE_OPENCV) && (VISP_HAVE_OPENCV_VERSION >= 0x020301)
44 #include <visp3/vision/vpKeyPoint.h>
45 #include <visp3/core/vpImage.h>
46 #include <visp3/io/vpImageIo.h>
47 #include <visp3/gui/vpDisplayX.h>
48 #include <visp3/gui/vpDisplayGTK.h>
49 #include <visp3/gui/vpDisplayGDI.h>
50 #include <visp3/gui/vpDisplayOpenCV.h>
51 #include <visp3/io/vpVideoReader.h>
52 #include <visp3/core/vpIoTools.h>
53 #include <visp3/io/vpParseArgv.h>
56 #define GETOPTARGS "cdh"
58 void usage(
const char *name,
const char *badparam);
59 bool getOptions(
int argc,
const char **argv,
bool &click_allowed,
bool &display);
69 void usage(
const char *name,
const char *badparam)
72 Test keypoints matching.\n\
75 %s [-c] [-d] [-h]\n", name);
81 Disable the mouse click. Useful to automate the \n\
82 execution of this program without human intervention.\n\
85 Turn off the display.\n\
91 fprintf(stdout,
"\nERROR: Bad parameter [%s]\n", badparam);
105 bool getOptions(
int argc,
const char **argv,
bool &click_allowed,
bool &display)
112 case 'c': click_allowed =
false;
break;
113 case 'd': display =
false;
break;
114 case 'h': usage(argv[0], NULL);
return false;
break;
117 usage(argv[0], optarg_);
122 if ((c == 1) || (c == -1)) {
124 usage(argv[0], NULL);
125 std::cerr <<
"ERROR: " << std::endl;
126 std::cerr <<
" Bad argument " << optarg_ << std::endl << std::endl;
138 int main(
int argc,
const char ** argv) {
140 std::string env_ipath;
141 bool opt_click_allowed =
true;
142 bool opt_display =
true;
145 if (getOptions(argc, argv, opt_click_allowed, opt_display) ==
false) {
152 if(env_ipath.empty()) {
153 std::cerr <<
"Please set the VISP_INPUT_IMAGE_PATH environment variable value." << std::endl;
168 vpKeyPoint keypoints(
"ORB",
"ORB",
"BruteForce-Hamming");
169 std::cout <<
"Build " << keypoints.buildReference(Iref) <<
" reference points." << std::endl;
179 #if defined VISP_HAVE_X11
181 #elif defined VISP_HAVE_GTK
183 #elif defined VISP_HAVE_GDI
190 display.
init(Imatch, 0, 0,
"ORB keypoints matching");
193 bool opt_click =
false;
204 keypoints.matchPoint(Icur);
206 keypoints.displayMatching(Iref, Imatch);
213 if (opt_click_allowed && opt_display) {
234 std::cerr << e.
what() << std::endl;
238 std::cout <<
"testKeyPoint is ok !" << std::endl;
243 std::cerr <<
"You need OpenCV library." << std::endl;
void init(vpImage< unsigned char > &I, int winx=-1, int winy=-1, const char *title=NULL)
unsigned int getWidth() const
Display for windows using GDI (available on any windows 32 platform).
Define the X11 console to display images.
Class that enables to manipulate easily a video file or a sequence of images. As it inherits from the...
error that can be emited by ViSP classes.
static void flush(const vpImage< unsigned char > &I)
static bool parse(int *argcPtr, const char **argv, vpArgvInfo *argTable, int flags)
void open(vpImage< vpRGBa > &I)
const char * what() const
static void display(const vpImage< unsigned char > &I)
The vpDisplayOpenCV allows to display image using the opencv library.
The vpDisplayGTK allows to display image using the GTK+ library version 1.2.
void acquire(vpImage< vpRGBa > &I)
void resize(const unsigned int h, const unsigned int w)
set the size of the image without initializing it.
void setFileName(const char *filename)
Class that allows keypoints detection (and descriptors extraction) and matching thanks to OpenCV libr...
void insert(const vpImage< Type > &src, const vpImagePoint topLeft)
unsigned int getHeight() const
virtual bool getClick(bool blocking=true)=0
Class that defines a 2D point in an image. This class is useful for image processing and stores only ...
static void read(vpImage< unsigned char > &I, const char *filename)