47 #include <visp3/core/vpImage.h>
48 #include <visp3/gui/vpDisplayX.h>
49 #include <visp3/gui/vpDisplayGTK.h>
50 #include <visp3/gui/vpDisplayGDI.h>
51 #include <visp3/gui/vpDisplayD3D.h>
52 #include <visp3/gui/vpDisplayOpenCV.h>
53 #include <visp3/io/vpParseArgv.h>
54 #include <visp3/core/vpRect.h>
57 #define GETOPTARGS "cdh"
59 void usage(
const char *name,
const char *badparam);
60 bool getOptions(
int argc,
const char **argv,
bool &click_allowed,
bool &
display);
70 void usage(
const char *name,
const char *badparam)
73 Read an image on the disk, display it using X11, display some\n\
74 features (line, circle, caracters) in overlay and finaly write \n\
75 the image and the overlayed features in an image on the disk.\n\
78 %s [-c] [-d] [-h]\n", name);
83 Disable the mouse click. Useful to automate the \n\
84 execution of this program without humain intervention.\n\
87 Disable the image display. This can be useful \n\
88 for automatic tests using crontab under Unix or \n\
89 using the task manager under Windows.\n\
92 Print the help.\n\n");
95 fprintf(stderr,
"ERROR: \n" );
96 fprintf(stderr,
"\nBad parameter [%s]\n", badparam);
116 bool getOptions(
int argc,
const char **argv,
bool &click_allowed,
bool &
display)
123 case 'c': click_allowed =
false;
break;
124 case 'd': display =
false;
break;
125 case 'h': usage(argv[0], NULL);
return false;
break;
128 usage(argv[0], optarg_);
return false;
break;
132 if ((c == 1) || (c == -1)) {
134 usage(argv[0], NULL);
135 std::cerr <<
"ERROR: " << std::endl;
136 std::cerr <<
" Bad argument " << optarg_ << std::endl << std::endl;
143 int main(
int argc,
const char ** argv)
145 #ifdef VISP_HAVE_DISPLAY
146 bool opt_click_allowed =
true;
147 bool opt_display =
true;
150 if (getOptions(argc, argv, opt_click_allowed, opt_display) ==
false) {
158 #if defined(VISP_HAVE_X11)
160 #elif defined(VISP_HAVE_GTK)
162 #elif defined(VISP_HAVE_GDI)
164 #elif defined(VISP_HAVE_D3D9)
166 #elif defined(VISP_HAVE_OPENCV)
178 if (opt_click_allowed) {
179 std::cout <<
"A click in the image to continue..." << std::endl;
195 if (opt_click_allowed) {
196 std::cout <<
"A click in the image to exit..." << std::endl;
void init(vpImage< unsigned char > &I, int winx=-1, int winy=-1, const char *title=NULL)
static void close(vpImage< unsigned char > &I)
unsigned int getWidth() const
Display for windows using GDI (available on any windows 32 platform).
Define the X11 console to display images.
static void flush(const vpImage< unsigned char > &I)
static bool parse(int *argcPtr, const char **argv, vpArgvInfo *argTable, int flags)
Class that defines a RGB 32 bits structure.
Display for windows using Direct3D.
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.
unsigned int getHeight() const
Defines a rectangle in the plane.
static void flushROI(const vpImage< unsigned char > &I, const vpRect &roi)
static void displayROI(const vpImage< unsigned char > &I, const vpRect &roi)
virtual bool getClick(bool blocking=true)=0