43#include <visp3/core/vpImage.h>
44#include <visp3/core/vpRect.h>
45#include <visp3/gui/vpDisplayFactory.h>
46#include <visp3/io/vpParseArgv.h>
49#define GETOPTARGS "cdh"
51#ifdef ENABLE_VISP_NAMESPACE
55void usage(
const char *name,
const char *badparam);
56bool getOptions(
int argc,
const char **argv,
bool &click_allowed,
bool &display);
66void usage(
const char *name,
const char *badparam)
69Read an image on the disk, display it using X11, display some\n\
70features (line, circle, characters) in overlay and finally write \n\
71the image and the overlayed features in an image on the disk.\n\
80 Disable the mouse click. Useful to automate the \n\
81 execution of this program without human intervention.\n\
84 Disable the image display. This can be useful \n\
85 for automatic tests using crontab under Unix or \n\
86 using the task manager under Windows.\n\
89 Print the help.\n\n");
92 fprintf(stderr,
"ERROR: \n");
93 fprintf(stderr,
"\nBad parameter [%s]\n", badparam);
112bool getOptions(
int argc,
const char **argv,
bool &click_allowed,
bool &display)
120 click_allowed =
false;
126 usage(argv[0],
nullptr);
130 usage(argv[0], optarg_);
135 if ((c == 1) || (c == -1)) {
137 usage(argv[0],
nullptr);
138 std::cerr <<
"ERROR: " << std::endl;
139 std::cerr <<
" Bad argument " << optarg_ << std::endl << std::endl;
146int main(
int argc,
const char **argv)
148#ifdef VISP_HAVE_DISPLAY
149 bool opt_click_allowed =
true;
150 bool opt_display =
true;
153 if (getOptions(argc, argv, opt_click_allowed, opt_display) ==
false) {
161#if(VISP_CXX_STANDARD >= VISP_CXX_STANDARD_11)
172 vpRect roi(I.getWidth() / 4, I.getHeight() / 4, I.getWidth() / 2, I.getHeight() / 2);
175 if (opt_click_allowed) {
176 std::cout <<
"A click in the image to continue..." << std::endl;
191 if (opt_click_allowed) {
192 std::cout <<
"A click in the image to exit..." << std::endl;
195#if(VISP_CXX_STANDARD < VISP_CXX_STANDARD_11)
Class that defines generic functionalities for display.
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)
Definition of the vpImage class member functions.
static bool parse(int *argcPtr, const char **argv, vpArgvInfo *argTable, int flags)
Defines a rectangle in the plane.
std::shared_ptr< vpDisplay > createDisplay()
Return a smart pointer vpDisplay specialization if a GUI library is available or nullptr otherwise.
vpDisplay * allocateDisplay()
Return a newly allocated vpDisplay specialization if a GUI library is available or nullptr otherwise.