ViSP  2.8.0
tutorial-viewer.cpp
1 
2 #include <visp/vpDisplayD3D.h>
3 #include <visp/vpDisplayGDI.h>
4 #include <visp/vpDisplayGTK.h>
5 #include <visp/vpDisplayX.h>
6 #include <visp/vpDisplayOpenCV.h>
7 #include <visp/vpImageIo.h>
8 
9 int main(int argc, char** argv )
10 {
11  if(argc != 2) {
12  printf( "Usage: %s <image name.[pgm,ppm,jpeg,png,tiff,bmp,ras,jp2]>\n", argv[0] );
13  return -1;
14  }
15 
17 
18  try {
19  vpImageIo::read(I, argv[1]);
20  }
21  catch(...) {
22  std::cout << "Cannot read image \"" << argv[1] << "\"" << std::endl;
23  return -1;
24  }
25 
26 #if defined(VISP_HAVE_X11)
27  vpDisplayX d(I);
28 #elif defined(VISP_HAVE_OPENCV)
29  vpDisplayOpenCV d(I);
30 #elif defined(VISP_HAVE_GTK)
31  vpDisplayGTK d(I);
32 #elif defined(VISP_HAVE_GDI)
33  vpDisplayGDI d(I);
34 #elif defined(VISP_HAVE_D3D9)
35  vpDisplayD3d d(I);
36 #else
37  std::cout << "No image viewer is available..." << std::endl;
38 #endif
39  vpDisplay::setTitle(I, "My image");
42  std::cout << "A click to quit..." << std::endl;
44 }
Display for windows using GDI (available on any windows 32 platform).
Definition: vpDisplayGDI.h:133
Define the X11 console to display images.
Definition: vpDisplayX.h:152
static void flush(const vpImage< unsigned char > &I)
Definition: vpDisplay.cpp:1991
static void display(const vpImage< unsigned char > &I)
Definition: vpDisplay.cpp:203
The vpDisplayOpenCV allows to display image using the opencv library.
virtual void setTitle(const char *title)=0
The vpDisplayGTK allows to display image using the GTK+ library version 1.2.
Definition: vpDisplayGTK.h:145
virtual bool getClick(bool blocking=true)=0
static void read(vpImage< unsigned char > &I, const char *filename)
Definition: vpImageIo.cpp:277