38 #include <visp3/core/vpConfig.h>
39 #include <visp3/core/vpDebug.h>
45 #if (defined (VISP_HAVE_GTK) || defined(VISP_HAVE_X11) || defined(VISP_HAVE_GDI) || defined(VISP_HAVE_D3D9) || defined(VISP_HAVE_OPENCV))
47 #include <visp3/core/vpImage.h>
48 #include <visp3/io/vpImageIo.h>
49 #include <visp3/io/vpParseArgv.h>
50 #include <visp3/core/vpIoTools.h>
51 #include <visp3/core/vpRect.h>
53 #include <visp3/gui/vpDisplayOpenCV.h>
54 #include <visp3/gui/vpDisplayGTK.h>
55 #include <visp3/gui/vpDisplayX.h>
56 #include <visp3/gui/vpDisplayGDI.h>
57 #include <visp3/gui/vpDisplayD3D.h>
67 #define GETOPTARGS "hldc"
69 void usage(
const char *name,
const char *badparam);
70 bool getOptions(
int argc,
const char **argv,
bool &list,
bool &click_allowed,
bool &
display);
81 void usage(
const char *name,
const char *badparam)
84 Test video devices or display.\n\
87 %s [-t <type of video device>] [-l] [-c] [-d] [-h]\n\
95 Disable the mouse click. Useful to automaze the \n\
96 execution of this program without humain intervention.\n\
99 Turn off the display.\n\
102 Print the list of video-devices available and exit.\n\
105 Print the help.\n\n");
108 fprintf(stdout,
"\nERROR: Bad parameter [%s]\n", badparam);
123 bool getOptions(
int argc,
const char **argv,
bool &list,
bool &click_allowed,
bool &display)
127 std::string sDisplayType;
131 case 'l': list =
true;
break;
132 case 'h': usage(argv[0], NULL);
return false;
break;
133 case 'c': click_allowed =
false;
break;
134 case 'd': display =
false;
break;
137 usage(argv[0], optarg_);
return false;
break;
141 if ((c == 1) || (c == -1)) {
143 usage(argv[0], NULL);
144 std::cerr <<
"ERROR: " << std::endl;
145 std::cerr <<
" Bad argument " << optarg_ << std::endl << std::endl;
229 vpRect rectangle(iP1, iP2);
238 main(
int argc,
const char ** argv)
241 bool opt_list =
false;
242 bool opt_click_allowed =
true;
243 bool opt_display =
true;
247 if (getOptions(argc, argv, opt_list,
248 opt_click_allowed, opt_display) ==
false) {
254 unsigned nbDevices = 0;
255 std::cout <<
"List of video-devices available: \n";
256 #if defined VISP_HAVE_GTK
257 std::cout <<
" GTK\n";
260 #if defined VISP_HAVE_X11
261 std::cout <<
" X11\n";
264 #if defined VISP_HAVE_GDI
265 std::cout <<
" GDI\n";
268 #if defined VISP_HAVE_D3D9
269 std::cout <<
" D3D\n";
272 #if defined VISP_HAVE_OPENCV
273 std::cout <<
" OpenCV\n";
277 std::cout <<
" No display is available\n";
294 #if defined VISP_HAVE_X11
297 Ix.
init(480, 640, 255);
300 displayX->
init(Ix, 100, 100,
"Display X11") ;
304 if (opt_click_allowed)
309 #if defined(VISP_HAVE_OPENCV)
312 Icv.
init(480, 640, 255);
315 displayCv->
init(Icv, 100, 100,
"Display OpenCV") ;
319 if (opt_click_allowed)
324 #if defined VISP_HAVE_GTK
327 Igtk.
init(480, 640, 255);
330 displayGtk->
init(Igtk, 100, 100,
"Display GTK") ;
334 if (opt_click_allowed)
339 #if defined VISP_HAVE_GDI
342 Igdi.
init(480, 640, 255);
345 displayGdi->
init(Igdi, 100, 100,
"Display GDI") ;
349 if (opt_click_allowed)
354 #if defined VISP_HAVE_D3D9
357 Id3d.
init(480, 640, 255);
360 displayD3d->
init(Id3d, 100, 100,
"Display Direct 3D") ;
364 if (opt_click_allowed)
371 #if defined VISP_HAVE_X11
375 #if defined VISP_HAVE_GTK
379 #if defined(VISP_HAVE_OPENCV)
383 #if defined VISP_HAVE_GDI
387 #if defined VISP_HAVE_D3D9
virtual void displayCircle(const vpImagePoint ¢er, unsigned int radius, const vpColor &color, bool fill=false, unsigned int thickness=1)=0
void init(vpImage< unsigned char > &I, int winx=-1, int winy=-1, const char *title=NULL)
virtual void displayArrow(const vpImagePoint &ip1, const vpImagePoint &ip2, const vpColor &color=vpColor::white, unsigned int w=4, unsigned int h=2, unsigned int thickness=1)=0
void init(unsigned int height, unsigned int width)
set the size of the image
static const vpColor black
Display for windows using GDI (available on any windows 32 platform).
vpDisplayGDI()
Basic constructor.
static void displayText(const vpImage< unsigned char > &I, const vpImagePoint &ip, const std::string &s, const vpColor &color)
Define the X11 console to display images.
void init(vpImage< unsigned char > &I, int winx=-1, int winy=-1, const char *title=NULL)
static const vpColor green
static void flush(const vpImage< unsigned char > &I)
static bool parse(int *argcPtr, const char **argv, vpArgvInfo *argTable, int flags)
static const vpColor orange
Display for windows using Direct3D.
void set_i(const double ii)
static void display(const vpImage< unsigned char > &I)
The vpDisplayOpenCV allows to display image using the opencv library.
virtual void displayCross(const vpImagePoint &ip, unsigned int size, const vpColor &color, unsigned int thickness=1)=0
The vpDisplayGTK allows to display image using the GTK+ library version 1.2.
virtual void displayRectangle(const vpImagePoint &topLeft, unsigned int width, unsigned int height, const vpColor &color, bool fill=false, unsigned int thickness=1)=0
void init(vpImage< unsigned char > &I, int winx=-1, int winy=-1, const char *title=NULL)
virtual void displayDotLine(const vpImagePoint &ip1, const vpImagePoint &ip2, const vpColor &color, unsigned int thickness=1)=0
void set_j(const double jj)
Defines a rectangle in the plane.
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 ...
virtual void displayLine(const vpImagePoint &ip1, const vpImagePoint &ip2, const vpColor &color, unsigned int thickness=1)=0
void init(vpImage< unsigned char > &I, int winx=-1, int winy=-1, const char *title=NULL)
static const vpColor yellow
virtual void displayPoint(const vpImagePoint &ip, const vpColor &color)=0
static const vpColor blue