Visual Servoing Platform  version 3.3.0
tutorial-export-image.cpp
#include <visp3/io/vpImageIo.h>
#include <visp3/gui/vpDisplayX.h>
#include <visp3/gui/vpDisplayGTK.h>
#include <visp3/gui/vpDisplayGDI.h>
#include <visp3/gui/vpDisplayD3D.h>
#include <visp3/gui/vpDisplayOpenCV.h>
int main()
{
vpImage<unsigned char> I(240, 320, 255); // Create a black grey level image
vpImage<vpRGBa> Ioverlay;
// Depending on the detected third party libraries, we instantiate here the
// first video device which is available
#if defined(VISP_HAVE_X11)
#elif defined(VISP_HAVE_GTK)
#elif defined(VISP_HAVE_GDI)
#elif defined(VISP_HAVE_D3D9)
#elif defined(VISP_HAVE_OPENCV)
#endif
// Initialize the display with the image I. Display and image are
// now link together.
#ifdef VISP_HAVE_DISPLAY
d->init(I);
#endif
// Set the display background with image I content
// Draw a red rectangle in the display overlay (foreground)
vpDisplay::displayRectangle(I, 10, 10, 100, 20, vpColor::red, true);
// Flush the foreground and background display
// Updates the color image with the original loaded image and the overlay
vpDisplay::getImage(I, Ioverlay) ;
// Write the color image on the disk
std::cout << "Save image in overlay.ppm" << std::endl;
std::string ofilename("overlay.png");
vpImageIo::write(Ioverlay, ofilename) ;
// Wait for a click in the display window
std::cout << "A click to quit..." << std::endl;
#ifdef VISP_HAVE_DISPLAY
delete d;
#endif
}
vpDisplayX
Use the X11 console to display images on unix-like OS. Thus to enable this class X11 should be instal...
Definition: vpDisplayX.h:149
vpDisplayGDI
Display for windows using GDI (available on any windows 32 platform).
Definition: vpDisplayGDI.h:127
vpDisplay::displayRectangle
static void displayRectangle(const vpImage< unsigned char > &I, const vpImagePoint &topLeft, unsigned int width, unsigned int height, const vpColor &color, bool fill=false, unsigned int thickness=1)
Definition: vpDisplay_uchar.cpp:547
vpDisplayD3D
Display for windows using Direct3D 3rd party. Thus to enable this class Direct3D should be installed....
Definition: vpDisplayD3D.h:105
vpDisplayOpenCV
The vpDisplayOpenCV allows to display image using the OpenCV library. Thus to enable this class OpenC...
Definition: vpDisplayOpenCV.h:140
vpImageIo::write
static void write(const vpImage< unsigned char > &I, const std::string &filename)
Definition: vpImageIo.cpp:444
vpDisplay::display
static void display(const vpImage< unsigned char > &I)
Definition: vpDisplay_uchar.cpp:739
vpDisplayGTK
The vpDisplayGTK allows to display image using the GTK 3rd party library. Thus to enable this class G...
Definition: vpDisplayGTK.h:136
vpDisplayX::init
void init(vpImage< unsigned char > &I, int winx=-1, int winy=-1, const std::string &title="")
Definition: vpDisplayX.cpp:251
vpDisplay::flush
static void flush(const vpImage< unsigned char > &I)
Definition: vpDisplay_uchar.cpp:715
vpImage< unsigned char >
vpDisplay::getClick
static bool getClick(const vpImage< unsigned char > &I, bool blocking=true)
Definition: vpDisplay_uchar.cpp:764
vpDisplay::getImage
static void getImage(const vpImage< unsigned char > &Is, vpImage< vpRGBa > &Id)
Definition: vpDisplay.cpp:143
vpDisplay
Class that defines generic functionnalities for display.
Definition: vpDisplay.h:170
vpColor::red
static const vpColor red
Definition: vpColor.h:178