2 #include <visp3/gui/vpDisplayGDI.h>
3 #include <visp3/gui/vpDisplayOpenCV.h>
4 #include <visp3/gui/vpDisplayX.h>
5 #include <visp3/io/vpImageIo.h>
6 #include <visp3/core/vpPixelMeterConversion.h>
7 #include <visp3/vision/vpPose.h>
8 #include <visp3/detection/vpDetectorQRCode.h>
10 void computePose(std::vector<vpPoint> &point,
const std::vector<vpImagePoint> &ip,
13 vpPose pose;
double x=0, y=0;
14 for (
unsigned int i=0; i < point.size(); i ++) {
28 if (residual_dem < residual_lag)
38 #if defined(VISP_HAVE_ZBAR)
43 #if defined(VISP_HAVE_X11)
45 #elif defined(VISP_HAVE_GDI)
47 #elif defined(VISP_HAVE_OPENCV)
55 std::vector<vpPoint> point;
56 point.push_back(
vpPoint(-0.06, -0.06, 0) );
57 point.push_back(
vpPoint( 0.06, -0.06, 0) );
58 point.push_back(
vpPoint( 0.06, 0.06, 0) );
59 point.push_back(
vpPoint(-0.06, 0.06, 0) );
70 bool status = detector.
detect(I);
72 std::ostringstream legend;
73 legend << detector.
getNbObjects() <<
" bar code detected";
79 std::vector<vpImagePoint> p = detector.
getPolygon(i);
81 for(
size_t j=0; j < p.size(); j++) {
83 std::ostringstream number;
88 computePose(point, p, cam, init, cMo);
103 std::cout <<
"Catch an exception: " << e.
getMessage() << std::endl;
106 std::cout <<
"ViSP is not build with zbar 3rd party." << std::endl;
VISP_EXPORT int wait(double t0, double t)
static bool getClick(const vpImage< unsigned char > &I, bool blocking=true)
unsigned int getWidth() const
Implementation of an homogeneous matrix and operations on such kind of matrices.
Display for windows using GDI (available on any windows 32 platform).
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...
static const vpColor none
error that can be emited by ViSP classes.
bool detect(const vpImage< unsigned char > &I)
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...
size_t getNbObjects() const
static void flush(const vpImage< unsigned char > &I)
Class that defines what is a point.
vpRotationMatrix getRotationMatrix() const
vpTranslationVector getTranslationVector() const
std::vector< std::vector< vpImagePoint > > & getPolygon()
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)
Implementation of a rotation vector as quaternion angle minimal representation.
const char * getMessage(void) const
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))
static void displayCross(const vpImage< unsigned char > &I, const vpImagePoint &ip, unsigned int size, const vpColor &color, unsigned int thickness=1)
static void read(vpImage< unsigned char > &I, const std::string &filename)
unsigned int getHeight() const
Class that defines a 2D point in an image. This class is useful for image processing and stores only ...
void addPoint(const vpPoint &P)
double computeResidual(const vpHomogeneousMatrix &cMo) const
Compute and return the residual expressed in meter for the pose matrix 'cMo'.
static const vpColor blue