2 #include <visp3/core/vpConfig.h>
3 #ifdef VISP_HAVE_MODULE_SENSOR
4 #include <visp3/sensor/vp1394CMUGrabber.h>
5 #include <visp3/sensor/vp1394TwoGrabber.h>
7 #include <visp3/gui/vpDisplayGDI.h>
8 #include <visp3/gui/vpDisplayOpenCV.h>
9 #include <visp3/gui/vpDisplayX.h>
10 #include <visp3/blob/vpDot2.h>
11 #include <visp3/core/vpPixelMeterConversion.h>
12 #include <visp3/vision/vpPose.h>
14 void computePose(std::vector<vpPoint> &point,
const std::vector<vpDot2> &dot,
16 #if defined(VISP_HAVE_X11) || defined(VISP_HAVE_GDI) || defined(VISP_HAVE_OPENCV)
20 void computePose(std::vector<vpPoint> &point,
const std::vector<vpDot2> &dot,
23 vpPose pose;
double x=0, y=0;
24 for (
unsigned int i=0; i < point.size(); i ++) {
38 if (residual_dem < residual_lag)
46 #if defined(VISP_HAVE_X11) || defined(VISP_HAVE_GDI) || defined(VISP_HAVE_OPENCV)
51 for(
unsigned int i=0; i<dot.size(); i++) {
52 dot[i].setGraphics(
true);
53 dot[i].setGraphicsThickness(2);
54 dot[i].initTracking(I);
59 for(
unsigned int i=0; i<dot.size(); i++) {
68 #if (defined(VISP_HAVE_X11) || defined(VISP_HAVE_GDI) || defined(VISP_HAVE_OPENCV)) && (defined(VISP_HAVE_DC1394) || defined(VISP_HAVE_CMU1394) || (VISP_HAVE_OPENCV_VERSION >= 0x020100))
71 #if defined(VISP_HAVE_DC1394)
74 #elif defined(VISP_HAVE_CMU1394)
77 #elif defined(VISP_HAVE_OPENCV)
78 cv::VideoCapture g(0);
80 std::cout <<
"Failed to open the camera" << std::endl;
94 std::vector<vpDot2> dot(4);
95 std::vector<vpPoint> point;
97 point.push_back(
vpPoint(-L, -L, 0) );
98 point.push_back(
vpPoint( L, -L, 0) );
99 point.push_back(
vpPoint( L, L, 0) );
100 point.push_back(
vpPoint(-L, L, 0) );
103 #if defined(VISP_HAVE_X11)
105 #elif defined(VISP_HAVE_GDI)
107 #elif defined(VISP_HAVE_OPENCV)
113 #if defined(VISP_HAVE_DC1394) || defined(VISP_HAVE_CMU1394)
115 #elif defined(VISP_HAVE_OPENCV)
122 computePose(point, dot, cam, init, cMo);
125 if (init) init =
false;
132 std::cout <<
"Catch an exception: " << e << std::endl;
static bool getClick(const vpImage< unsigned char > &I, bool blocking=true)
unsigned int getWidth() const
static void convert(const vpImage< unsigned char > &src, vpImage< vpRGBa > &dest)
Implementation of an homogeneous matrix and operations on such kind of matrices.
void open(vpImage< unsigned char > &I)
Display for windows using GDI (available on any windows 32 platform).
Use the X11 console to display images on unix-like OS. Thus to enable this class X11 should be instal...
static const vpColor none
error that can be emited by ViSP classes.
static void convertPoint(const vpCameraParameters &cam, const double &u, const double &v, double &x, double &y)
Point coordinates conversion from pixel coordinates to normalized coordinates in meter...
static void flush(const vpImage< unsigned char > &I)
Class that defines what is a point.
void open(vpImage< unsigned char > &I)
Firewire cameras video capture based on CMU 1394 Digital Camera SDK.
void acquire(vpImage< unsigned char > &I)
static void display(const vpImage< unsigned char > &I)
The vpDisplayOpenCV allows to display image using the OpenCV library. Thus to enable this class OpenC...
Class used for pose computation from N points (pose from point only). Some of the algorithms implemen...
Generic class defining intrinsic camera parameters.
bool computePose(vpPoseMethodType method, vpHomogeneousMatrix &cMo, bool(*func)(vpHomogeneousMatrix *)=NULL)
static void displayFrame(const vpImage< unsigned char > &I, const vpHomogeneousMatrix &cMo, const vpCameraParameters &cam, double size, const vpColor &color=vpColor::none, unsigned int thickness=1, vpImagePoint offset=vpImagePoint(0, 0))
unsigned int getHeight() const
Class for firewire ieee1394 video devices using libdc1394-2.x api.
void addPoint(const vpPoint &P)
double computeResidual(const vpHomogeneousMatrix &cMo) const
Compute and return the residual expressed in meter for the pose matrix 'cMo'.