4 #include <visp3/core/vpConfig.h>
17 #if (defined(VISP_HAVE_X11) || defined(VISP_HAVE_GDI) || defined(VISP_HAVE_OPENCV)) && \
18 (defined(VISP_HAVE_V4L2) || defined(VISP_HAVE_DC1394) || defined(VISP_HAVE_CMU1394) || \
19 defined(VISP_HAVE_FLYCAPTURE) || defined(VISP_HAVE_REALSENSE2) || \
20 ((VISP_HAVE_OPENCV_VERSION < 0x030000) && defined(HAVE_OPENCV_HIGHGUI)) || ((VISP_HAVE_OPENCV_VERSION >= 0x030000) && defined(HAVE_OPENCV_VIDEOIO)))
22 #ifdef VISP_HAVE_MODULE_SENSOR
23 #include <visp3/sensor/vp1394CMUGrabber.h>
24 #include <visp3/sensor/vp1394TwoGrabber.h>
25 #include <visp3/sensor/vpFlyCaptureGrabber.h>
26 #include <visp3/sensor/vpRealSense2.h>
27 #include <visp3/sensor/vpV4l2Grabber.h>
29 #include <visp3/blob/vpDot2.h>
30 #include <visp3/gui/vpDisplayGDI.h>
31 #include <visp3/gui/vpDisplayOpenCV.h>
32 #include <visp3/gui/vpDisplayX.h>
34 #if (VISP_HAVE_OPENCV_VERSION < 0x030000) && defined(HAVE_OPENCV_HIGHGUI)
35 #include <opencv2/highgui/highgui.hpp>
36 #elif (VISP_HAVE_OPENCV_VERSION >= 0x030000) && defined(HAVE_OPENCV_VIDEOIO)
37 #include <opencv2/videoio/videoio.hpp>
42 #ifdef ENABLE_VISP_NAMESPACE
50 #if defined(VISP_HAVE_V4L2)
52 std::ostringstream device;
53 device <<
"/dev/video" << opt_device;
54 std::cout <<
"Use Video 4 Linux grabber on device " << device.str() << std::endl;
58 #elif defined(VISP_HAVE_DC1394)
60 std::cout <<
"Use DC1394 grabber" << std::endl;
63 #elif defined(VISP_HAVE_CMU1394)
65 std::cout <<
"Use CMU1394 grabber" << std::endl;
68 #elif defined(VISP_HAVE_FLYCAPTURE)
70 std::cout <<
"Use FlyCapture grabber" << std::endl;
73 #elif defined(VISP_HAVE_REALSENSE2)
75 std::cout <<
"Use Realsense 2 grabber" << std::endl;
78 config.disable_stream(RS2_STREAM_DEPTH);
79 config.disable_stream(RS2_STREAM_INFRARED);
80 config.enable_stream(RS2_STREAM_COLOR, 640, 480, RS2_FORMAT_RGBA8, 30);
83 #elif ((VISP_HAVE_OPENCV_VERSION < 0x030000) && defined(HAVE_OPENCV_HIGHGUI))|| ((VISP_HAVE_OPENCV_VERSION >= 0x030000) && defined(HAVE_OPENCV_VIDEOIO))
84 cv::VideoCapture g(opt_device);
86 std::cout <<
"Failed to open the camera" << std::endl;
94 #if defined(VISP_HAVE_X11)
95 vpDisplayX d(I, 0, 0,
"Camera view");
96 #elif defined(VISP_HAVE_GDI)
98 #elif defined(HAVE_OPENCV_HIGHGUI)
111 bool init_done =
false;
113 bool germ_selected =
false;
118 #if defined(VISP_HAVE_V4L2) || defined(VISP_HAVE_DC1394) || defined(VISP_HAVE_CMU1394) || defined(VISP_HAVE_FLYCAPTURE) || defined(VISP_HAVE_REALSENSE2)
120 #elif ((VISP_HAVE_OPENCV_VERSION < 0x030000) && defined(HAVE_OPENCV_HIGHGUI))|| ((VISP_HAVE_OPENCV_VERSION >= 0x030000) && defined(HAVE_OPENCV_VIDEOIO))
133 germ_selected =
true;
136 if (germ_selected && !init_done) {
138 std::cout <<
"Tracking initialized" << std::endl;
142 germ_selected =
false;
144 else if (init_done) {
153 std::cout <<
"Tracking failed: " << e.
getMessage() << std::endl;
162 std::cout <<
"There are missing 3rd parties to run this tutorial" << std::endl;
Firewire cameras video capture based on CMU 1394 Digital Camera SDK.
void open(vpImage< unsigned char > &I)
Class for firewire ieee1394 video devices using libdc1394-2.x api.
void open(vpImage< unsigned char > &I)
Display for windows using GDI (available on any windows 32 platform).
The vpDisplayOpenCV allows to display image using the OpenCV library. Thus to enable this class OpenC...
static bool getClick(const vpImage< unsigned char > &I, bool blocking=true)
static void display(const vpImage< unsigned char > &I)
static void flush(const vpImage< unsigned char > &I)
static void displayText(const vpImage< unsigned char > &I, const vpImagePoint &ip, const std::string &s, const vpColor &color)
This tracker is meant to track a blob (connex pixels with same gray level) on a vpImage.
void track(const vpImage< unsigned char > &I, bool canMakeTheWindowGrow=true)
void setGraphics(bool activate)
void setGraphicsThickness(unsigned int thickness)
void initTracking(const vpImage< unsigned char > &I, unsigned int size=0)
error that can be emitted by ViSP classes.
const char * getMessage() const
void open(vpImage< unsigned char > &I)
static void convert(const vpImage< unsigned char > &src, vpImage< vpRGBa > &dest)
Class that defines a 2D point in an image. This class is useful for image processing and stores only ...
void acquire(vpImage< unsigned char > &grey, double *ts=nullptr)
bool open(const rs2::config &cfg=rs2::config())
Class that is a wrapper over the Video4Linux2 (V4L2) driver.
void open(vpImage< unsigned char > &I)
void setScale(unsigned scale=vpV4l2Grabber::DEFAULT_SCALE)
void setDevice(const std::string &devname)