Visual Servoing Platform  version 3.0.1
 All Classes Namespaces Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
tutorial-image-viewer.cpp
#include <visp3/gui/vpDisplayGDI.h>
#include <visp3/gui/vpDisplayOpenCV.h>
#include <visp3/gui/vpDisplayX.h>
#include <visp3/io/vpImageIo.h>
#include <visp3/core/vpImagePoint.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(vpException &e) {
std::cout << "Catch an exception: " << e << std::endl;
}
}