Visual Servoing Platform  version 3.0.0
tutorial-grabber-opencv.cpp
1 
2 #include <visp3/gui/vpDisplayOpenCV.h>
3 #include <visp3/sensor/vpOpenCVGrabber.h>
4 
5 int main()
6 {
7 #if defined(VISP_HAVE_OPENCV) && (VISP_HAVE_OPENCV_VERSION < 0x020408)
8  try {
10 
11  vpOpenCVGrabber g;
12  g.open(I);
13 
14  std::cout << "Image size: " << I.getWidth() << " " << I.getHeight() << std::endl;
15  vpDisplayOpenCV d(I);
16 
17  while(1) {
18  g.acquire(I);
21  if (vpDisplay::getClick(I, false))
22  break;
23  }
24  }
25  catch(vpException e) {
26  std::cout << "Catch an exception: " << e << std::endl;
27  }
28 #endif
29 }
unsigned int getWidth() const
Definition: vpImage.h:161
error that can be emited by ViSP classes.
Definition: vpException.h:73
static void flush(const vpImage< unsigned char > &I)
Definition: vpDisplay.cpp:2233
static void display(const vpImage< unsigned char > &I)
Definition: vpDisplay.cpp:206
The vpDisplayOpenCV allows to display image using the opencv library.
unsigned int getHeight() const
Definition: vpImage.h:152
virtual bool getClick(bool blocking=true)=0