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;
static bool getClick(const vpImage< unsigned char > &I, bool blocking=true)
static void close(vpImage< unsigned char > &I)
unsigned int getWidth() const
Display for windows using GDI (available on any windows 32 platform).
Use the X11 console to display images on unix-like OS. Thus to enable this class X11 should be instal...
void init(vpImage< unsigned char > &I, int winx=-1, int winy=-1, const std::string &title="")
static void flush(const vpImage< unsigned char > &I)
static bool parse(int *argcPtr, const char **argv, vpArgvInfo *argTable, int flags)
Display for windows using Direct3D 3rd party. Thus to enable this class Direct3D should be installed...
static void display(const vpImage< unsigned char > &I)
The vpDisplayOpenCV allows to display image using the OpenCV library. Thus to enable this class OpenC...
The vpDisplayGTK allows to display image using the GTK 3rd party library. Thus to enable this class G...
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)