ViSP  2.9.0
tutorial-grabber-opencv.cpp
1 
2 #include <visp/vpDisplayOpenCV.h>
3 #include <visp/vpOpenCVGrabber.h>
4 
5 int main()
6 {
7 #ifdef VISP_HAVE_OPENCV
8  try {
10 
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:159
error that can be emited by ViSP classes.
Definition: vpException.h:76
static void flush(const vpImage< unsigned char > &I)
Definition: vpDisplay.cpp:1994
static void display(const vpImage< unsigned char > &I)
Definition: vpDisplay.cpp:206
The vpDisplayOpenCV allows to display image using the opencv library.
void acquire(vpImage< unsigned char > &I)
unsigned int getHeight() const
Definition: vpImage.h:150
virtual bool getClick(bool blocking=true)=0
Class for cameras video capture using OpenCV library.