ViSP  2.8.0
vpPose.cpp
1 /****************************************************************************
2 *
3 * $Id: vpPose.cpp 4056 2013-01-05 13:04:42Z fspindle $
4 *
5 * This file is part of the ViSP software.
6 * Copyright (C) 2005 - 2013 by INRIA. All rights reserved.
7 *
8 * This software is free software; you can redistribute it and/or
9 * modify it under the terms of the GNU General Public License
10 * ("GPL") version 2 as published by the Free Software Foundation.
11 * See the file LICENSE.txt at the root directory of this source
12 * distribution for additional information about the GNU GPL.
13 *
14 * For using ViSP with software that can not be combined with the GNU
15 * GPL, please contact INRIA about acquiring a ViSP Professional
16 * Edition License.
17 *
18 * See http://www.irisa.fr/lagadic/visp/visp.html for more information.
19 *
20 * This software was developed at:
21 * INRIA Rennes - Bretagne Atlantique
22 * Campus Universitaire de Beaulieu
23 * 35042 Rennes Cedex
24 * France
25 * http://www.irisa.fr/lagadic
26 *
27 * If you have questions regarding the use of this file, please contact
28 * INRIA at visp@inria.fr
29 *
30 * This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
31 * WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
32 *
33 *
34 * Description:
35 * Pose computation.
36 *
37 * Authors:
38 * Eric Marchand
39 * Francois Chaumette
40 *
41 *****************************************************************************/
42 
43 
50 #include <visp/vpPose.h>
51 #include <visp/vpDebug.h>
52 #include <visp/vpException.h>
53 #include <visp/vpPoseException.h>
54 #include <visp/vpMeterPixelConversion.h>
55 #include <visp/vpCameraParameters.h>
56 #include <visp/vpDisplay.h>
57 #include <visp/vpMath.h>
58 
59 #include <cmath> // std::fabs
60 #include <limits> // numeric_limits
61 
62 #define DEBUG_LEVEL1 0
63 
66 void
68 {
69 #if (DEBUG_LEVEL1)
70  std::cout << "begin vpPose::Init() " << std::endl ;
71 #endif
72  npt = 0 ;
73  listP.clear() ;
74 
75  lambda = 0.25 ;
76 
77  c3d = NULL ;
78 
79  vvsIterMax = 200 ;
80 
82 
83  computeCovariance = false;
84 
85  ransacMaxTrials = 1000;
86  ransacThreshold = 0.0001;
87  ransacNbInlierConsensus = 4;
88 
89 #if (DEBUG_LEVEL1)
90  std::cout << "end vpPose::Init() " << std::endl ;
91 #endif
92 
93 }
94 
96 {
97 #if (DEBUG_LEVEL1)
98  std::cout << "begin vpPose::vpPose() " << std::endl ;
99 #endif
100 
101  init() ;
102 
103 #if (DEBUG_LEVEL1)
104  std::cout << "end vpPose::vpPose() " << std::endl ;
105 #endif
106 
107 }
108 
113 {
114 #if (DEBUG_LEVEL1)
115  std::cout << "begin vpPose::~vpPose() " << std::endl ;
116 #endif
117 
118  listP.clear() ;
119 
120 #if (DEBUG_LEVEL1)
121  std::cout << "end vpPose::~vpPose() " << std::endl ;
122 #endif
123 }
127 void
129 {
130 #if (DEBUG_LEVEL1)
131  std::cout << "begin vpPose::ClearPoint() " << std::endl ;
132 #endif
133 
134  listP.clear() ;
135  npt = 0 ;
136 
137 #if (DEBUG_LEVEL1)
138  std::cout << "end vpPose::ClearPoint() " << std::endl ;
139 #endif
140 }
141 
149 void
151 {
152 
153 #if (DEBUG_LEVEL1)
154  std::cout << "begin vpPose::AddPoint(Dot) " << std::endl ;
155 #endif
156 
157  listP.push_back(newP);
158  npt ++ ;
159 
160 #if (DEBUG_LEVEL1)
161  std::cout << "end vpPose::AddPoint(Dot) " << std::endl ;
162 #endif
163 }
164 
165 
166 void
168 {
170 }
171 
184 bool
185 vpPose::coplanar(int &coplanar_plane_type)
186 {
187  coplanar_plane_type = 0;
188  if (npt <2)
189  {
190  vpERROR_TRACE("Not enough point (%d) to compute the pose ",npt) ;
192  "Not enough points ")) ;
193  }
194 
195  if (npt ==3) return true ;
196 
197  double x1=0,x2=0,x3=0,y1=0,y2=0,y3=0,z1=0,z2=0,z3=0 ;
198 
199  std::list<vpPoint>::const_iterator it = listP.begin();
200 
201  vpPoint P1, P2, P3 ;
202 
203  // Get three 3D points that are not collinear and that is not at origin
204  bool degenerate = true;
205  bool not_on_origin = true;
206  std::list<vpPoint>::const_iterator it_tmp;
207 
208  std::list<vpPoint>::const_iterator it_i, it_j, it_k;
209  for (it_i=listP.begin(); it_i != listP.end(); ++it_i) {
210  if (degenerate == false) {
211  //std::cout << "Found a non degenerate configuration" << std::endl;
212  break;
213  }
214  P1 = *it_i;
215  // Test if point is on origin
216  if ((std::fabs(P1.get_oX()) <= std::numeric_limits<double>::epsilon())
217  && (std::fabs(P1.get_oY()) <= std::numeric_limits<double>::epsilon())
218  && (std::fabs(P1.get_oZ()) <= std::numeric_limits<double>::epsilon())) {
219  not_on_origin = false;
220  }
221  else {
222  not_on_origin = true;
223  }
224  if (not_on_origin) {
225  it_tmp = it_i; it_tmp ++; // j = i+1
226  for (it_j=it_tmp; it_j != listP.end(); ++it_j) {
227  if (degenerate == false) {
228  //std::cout << "Found a non degenerate configuration" << std::endl;
229  break;
230  }
231  P2 = *it_j;
232  if ((std::fabs(P2.get_oX()) <= std::numeric_limits<double>::epsilon())
233  && (std::fabs(P2.get_oY()) <= std::numeric_limits<double>::epsilon())
234  && (std::fabs(P2.get_oZ()) <= std::numeric_limits<double>::epsilon())) {
235  not_on_origin = false;
236  }
237  else {
238  not_on_origin = true;
239  }
240  if (not_on_origin) {
241  it_tmp = it_j; it_tmp ++; // k = j+1
242  for (it_k=it_tmp; it_k != listP.end(); ++it_k) {
243  P3 = *it_k;
244  if ((std::fabs(P3.get_oX()) <= std::numeric_limits<double>::epsilon())
245  && (std::fabs(P3.get_oY()) <= std::numeric_limits<double>::epsilon())
246  && (std::fabs(P3.get_oZ()) <= std::numeric_limits<double>::epsilon())) {
247  not_on_origin = false;
248  }
249  else {
250  not_on_origin = true;
251  }
252  if (not_on_origin) {
253  x1 = P1.get_oX() ;
254  x2 = P2.get_oX() ;
255  x3 = P3.get_oX() ;
256 
257  y1 = P1.get_oY() ;
258  y2 = P2.get_oY() ;
259  y3 = P3.get_oY() ;
260 
261  z1 = P1.get_oZ() ;
262  z2 = P2.get_oZ() ;
263  z3 = P3.get_oZ() ;
264 
265  vpColVector a_b(3), b_c(3), cross_prod;
266  a_b[0] = x1-x2; a_b[1] = y1-y2; a_b[2] = z1-z2;
267  b_c[0] = x2-x3; b_c[1] = y2-y3; b_c[2] = z2-z3;
268 
269  cross_prod = vpColVector::crossProd(a_b, b_c);
270  if (cross_prod.sumSquare() <= std::numeric_limits<double>::epsilon())
271  degenerate = true; // points are collinear
272  else
273  degenerate = false;
274  }
275  if (degenerate == false)
276  break;
277  }
278  }
279  }
280  }
281  }
282 
283  if (degenerate) {
284  coplanar_plane_type = 4; // points are collinear
285  return true;
286  }
287 
288  double a = y1*z2 - y1*z3 - y2*z1 + y2*z3 + y3*z1 - y3*z2 ;
289  double b = -x1*z2 + x1*z3 + x2*z1 - x2*z3 - x3*z1 + x3*z2 ;
290  double c = x1*y2 - x1*y3 - x2*y1 + x2*y3 + x3*y1 - x3*y2 ;
291  double d = -x1*y2*z3 + x1*y3*z2 +x2*y1*z3 - x2*y3*z1 - x3*y1*z2 + x3*y2*z1 ;
292 
293  //std::cout << "a=" << a << " b=" << b << " c=" << c << " d=" << d << std::endl;
294  if (std::fabs(b) <= std::numeric_limits<double>::epsilon()
295  && std::fabs(c) <= std::numeric_limits<double>::epsilon() ) {
296  coplanar_plane_type = 1; // ax=d
297  } else if (std::fabs(a) <= std::numeric_limits<double>::epsilon()
298  && std::fabs(c) <= std::numeric_limits<double>::epsilon() ) {
299  coplanar_plane_type = 2; // by=d
300  } else if (std::fabs(a) <= std::numeric_limits<double>::epsilon()
301  && std::fabs(b) <= std::numeric_limits<double>::epsilon() ) {
302  coplanar_plane_type = 3; // cz=d
303  }
304 
305  double D = sqrt(vpMath::sqr(a)+vpMath::sqr(b)+vpMath::sqr(c)) ;
306 
307  double dist;
308 
309  for(it=listP.begin(); it != listP.end(); ++it)
310  {
311  P1 = *it ;
312  dist = (a*P1.get_oX() + b*P1.get_oY()+c*P1.get_oZ()+d)/D ;
313  //std::cout << "dist= " << dist << std::endl;
314 
315  if (fabs(dist) > distanceToPlaneForCoplanarityTest)
316  {
317  vpDEBUG_TRACE(10," points are not coplanar ") ;
318  // TRACE(" points are not coplanar ") ;
319  return false ;
320  }
321  }
322 
323  vpDEBUG_TRACE(10," points are coplanar ") ;
324  // vpTRACE(" points are coplanar ") ;
325 
326  return true ;
327 }
328 
338 double
340 {
341 
342  double residual = 0 ;
343  vpPoint P ;
344  for(std::list<vpPoint>::const_iterator it=listP.begin(); it != listP.end(); ++it)
345  {
346  P = *it;
347  double x = P.get_x() ;
348  double y = P.get_y() ;
349 
350  P.track(cMo) ;
351 
352  residual += vpMath::sqr(x-P.get_x()) + vpMath::sqr(y-P.get_y()) ;
353  }
354  return residual ;
355 }
356 
357 
358 
381 void
383 {
384 #if (DEBUG_LEVEL1)
385  std::cout << "begin vpPose::ComputePose()" << std::endl ;
386 #endif
387 
388  if (npt <4)
389  {
390  vpERROR_TRACE("Not enough point (%d) to compute the pose ",npt) ;
392  "No enough point ")) ;
393  }
394 
395  switch (methode)
396  {
397  case DEMENTHON :
398  case DEMENTHON_VIRTUAL_VS :
399  case DEMENTHON_LOWE :
400  {
401 
402  if (npt <4)
403  {
404  vpERROR_TRACE("Dementhon method cannot be used in that case ") ;
405  vpERROR_TRACE("(at least 4 points are required)") ;
406  vpERROR_TRACE("Not enough point (%d) to compute the pose ",npt) ;
408  "Not enough points ")) ;
409  }
410 
411  // test si les point 3D sont coplanaires
412  int coplanar_plane_type = 0;
413  bool plan = coplanar(coplanar_plane_type) ;
414  if (plan == true)
415  {
416  //std::cout << "Plan" << std::endl;
417  try{
418  poseDementhonPlan(cMo);
419  }
420  catch(...)
421  {
422  vpERROR_TRACE(" ") ;
423  throw ;
424  }
425  //std::cout << "Fin Plan" << std::endl;
426  }
427  else
428  {
429  //std::cout << "No Plan" << std::endl;
430  try{
431  poseDementhonNonPlan(cMo) ;
432  }
433  catch(...)
434  {
435  vpERROR_TRACE(" ") ;
436  throw ;
437  }
438  //std::cout << "Fin No Plan" << std::endl;
439  }
440  }
441  break ;
442  case LAGRANGE :
443  case LAGRANGE_VIRTUAL_VS :
444  case LAGRANGE_LOWE :
445  {
446  // test si les point 3D sont coplanaires
447  int coplanar_plane_type;
448  bool plan = coplanar(coplanar_plane_type) ;
449 
450  if (plan == true && coplanar_plane_type > 0) // only plane oX=d, oY=d or oZ=d
451  {
452 
453  if (coplanar_plane_type == 4)
454  {
455  vpERROR_TRACE("Lagrange method cannot be used in that case ") ;
456  vpERROR_TRACE("(points are collinear)") ;
458  "Points are collinear ")) ;
459  }
460  if (npt <4)
461  {
462  vpERROR_TRACE("Lagrange method cannot be used in that case ") ;
463  vpERROR_TRACE("(at least 4 points are required)") ;
464  vpERROR_TRACE("Not enough point (%d) to compute the pose ",npt) ;
466  "Not enough points ")) ;
467  }
468  try {
469  poseLagrangePlan(cMo, coplanar_plane_type);
470  }
471  catch(...)
472  {
473  vpERROR_TRACE(" ") ;
474  throw ;
475  }
476  }
477  else
478  {
479  if (npt <4)
480  {
481  vpERROR_TRACE("Lagrange method cannot be used in that case ") ;
482  vpERROR_TRACE("(at least 4 points are required)") ;
483  vpERROR_TRACE("Not enough point (%d) to compute the pose ",npt) ;
485  "Not enough points ")) ;
486  }
487  try {
488  poseLagrangeNonPlan(cMo);
489  }
490  catch(...)
491  {
492  vpERROR_TRACE(" ") ;
493  throw ;
494  }
495  }
496  }
497  break;
498  case RANSAC:
499  if (npt <4)
500  {
501  vpERROR_TRACE("Ransac method cannot be used in that case ") ;
502  vpERROR_TRACE("(at least 4 points are required)") ;
503  vpERROR_TRACE("Not enough point (%d) to compute the pose ",npt) ;
505  "Not enough points ")) ;
506  }
507  try {
508  poseRansac(cMo);
509  }
510  catch(...)
511  {
512  vpERROR_TRACE(" ") ;
513  throw ;
514  }
515  break;
516  case LOWE :
517  case VIRTUAL_VS:
518  break ;
519  }
520 
521  switch (methode)
522  {
523  case LAGRANGE :
524  case DEMENTHON :
525  case RANSAC :
526  break ;
527  case VIRTUAL_VS:
528  case LAGRANGE_VIRTUAL_VS:
530  {
531  try
532  {
533  poseVirtualVS(cMo);
534  }
535  catch(...)
536  {
537  vpERROR_TRACE(" ") ;
538  throw ;
539  }
540  }
541  break ;
542  case LOWE:
543  case LAGRANGE_LOWE:
544  case DEMENTHON_LOWE:
545  {
546  try
547  {
548  poseLowe(cMo);
549  }
550  catch(...)
551  {
552  vpERROR_TRACE(" ") ;
553  throw ;
554  }
555  }
556  break ;
557  }
558 
559 #if (DEBUG_LEVEL1)
560  std::cout << "end vpPose::ComputePose()" << std::endl ;
561 #endif
562 }
563 
564 
565 
566 void
568 {
569  vpPoint P;
570  for(std::list<vpPoint>::const_iterator it=listP.begin(); it != listP.end(); ++it)
571  {
572  P = *it ;
573 
574  std::cout << "3D oP " << P.oP.t() ;
575  std::cout << "3D cP " << P.cP.t() ;
576  std::cout << "2D " << P.p.t() ;
577  }
578 }
579 
580 
581 void
583  vpHomogeneousMatrix &cMo,
584  vpCameraParameters &cam,
585  double size,
586  vpColor col)
587 {
588  vpDisplay::displayFrame(I, cMo, cam, size, col);
589 }
590 
591 
592 void
594  vpHomogeneousMatrix &cMo,
595  vpCameraParameters &cam,
596  double size,
597  vpColor col)
598 {
599  vpDisplay::displayFrame(I,cMo,cam, size,col);
600 }
601 
602 /*
603 \brief display the 3D model in image I
604 \warning the 2D coordinate of the point have to be initialized
605 (lispP has to be modified)
606 */
607 void
609  vpCameraParameters &cam,
610  vpColor col)
611 {
612  vpPoint P ;
613  vpImagePoint ip;
614  for(std::list<vpPoint>::const_iterator it=listP.begin(); it != listP.end(); ++it)
615  {
616  P = *it;
617  vpMeterPixelConversion::convertPoint(cam, P.p[0], P.p[1], ip) ;
618  vpDisplay::displayCross(I, ip, 5, col) ;
619  // std::cout << "3D oP " << P.oP.t() ;
620  // std::cout << "3D cP " << P.cP.t() ;
621  // std::cout << "2D " << P.p.t() ;
622  }
623 }
624 
625 /*
626 \brief display the 3D model in image I
627 \warning the 2D coordinate of the point have to be initialized
628 (lispP has to be modified)
629 */
630 void
632  vpCameraParameters &cam,
633  vpColor col)
634 {
635  vpPoint P ;
636  vpImagePoint ip;
637  for(std::list<vpPoint>::const_iterator it=listP.begin(); it != listP.end(); ++it)
638  {
639  P = *it;
640  vpMeterPixelConversion::convertPoint(cam, P.p[0], P.p[1], ip) ;
641  vpDisplay::displayCross(I, ip, 5, col) ;
642  // std::cout << "3D oP " << P.oP.t() ;
643  // std::cout << "3D cP " << P.cP.t() ;
644  // std::cout << "2D " << P.p.t() ;
645  }
646 }
647 
648 
668 double
670  vpPoint &p3,vpPoint &p4,
671  double lx, vpCameraParameters & cam,
672  vpHomogeneousMatrix & cMo)
673 {
674 
675  double rectx[4] ;
676  double recty[4] ;
677  rectx[0]= 0 ;
678  recty[0]=0 ;
679  rectx[1]=1 ;
680  recty[1]=0 ;
681  rectx[2]=1 ;
682  recty[2]=1 ;
683  rectx[3]=0 ;
684  recty[3]=1 ;
685  double irectx[4] ;
686  double irecty[4] ;
687  irectx[0]=(p1.get_x()) ;
688  irecty[0]=(p1.get_y()) ;
689  irectx[1]=(p2.get_x()) ;
690  irecty[1]=(p2.get_y()) ;
691  irectx[2]=(p3.get_x()) ;
692  irecty[2]=(p3.get_y()) ;
693  irectx[3]=(p4.get_x()) ;
694  irecty[3]=(p4.get_y()) ;
695 
696  //calcul de l'homographie
697  vpMatrix H(3,3);
698  vpHomography hom;
699 
700  // vpHomography::HartleyDLT(4,rectx,recty,irectx,irecty,hom);
701  vpHomography::HLM(4,rectx,recty,irectx,irecty,1,hom);
702  for (unsigned int i=0 ; i < 3 ; i++)
703  for(unsigned int j=0 ; j < 3 ; j++)
704  H[i][j] = hom[i][j] ;
705  //calcul de s = ||Kh1||/ ||Kh2|| =ratio (length on x axis/ length on y axis)
706  vpColVector kh1(3);
707  vpColVector kh2(3);
708  vpMatrix K(3,3);
709  K = cam.get_K();
710  K.setIdentity();
711  vpMatrix Kinv =K.pseudoInverse();
712 
713  vpMatrix KinvH =Kinv*H;
714  kh1=KinvH.column(1);
715  kh2=KinvH.column(2);
716 
717 
718  double s= sqrt(kh1.sumSquare())/sqrt(kh2.sumSquare());
719 
720 
721  vpMatrix D(3,3);
722  D.setIdentity();
723  D[1][1]=1/s;
724  vpMatrix cHo=H*D;
725 
726  //Calcul de la rotation et de la translation
727  // PoseFromRectangle(p1,p2,p3,p4,1/s,lx,cam,cMo );
728  p1.setWorldCoordinates(0,0,0) ;
729  p2.setWorldCoordinates(lx,0,0) ;
730  p3.setWorldCoordinates(lx,lx/s,0) ;
731  p4.setWorldCoordinates(0,lx/s,0) ;
732 
733 
734  vpPose P ;
735  P.addPoint(p1) ;
736  P.addPoint(p2) ;
737  P.addPoint(p3) ;
738  P.addPoint(p4) ;
739 
740 
742  return lx/s ;
743 
744 }
#define vpDEBUG_TRACE
Definition: vpDebug.h:454
Definition of the vpMatrix class.
Definition: vpMatrix.h:96
virtual ~vpPose()
destructor
Definition: vpPose.cpp:112
double residual
compute the residual in meter
Definition: vpPose.h:97
void poseLagrangePlan(vpHomogeneousMatrix &cMo, const int coplanar_plane_type=0)
compute the pose using Lagrange approach (planar object)
bool coplanar(int &coplanar_plane_type)
test the coplanarity of the points
Definition: vpPose.cpp:185
The class provides a data structure for the homogeneous matrices as well as a set of operations on th...
#define vpERROR_TRACE
Definition: vpDebug.h:379
void poseLagrangeNonPlan(vpHomogeneousMatrix &cMo)
compute the pose using Lagrange approach (non planar object)
static void convertPoint(const vpCameraParameters &cam, const double &x, const double &y, double &u, double &v)
Point coordinates conversion from normalized coordinates in meter to pixel coordinates ...
void init()
basic initialisation (called by the constructors)
Definition: vpPose.cpp:67
Class to define colors available for display functionnalities.
Definition: vpColor.h:125
void displayModel(vpImage< unsigned char > &I, vpCameraParameters &cam, vpColor col=vpColor::none)
Definition: vpPose.cpp:608
double get_oY() const
Get the point Y coordinate in the object frame.
Definition: vpPoint.h:129
void track(const vpHomogeneousMatrix &cMo)
double get_y() const
Get the point y coordinate in the image plane.
Definition: vpPoint.h:138
double sumSquare() const
return sum of the Aij^2 (for all i, for all j)
Definition: vpMatrix.cpp:760
std::list< vpPoint > listP
array of point (use here class vpPoint)
Definition: vpPose.h:95
vpColVector column(const unsigned int j)
Column extraction.
Definition: vpMatrix.cpp:2240
void poseVirtualVS(vpHomogeneousMatrix &cMo)
compute the pose using virtual visual servoing approach
Class that defines what is a point.
Definition: vpPoint.h:65
double lambda
parameters use for the virtual visual servoing approach
Definition: vpPose.h:100
vpColVector cP
Definition: vpTracker.h:82
This class aims to compute the homography wrt.two images.
Definition: vpHomography.h:173
static void display(vpImage< unsigned char > &I, vpHomogeneousMatrix &cMo, vpCameraParameters &cam, double size, vpColor col=vpColor::none)
Definition: vpPose.cpp:582
void setIdentity(const double &val=1.0)
Definition: vpMatrix.cpp:1110
static double poseFromRectangle(vpPoint &p1, vpPoint &p2, vpPoint &p3, vpPoint &p4, double lx, vpCameraParameters &cam, vpHomogeneousMatrix &cMo)
Carries out the camera pose the image of a rectangle and the intrinsec parameters, the length on x axis is known but the proprtion of the rectangle are unknown.
Definition: vpPose.cpp:669
static double sqr(double x)
Definition: vpMath.h:106
vpRowVector t() const
transpose of Vector
virtual void displayCross(const vpImagePoint &ip, unsigned int size, const vpColor &color, unsigned int thickness=1)=0
Class used for pose computation from N points (pose from point only).
Definition: vpPose.h:78
static void HLM(unsigned int n, double *xb, double *yb, double *xa, double *ya, bool isplan, vpHomography &aHb)
Computes the homography matrix from planar or non planar points using Ezio Malis linear method (HLM)...
Generic class defining intrinsic camera parameters.
double distanceToPlaneForCoplanarityTest
Definition: vpPose.h:145
double get_oZ() const
Get the point Z coordinate in the object frame.
Definition: vpPoint.h:131
void printPoint()
Definition: vpPose.cpp:567
void poseLowe(vpHomogeneousMatrix &cMo)
Compute the pose using the Lowe non linear approach it consider the minimization of a residual using ...
Definition: vpPoseLowe.cpp:288
double get_x() const
Get the point x coordinate in the image plane.
Definition: vpPoint.h:136
void poseRansac(vpHomogeneousMatrix &cMo)
compute the pose using the Ransac approach
static void displayFrame(const vpImage< unsigned char > &I, const vpHomogeneousMatrix &cMo, const vpCameraParameters &cam, double size, const vpColor &color, unsigned int thickness=1)
Definition: vpDisplay.cpp:368
vpPose()
constructor
Definition: vpPose.cpp:95
unsigned int npt
number of point used in pose computation
Definition: vpPose.h:94
double get_oX() const
Get the point X coordinate in the object frame.
Definition: vpPoint.h:127
vpMatrix get_K() const
void poseDementhonPlan(vpHomogeneousMatrix &cMo)
compute the pose using Dementhon approach (planar object)
Error that can be emited by the vpPose class and its derivates.
void poseDementhonNonPlan(vpHomogeneousMatrix &cMo)
compute the pose using Dementhon approach (non planar object)
Class that provides a data structure for the column vectors as well as a set of operations on these v...
Definition: vpColVector.h:72
vpPoseMethodType
Definition: vpPose.h:81
void setDistanceToPlaneForCoplanarityTest(double d)
Definition: vpPose.cpp:167
vpMatrix pseudoInverse(double svThreshold=1e-6) const
Compute the pseudo inverse of the matrix using the SVD.
Definition: vpMatrix.cpp:1812
void computePose(vpPoseMethodType methode, vpHomogeneousMatrix &cMo)
compute the pose for a given method
Definition: vpPose.cpp:382
Class that defines a 2D point in an image. This class is useful for image processing and stores only ...
Definition: vpImagePoint.h:92
static vpColVector crossProd(const vpColVector &a, const vpColVector &b)
normalise the vector
void addPoint(const vpPoint &P)
Add a new point in this array.
Definition: vpPose.cpp:150
vpColVector p
Definition: vpTracker.h:78
double computeResidual(const vpHomogeneousMatrix &cMo) const
Compute and return the residual expressed in meter for the pose matrix 'cMo'.
Definition: vpPose.cpp:339
void setWorldCoordinates(const double ox, const double oy, const double oz)
Set the point world coordinates. We mean here the coordinates of the point in the object frame...
Definition: vpPoint.cpp:74
void clearPoint()
suppress all the point in the array of point
Definition: vpPose.cpp:128