43 #include <visp3/core/vpImage.h>
44 #include <visp3/core/vpRect.h>
45 #include <visp3/gui/vpDisplayD3D.h>
46 #include <visp3/gui/vpDisplayGDI.h>
47 #include <visp3/gui/vpDisplayGTK.h>
48 #include <visp3/gui/vpDisplayOpenCV.h>
49 #include <visp3/gui/vpDisplayX.h>
50 #include <visp3/io/vpParseArgv.h>
53 #define GETOPTARGS "cdh"
55 #ifdef ENABLE_VISP_NAMESPACE
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, characters) in overlay and finally write \n\
75 the image and the overlayed features in an image on the disk.\n\
84 Disable the mouse click. Useful to automate the \n\
85 execution of this program without human intervention.\n\
88 Disable the image display. This can be useful \n\
89 for automatic tests using crontab under Unix or \n\
90 using the task manager under Windows.\n\
93 Print the help.\n\n");
96 fprintf(stderr,
"ERROR: \n");
97 fprintf(stderr,
"\nBad parameter [%s]\n", badparam);
116 bool getOptions(
int argc,
const char **argv,
bool &click_allowed,
bool &display)
124 click_allowed =
false;
130 usage(argv[0],
nullptr);
135 usage(argv[0], optarg_);
141 if ((c == 1) || (c == -1)) {
143 usage(argv[0],
nullptr);
144 std::cerr <<
"ERROR: " << std::endl;
145 std::cerr <<
" Bad argument " << optarg_ << std::endl << std::endl;
152 int main(
int argc,
const char **argv)
154 #ifdef VISP_HAVE_DISPLAY
155 bool opt_click_allowed =
true;
156 bool opt_display =
true;
159 if (getOptions(argc, argv, opt_click_allowed, opt_display) ==
false) {
167 #if defined(VISP_HAVE_X11)
169 #elif defined(VISP_HAVE_GTK)
171 #elif defined(VISP_HAVE_GDI)
173 #elif defined(VISP_HAVE_D3D9)
175 #elif defined(HAVE_OPENCV_HIGHGUI)
187 if (opt_click_allowed) {
188 std::cout <<
"A click in the image to continue..." << std::endl;
204 if (opt_click_allowed) {
205 std::cout <<
"A click in the image to exit..." << std::endl;
Display for windows using Direct3D 3rd party. Thus to enable this class Direct3D should be installed....
Display for windows using GDI (available on any windows 32 platform).
The vpDisplayGTK allows to display image using the GTK 3rd party library. Thus to enable this class G...
The vpDisplayOpenCV allows to display image using the OpenCV library. Thus to enable this class OpenC...
void init(vpImage< unsigned char > &I, int winx=-1, int winy=-1, const std::string &title="") VP_OVERRIDE
static bool getClick(const vpImage< unsigned char > &I, bool blocking=true)
static void displayROI(const vpImage< unsigned char > &I, const vpRect &roi)
static void display(const vpImage< unsigned char > &I)
static void flushROI(const vpImage< unsigned char > &I, const vpRect &roi)
static void close(vpImage< unsigned char > &I)
static void flush(const vpImage< unsigned char > &I)
unsigned int getWidth() const
unsigned int getHeight() const
static bool parse(int *argcPtr, const char **argv, vpArgvInfo *argTable, int flags)
Defines a rectangle in the plane.