48 #include <visp3/core/vpImage.h> 49 #include <visp3/core/vpRect.h> 50 #include <visp3/gui/vpDisplayD3D.h> 51 #include <visp3/gui/vpDisplayGDI.h> 52 #include <visp3/gui/vpDisplayGTK.h> 53 #include <visp3/gui/vpDisplayOpenCV.h> 54 #include <visp3/gui/vpDisplayX.h> 55 #include <visp3/io/vpParseArgv.h> 58 #define GETOPTARGS "cdh" 60 void usage(
const char *name,
const char *badparam);
61 bool getOptions(
int argc,
const char **argv,
bool &click_allowed,
bool &
display);
71 void usage(
const char *name,
const char *badparam)
74 Read an image on the disk, display it using X11, display some\n\ 75 features (line, circle, caracters) in overlay and finaly write \n\ 76 the image and the overlayed features in an image on the disk.\n\ 79 %s [-c] [-d] [-h]\n", name);
84 Disable the mouse click. Useful to automate the \n\ 85 execution of this program without humain 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], NULL);
135 usage(argv[0], optarg_);
141 if ((c == 1) || (c == -1)) {
143 usage(argv[0], NULL);
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(VISP_HAVE_OPENCV) 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;
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)