Visual Servoing Platform  version 3.2.0 under development (2019-01-22)
tutorial-image-display.cpp
1 #include <visp3/gui/vpDisplayGDI.h>
3 #include <visp3/gui/vpDisplayX.h>
4 
5 int main()
6 {
7  vpImage<unsigned char> I(2160, 3840, 128);
8 
9  try {
10 #if defined(VISP_HAVE_X11)
11  vpDisplayX d(I);
12 #elif defined(VISP_HAVE_GDI)
13  vpDisplayGDI d(I);
14 #endif
15 
16  vpDisplay::setTitle(I, "My image");
18  vpDisplay::displayCircle(I, I.getHeight() / 2, I.getWidth() / 2, 200, vpColor::red, true);
20  std::cout << "A click to quit..." << std::endl;
22  } catch (const vpException &e) {
23  std::cout << "Catch an exception: " << e.getMessage() << std::endl;
24  }
25 }
static bool getClick(const vpImage< unsigned char > &I, bool blocking=true)
unsigned int getWidth() const
Definition: vpImage.h:239
Display for windows using GDI (available on any windows 32 platform).
Definition: vpDisplayGDI.h:129
Use the X11 console to display images on unix-like OS. Thus to enable this class X11 should be instal...
Definition: vpDisplayX.h:151
error that can be emited by ViSP classes.
Definition: vpException.h:71
static void flush(const vpImage< unsigned char > &I)
static const vpColor red
Definition: vpColor.h:180
static void display(const vpImage< unsigned char > &I)
const char * getMessage(void) const
Definition: vpException.cpp:90
static void displayCircle(const vpImage< unsigned char > &I, const vpImagePoint &center, unsigned int radius, const vpColor &color, bool fill=false, unsigned int thickness=1)
unsigned int getHeight() const
Definition: vpImage.h:178
static void setTitle(const vpImage< unsigned char > &I, const std::string &windowtitle)