42 #include <visp/vpConfig.h>
53 #include <visp/vpConfig.h>
55 #if defined(VISP_HAVE_OPENCV) && (VISP_HAVE_OPENCV_VERSION >= 0x020100)
57 #include <visp/vpDisplayOpenCV.h>
58 #include <visp/vpImage.h>
59 #include <visp/vpImageConvert.h>
60 #include <visp/vpOpenCVGrabber.h>
66 int main(
int argc,
char** argv)
71 device = atoi(argv[1]);
73 std::cout <<
"Use device: " << device << std::endl;
74 cv::VideoCapture cap(device);
75 #if (VISP_HAVE_OPENCV_VERSION >= 0x030000)
76 cap.set(cv::CAP_PROP_FRAME_WIDTH, 640);
77 cap.set(cv::CAP_PROP_FRAME_HEIGHT, 480);
79 cap.set(CV_CAP_PROP_FRAME_WIDTH, 640);
80 cap.set(CV_CAP_PROP_FRAME_HEIGHT, 480);
87 std::cout <<
"Image size: "
88 #if (VISP_HAVE_OPENCV_VERSION >= 0x030000)
89 << (int)cap.get(cv::CAP_PROP_FRAME_WIDTH) <<
" "
90 << (int)cap.get(cv::CAP_PROP_FRAME_HEIGHT) << std::endl;
92 << (int)cap.get(CV_CAP_PROP_FRAME_WIDTH) <<
" "
93 << (int)cap.get(CV_CAP_PROP_FRAME_HEIGHT) << std::endl;
116 std::cout <<
"Catch an exception: " << e << std::endl;
124 std::cout <<
"OpenCV is not available..." << std::endl;
static void convert(const vpImage< unsigned char > &src, vpImage< vpRGBa > &dest)
error that can be emited by ViSP classes.
static void flush(const vpImage< unsigned char > &I)
static void display(const vpImage< unsigned char > &I)
The vpDisplayOpenCV allows to display image using the opencv library.
virtual bool getClick(bool blocking=true)=0