2 #include <visp3/sensor/vpV4l2Grabber.h>
3 #include <visp3/gui/vpDisplayX.h>
4 #include <visp3/core/vpImage.h>
12 int main(
int argc,
const char* argv[])
16 unsigned int opt_device = 0;
17 unsigned int opt_scale = 2;
19 for (
int i=0; i<argc; i++) {
20 if (std::string(argv[i]) ==
"--device")
21 opt_device = (
unsigned int)atoi(argv[i+1]);
22 else if (std::string(argv[i]) ==
"--scale")
23 opt_scale = (
unsigned int)atoi(argv[i+1]);
24 else if (std::string(argv[i]) ==
"--help") {
25 std::cout <<
"Usage: " << argv[0] <<
" [--device <camera device>] [--scale <subsampling factor>] [--help]" << std::endl;
33 std::ostringstream device;
34 device <<
"/dev/video" << opt_device;
44 std::cout <<
"No image viewer is available..." << std::endl;
56 std::cout <<
"Catch an exception: " << e << std::endl;
void acquire(vpImage< unsigned char > &I)
static bool getClick(const vpImage< unsigned char > &I, bool blocking=true)
void open(vpImage< unsigned char > &I)
unsigned int getWidth() const
static void displayText(const vpImage< unsigned char > &I, const vpImagePoint &ip, const std::string &s, const vpColor &color)
Use the X11 console to display images on unix-like OS. Thus to enable this class X11 should be instal...
void setDevice(const std::string &devname)
error that can be emited by ViSP classes.
static void flush(const vpImage< unsigned char > &I)
static void display(const vpImage< unsigned char > &I)
void setScale(unsigned scale=vpV4l2Grabber::DEFAULT_SCALE)
Class that is a wrapper over the Video4Linux2 (V4L2) driver.
unsigned int getHeight() const