ViSP
 All Classes Functions Variables Enumerations Enumerator Friends Groups Pages
tutorial-image-viewer.cpp
1 
2 #include <visp/vpDisplayGDI.h>
3 #include <visp/vpDisplayX.h>
4 #include <visp/vpImageIo.h>
5 #include <visp/vpImagePoint.h>
6 
7 int main()
8 {
10  vpImageIo::read(I, "lena.ppm");
11 
12 #if defined(VISP_HAVE_X11)
13  vpDisplayX d(I);
14 #elif defined(VISP_HAVE_GDI)
15  vpDisplayGDI d(I);
16 #else
17  std::cout << "No image viewer is available..." << std::endl;
18 #endif
19  vpDisplay::setTitle(I, "Lena");
21 
22  vpDisplay::displayRectangle(I, vpImagePoint(90,90), 70, 90, vpColor::red, false, 2);
24 
26  vpDisplay::getImage(I, O);
27 
28  try {
29  vpImageIo::write(I, "lena-out.jpg");
30  vpImageIo::write(O, "lena-out-with-overlay.jpg");
31  }
32  catch(...) {
33  std::cout << "Cannot write the image: unsupported format..." << std::endl;
34  }
35 
37 }