51 #include <visp/vpImage.h>
52 #include <visp/vpDisplayX.h>
53 #include <visp/vpDisplayGTK.h>
54 #include <visp/vpDisplayGDI.h>
55 #include <visp/vpDisplayD3D.h>
56 #include <visp/vpDisplayOpenCV.h>
57 #include <visp/vpParseArgv.h>
58 #include <visp/vpRect.h>
61 #define GETOPTARGS "cdh"
63 void usage(
const char *name,
const char *badparam);
64 bool getOptions(
int argc,
const char **argv,
bool &click_allowed,
bool &display);
74 void usage(
const char *name,
const char *badparam)
77 Read an image on the disk, display it using X11, display some\n\
78 features (line, circle, caracters) in overlay and finaly write \n\
79 the image and the overlayed features in an image on the disk.\n\
82 %s [-c] [-d] [-h]\n", name);
87 Disable the mouse click. Useful to automate the \n\
88 execution of this program without humain intervention.\n\
91 Disable the image display. This can be useful \n\
92 for automatic tests using crontab under Unix or \n\
93 using the task manager under Windows.\n\
96 Print the help.\n\n");
99 fprintf(stderr,
"ERROR: \n" );
100 fprintf(stderr,
"\nBad parameter [%s]\n", badparam);
120 bool getOptions(
int argc,
const char **argv,
bool &click_allowed,
bool &display)
127 case 'c': click_allowed =
false;
break;
128 case 'd': display =
false;
break;
129 case 'h': usage(argv[0], NULL);
return false;
break;
132 usage(argv[0], optarg_);
return false;
break;
136 if ((c == 1) || (c == -1)) {
138 usage(argv[0], NULL);
139 std::cerr <<
"ERROR: " << std::endl;
140 std::cerr <<
" Bad argument " << optarg_ << std::endl << std::endl;
147 int main(
int argc,
const char ** argv)
149 #ifdef VISP_HAVE_DISPLAY
150 bool opt_click_allowed =
true;
151 bool opt_display =
true;
154 if (getOptions(argc, argv, opt_click_allowed, opt_display) ==
false) {
162 #if defined(VISP_HAVE_X11)
164 #elif defined(VISP_HAVE_GTK)
166 #elif defined(VISP_HAVE_GDI)
168 #elif defined(VISP_HAVE_D3D9)
170 #elif defined(VISP_HAVE_OPENCV)
182 if (opt_click_allowed) {
183 std::cout <<
"A click in the image to continue..." << std::endl;
199 if (opt_click_allowed) {
200 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 displayROI(const vpImage< unsigned char > &I, const vpRect &roi)
virtual bool getClick(bool blocking=true)=0