45#include <visp3/core/vpImage.h>
46#include <visp3/core/vpRect.h>
47#include <visp3/gui/vpDisplayD3D.h>
48#include <visp3/gui/vpDisplayGDI.h>
49#include <visp3/gui/vpDisplayGTK.h>
50#include <visp3/gui/vpDisplayOpenCV.h>
51#include <visp3/gui/vpDisplayX.h>
52#include <visp3/io/vpParseArgv.h>
55#define GETOPTARGS "cdh"
57void usage(
const char *name,
const char *badparam);
58bool getOptions(
int argc,
const char **argv,
bool &click_allowed,
bool &display);
68void usage(
const char *name,
const char *badparam)
71Read an image on the disk, display it using X11, display some\n\
72features (line, circle, characters) in overlay and finally write \n\
73the image and the overlayed features in an image on the disk.\n\
82 Disable the mouse click. Useful to automate the \n\
83 execution of this program without human intervention.\n\
86 Disable the image display. This can be useful \n\
87 for automatic tests using crontab under Unix or \n\
88 using the task manager under Windows.\n\
91 Print the help.\n\n");
94 fprintf(stderr,
"ERROR: \n");
95 fprintf(stderr,
"\nBad parameter [%s]\n", badparam);
114bool getOptions(
int argc,
const char **argv,
bool &click_allowed,
bool &display)
122 click_allowed =
false;
128 usage(argv[0], NULL);
133 usage(argv[0], optarg_);
139 if ((c == 1) || (c == -1)) {
141 usage(argv[0], NULL);
142 std::cerr <<
"ERROR: " << std::endl;
143 std::cerr <<
" Bad argument " << optarg_ << std::endl << std::endl;
150int main(
int argc,
const char **argv)
152#ifdef VISP_HAVE_DISPLAY
153 bool opt_click_allowed =
true;
154 bool opt_display =
true;
157 if (getOptions(argc, argv, opt_click_allowed, opt_display) ==
false) {
165#if defined(VISP_HAVE_X11)
167#elif defined(VISP_HAVE_GTK)
169#elif defined(VISP_HAVE_GDI)
171#elif defined(VISP_HAVE_D3D9)
173#elif defined(HAVE_OPENCV_HIGHGUI)
185 if (opt_click_allowed) {
186 std::cout <<
"A click in the image to continue..." << std::endl;
202 if (opt_click_allowed) {
203 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...
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 win_x=-1, int win_y=-1, const std::string &win_title="")
static void close(vpImage< unsigned char > &I)
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 flush(const vpImage< unsigned char > &I)
Definition of the vpImage class member functions.
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.