Visual Servoing Platform  version 3.5.1 under development (2023-05-30)
#include <visp3/core/vpConfig.h>
#include <visp3/sensor/vp1394CMUGrabber.h>
#include <visp3/sensor/vp1394TwoGrabber.h>
#include <visp3/sensor/vpV4l2Grabber.h>
#include <visp3/gui/vpDisplayGDI.h>
#include <visp3/gui/vpDisplayOpenCV.h>
#include <visp3/gui/vpDisplayX.h>
#include <visp3/me/vpMeEllipse.h>
int main()
#if (defined(VISP_HAVE_DC1394) || defined(VISP_HAVE_CMU1394) || defined(VISP_HAVE_V4L2) || \
try {
#if defined(VISP_HAVE_DC1394)
vp1394TwoGrabber g(false);
#elif defined(VISP_HAVE_CMU1394)
#elif defined(VISP_HAVE_V4L2)
#elif defined(VISP_HAVE_OPENCV)
cv::VideoCapture g(0); // open the default camera
if (!g.isOpened()) { // check if we succeeded
std::cout << "Failed to open the camera" << std::endl;
cv::Mat frame;
#if defined(VISP_HAVE_DC1394) || defined(VISP_HAVE_V4L2) || defined(VISP_HAVE_CMU1394)
#elif defined(VISP_HAVE_OPENCV)
g >> frame; // get a new frame from camera
#if defined(VISP_HAVE_X11)
vpDisplayX d(I, 0, 0, "Camera view");
#elif defined(VISP_HAVE_GDI)
vpDisplayGDI d(I, 0, 0, "Camera view");
#elif defined(VISP_HAVE_OPENCV)
vpDisplayOpenCV d(I, 0, 0, "Camera view");
std::cout << "No image viewer is available..." << std::endl;
vpMe me;
vpMeEllipse ellipse;
while (1) {
#if defined(VISP_HAVE_DC1394) || defined(VISP_HAVE_V4L2) || defined(VISP_HAVE_CMU1394)
#elif defined(VISP_HAVE_OPENCV)
g >> frame;
ellipse.display(I, vpColor::red);
} catch (const vpException &e) {
std::cout << "Catch an exception: " << e << std::endl;
Firewire cameras video capture based on CMU 1394 Digital Camera SDK.
Class for firewire ieee1394 video devices using libdc1394-2.x api.
void acquire(vpImage< unsigned char > &I)
static const vpColor red
Definition: vpColor.h:217
Display for windows using GDI (available on any windows 32 platform).
Definition: vpDisplayGDI.h:129
The vpDisplayOpenCV allows to display image using the OpenCV library. Thus to enable this class OpenC...
Use the X11 console to display images on unix-like OS. Thus to enable this class X11 should be instal...
Definition: vpDisplayX.h:135
static void display(const vpImage< unsigned char > &I)
static void flush(const vpImage< unsigned char > &I)
error that can be emited by ViSP classes.
Definition: vpException.h:72
static void convert(const vpImage< unsigned char > &src, vpImage< vpRGBa > &dest)
Class that tracks an ellipse using moving edges.
Definition: vpMeEllipse.h:95
void initTracking(const vpImage< unsigned char > &I, bool trackArc=false)
void track(const vpImage< unsigned char > &I)
void display(const vpImage< unsigned char > &I, const vpColor &color, unsigned int thickness=1)
Definition: vpMeSite.h:69
void setDisplay(vpMeSite::vpMeSiteDisplayType select)
Definition: vpMeTracker.h:148
void setMe(vpMe *p_me)
Definition: vpMeTracker.h:169
Definition: vpMe.h:119
void setSampleStep(const double &s)
Definition: vpMe.h:337
void setRange(const unsigned int &r)
Definition: vpMe.h:330
void setThreshold(const double &t)
Definition: vpMe.h:364
Class that is a wrapper over the Video4Linux2 (V4L2) driver.