Go to the documentation of this file.00001
00002 #include <visp/vpV4l2Grabber.h>
00003 #include <visp/vpDisplayX.h>
00004 #include <visp/vpImage.h>
00005
00006 int main()
00007 {
00008 #ifdef VISP_HAVE_V4L2
00009 try {
00010 vpImage<unsigned char> I;
00011
00012 vpV4l2Grabber g;
00013 g.open(I);
00014
00015 std::cout << "Image size: " << I.getWidth() << " " << I.getHeight() << std::endl;
00016
00017 #ifdef VISP_HAVE_X11
00018 vpDisplayX d(I);
00019 #else
00020 std::cout << "No image viewer is available..." << std::endl;
00021 #endif
00022
00023 while(1) {
00024 g.acquire(I);
00025 vpDisplay::display(I);
00026 vpDisplay::flush(I);
00027 if (vpDisplay::getClick(I, false)) break;
00028 }
00029 }
00030 catch(vpException e) {
00031 std::cout << "Catch an exception: " << e << std::endl;
00032 }
00033 #endif
00034 }