Visual Servoing Platform  version 3.2.0 under development (2019-01-22)
tutorial-image-viewer.cpp
#include <visp3/core/vpImagePoint.h>
#include <visp3/gui/vpDisplayGDI.h>
#include <visp3/gui/vpDisplayOpenCV.h>
#include <visp3/gui/vpDisplayX.h>
#include <visp3/io/vpImageIo.h>
int main()
{
try {
vpImageIo::read(I, "monkey.ppm");
#if defined(VISP_HAVE_X11)
vpDisplayX d(I);
#elif defined(VISP_HAVE_GDI)
#elif defined(VISP_HAVE_OPENCV)
#else
std::cout << "No image viewer is available..." << std::endl;
#endif
vpDisplay::setTitle(I, "Monkey");
vpDisplay::displayRectangle(I, vpImagePoint(90, 90), 70, 90, vpColor::red, false, 2);
try {
vpImageIo::write(I, "monkey-out.jpg");
vpImageIo::write(O, "monkey-out-with-overlay.jpg");
} catch (...) {
std::cout << "Cannot write the image: unsupported format..." << std::endl;
}
} catch (const vpException &e) {
std::cout << "Catch an exception: " << e << std::endl;
}
}