Visual Servoing Platform  version 3.0.0
vpPose.cpp
1 /****************************************************************************
2  *
3  * This file is part of the ViSP software.
4  * Copyright (C) 2005 - 2015 by Inria. All rights reserved.
5  *
6  * This software is free software; you can redistribute it and/or
7  * modify it under the terms of the GNU General Public License
8  * ("GPL") version 2 as published by the Free Software Foundation.
9  * See the file LICENSE.txt at the root directory of this source
10  * distribution for additional information about the GNU GPL.
11  *
12  * For using ViSP with software that can not be combined with the GNU
13  * GPL, please contact Inria about acquiring a ViSP Professional
14  * Edition License.
15  *
16  * See http://visp.inria.fr for more information.
17  *
18  * This software was developed at:
19  * Inria Rennes - Bretagne Atlantique
20  * Campus Universitaire de Beaulieu
21  * 35042 Rennes Cedex
22  * France
23  *
24  * If you have questions regarding the use of this file, please contact
25  * Inria at visp@inria.fr
26  *
27  * This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
28  * WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
29  *
30  * Description:
31  * Pose computation.
32  *
33  * Authors:
34  * Eric Marchand
35  * Francois Chaumette
36  *
37  *****************************************************************************/
38 
39 
46 #include <visp3/vision/vpPose.h>
47 #include <visp3/core/vpDebug.h>
48 #include <visp3/core/vpException.h>
49 #include <visp3/vision/vpPoseException.h>
50 #include <visp3/core/vpMeterPixelConversion.h>
51 #include <visp3/core/vpCameraParameters.h>
52 #include <visp3/core/vpDisplay.h>
53 #include <visp3/core/vpMath.h>
54 
55 #include <cmath> // std::fabs
56 #include <limits> // numeric_limits
57 
58 #define DEBUG_LEVEL1 0
59 
62 void
64 {
65 #if (DEBUG_LEVEL1)
66  std::cout << "begin vpPose::Init() " << std::endl ;
67 #endif
68  npt = 0 ;
69  listP.clear() ;
70  c3d.clear();
71 
72  lambda = 0.25 ;
73 
74  vvsIterMax = 200 ;
75 
77 
78  computeCovariance = false;
79 
80  ransacMaxTrials = 1000;
81  ransacThreshold = 0.0001;
82  ransacNbInlierConsensus = 4;
83 
84  residual = 0;
85 #if (DEBUG_LEVEL1)
86  std::cout << "end vpPose::Init() " << std::endl ;
87 #endif
88 
89 }
90 
93  : npt(0), listP(), residual(0), lambda(0.25), vvsIterMax(200), c3d(),
94  computeCovariance(false), covarianceMatrix(),
95  ransacNbInlierConsensus(4), ransacMaxTrials(1000), ransacInliers(), ransacInlierIndex(), ransacThreshold(0.0001),
96  distanceToPlaneForCoplanarityTest(0.001)
97 {
98 #if (DEBUG_LEVEL1)
99  std::cout << "begin vpPose::vpPose() " << std::endl ;
100 #endif
101 
102  init() ;
103 
104 #if (DEBUG_LEVEL1)
105  std::cout << "end vpPose::vpPose() " << std::endl ;
106 #endif
107 
108 }
109 
114 {
115 #if (DEBUG_LEVEL1)
116  std::cout << "begin vpPose::~vpPose() " << std::endl ;
117 #endif
118 
119  listP.clear() ;
120 
121 #if (DEBUG_LEVEL1)
122  std::cout << "end vpPose::~vpPose() " << std::endl ;
123 #endif
124 }
128 void
130 {
131 #if (DEBUG_LEVEL1)
132  std::cout << "begin vpPose::ClearPoint() " << std::endl ;
133 #endif
134 
135  listP.clear() ;
136  npt = 0 ;
137 
138 #if (DEBUG_LEVEL1)
139  std::cout << "end vpPose::ClearPoint() " << std::endl ;
140 #endif
141 }
142 
150 void
152 {
153 
154 #if (DEBUG_LEVEL1)
155  std::cout << "begin vpPose::AddPoint(Dot) " << std::endl ;
156 #endif
157 
158  listP.push_back(newP);
159  npt ++ ;
160 
161 #if (DEBUG_LEVEL1)
162  std::cout << "end vpPose::AddPoint(Dot) " << std::endl ;
163 #endif
164 }
165 
166 
167 void
169 {
171 }
172 
185 bool
186 vpPose::coplanar(int &coplanar_plane_type)
187 {
188  coplanar_plane_type = 0;
189  if (npt <2)
190  {
191  vpERROR_TRACE("Not enough point (%d) to compute the pose ",npt) ;
193  "Not enough points ")) ;
194  }
195 
196  if (npt ==3) return true ;
197 
198  double x1=0,x2=0,x3=0,y1=0,y2=0,y3=0,z1=0,z2=0,z3=0 ;
199 
200  std::list<vpPoint>::const_iterator it = listP.begin();
201 
202  vpPoint P1, P2, P3 ;
203 
204  // Get three 3D points that are not collinear and that is not at origin
205  bool degenerate = true;
206  bool not_on_origin = true;
207  std::list<vpPoint>::const_iterator it_tmp;
208 
209  std::list<vpPoint>::const_iterator it_i, it_j, it_k;
210  for (it_i=listP.begin(); it_i != listP.end(); ++it_i) {
211  if (degenerate == false) {
212  //std::cout << "Found a non degenerate configuration" << std::endl;
213  break;
214  }
215  P1 = *it_i;
216  // Test if point is on origin
217  if ((std::fabs(P1.get_oX()) <= std::numeric_limits<double>::epsilon())
218  && (std::fabs(P1.get_oY()) <= std::numeric_limits<double>::epsilon())
219  && (std::fabs(P1.get_oZ()) <= std::numeric_limits<double>::epsilon())) {
220  not_on_origin = false;
221  }
222  else {
223  not_on_origin = true;
224  }
225  if (not_on_origin) {
226  it_tmp = it_i; it_tmp ++; // j = i+1
227  for (it_j=it_tmp; it_j != listP.end(); ++it_j) {
228  if (degenerate == false) {
229  //std::cout << "Found a non degenerate configuration" << std::endl;
230  break;
231  }
232  P2 = *it_j;
233  if ((std::fabs(P2.get_oX()) <= std::numeric_limits<double>::epsilon())
234  && (std::fabs(P2.get_oY()) <= std::numeric_limits<double>::epsilon())
235  && (std::fabs(P2.get_oZ()) <= std::numeric_limits<double>::epsilon())) {
236  not_on_origin = false;
237  }
238  else {
239  not_on_origin = true;
240  }
241  if (not_on_origin) {
242  it_tmp = it_j; it_tmp ++; // k = j+1
243  for (it_k=it_tmp; it_k != listP.end(); ++it_k) {
244  P3 = *it_k;
245  if ((std::fabs(P3.get_oX()) <= std::numeric_limits<double>::epsilon())
246  && (std::fabs(P3.get_oY()) <= std::numeric_limits<double>::epsilon())
247  && (std::fabs(P3.get_oZ()) <= std::numeric_limits<double>::epsilon())) {
248  not_on_origin = false;
249  }
250  else {
251  not_on_origin = true;
252  }
253  if (not_on_origin) {
254  x1 = P1.get_oX() ;
255  x2 = P2.get_oX() ;
256  x3 = P3.get_oX() ;
257 
258  y1 = P1.get_oY() ;
259  y2 = P2.get_oY() ;
260  y3 = P3.get_oY() ;
261 
262  z1 = P1.get_oZ() ;
263  z2 = P2.get_oZ() ;
264  z3 = P3.get_oZ() ;
265 
266  vpColVector a_b(3), b_c(3), cross_prod;
267  a_b[0] = x1-x2; a_b[1] = y1-y2; a_b[2] = z1-z2;
268  b_c[0] = x2-x3; b_c[1] = y2-y3; b_c[2] = z2-z3;
269 
270  cross_prod = vpColVector::crossProd(a_b, b_c);
271  if (cross_prod.sumSquare() <= std::numeric_limits<double>::epsilon())
272  degenerate = true; // points are collinear
273  else
274  degenerate = false;
275  }
276  if (degenerate == false)
277  break;
278  }
279  }
280  }
281  }
282  }
283 
284  if (degenerate) {
285  coplanar_plane_type = 4; // points are collinear
286  return true;
287  }
288 
289  double a = y1*z2 - y1*z3 - y2*z1 + y2*z3 + y3*z1 - y3*z2 ;
290  double b = -x1*z2 + x1*z3 + x2*z1 - x2*z3 - x3*z1 + x3*z2 ;
291  double c = x1*y2 - x1*y3 - x2*y1 + x2*y3 + x3*y1 - x3*y2 ;
292  double d = -x1*y2*z3 + x1*y3*z2 +x2*y1*z3 - x2*y3*z1 - x3*y1*z2 + x3*y2*z1 ;
293 
294  //std::cout << "a=" << a << " b=" << b << " c=" << c << " d=" << d << std::endl;
295  if (std::fabs(b) <= std::numeric_limits<double>::epsilon()
296  && std::fabs(c) <= std::numeric_limits<double>::epsilon() ) {
297  coplanar_plane_type = 1; // ax=d
298  } else if (std::fabs(a) <= std::numeric_limits<double>::epsilon()
299  && std::fabs(c) <= std::numeric_limits<double>::epsilon() ) {
300  coplanar_plane_type = 2; // by=d
301  } else if (std::fabs(a) <= std::numeric_limits<double>::epsilon()
302  && std::fabs(b) <= std::numeric_limits<double>::epsilon() ) {
303  coplanar_plane_type = 3; // cz=d
304  }
305 
306  double D = sqrt(vpMath::sqr(a)+vpMath::sqr(b)+vpMath::sqr(c)) ;
307 
308  double dist;
309 
310  for(it=listP.begin(); it != listP.end(); ++it)
311  {
312  P1 = *it ;
313  dist = (a*P1.get_oX() + b*P1.get_oY()+c*P1.get_oZ()+d)/D ;
314  //std::cout << "dist= " << dist << std::endl;
315 
316  if (fabs(dist) > distanceToPlaneForCoplanarityTest)
317  {
318  vpDEBUG_TRACE(10," points are not coplanar ") ;
319  // TRACE(" points are not coplanar ") ;
320  return false ;
321  }
322  }
323 
324  vpDEBUG_TRACE(10," points are coplanar ") ;
325  // vpTRACE(" points are coplanar ") ;
326 
327  return true ;
328 }
329 
339 double
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 bool
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  return poseRansac(cMo, func);
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  //If here, there was no exception thrown so return true
564  return true;
565 }
566 
567 
568 
569 void
571 {
572  vpPoint P;
573  for(std::list<vpPoint>::const_iterator it=listP.begin(); it != listP.end(); ++it)
574  {
575  P = *it ;
576 
577  std::cout << "3D oP " << P.oP.t() ;
578  std::cout << "3D cP " << P.cP.t() ;
579  std::cout << "2D " << P.p.t() ;
580  }
581 }
582 
583 
584 void
586  vpHomogeneousMatrix &cMo,
587  vpCameraParameters &cam,
588  double size,
589  vpColor col)
590 {
591  vpDisplay::displayFrame(I, cMo, cam, size, col);
592 }
593 
594 
595 void
597  vpHomogeneousMatrix &cMo,
598  vpCameraParameters &cam,
599  double size,
600  vpColor col)
601 {
602  vpDisplay::displayFrame(I,cMo,cam, size,col);
603 }
604 
605 /*
606 \brief display the 3D model in image I
607 \warning the 2D coordinate of the point have to be initialized
608 (lispP has to be modified)
609 */
610 void
612  vpCameraParameters &cam,
613  vpColor col)
614 {
615  vpPoint P ;
616  vpImagePoint ip;
617  for(std::list<vpPoint>::const_iterator it=listP.begin(); it != listP.end(); ++it)
618  {
619  P = *it;
620  vpMeterPixelConversion::convertPoint(cam, P.p[0], P.p[1], ip) ;
621  vpDisplay::displayCross(I, ip, 5, col) ;
622  // std::cout << "3D oP " << P.oP.t() ;
623  // std::cout << "3D cP " << P.cP.t() ;
624  // std::cout << "2D " << P.p.t() ;
625  }
626 }
627 
628 /*
629 \brief display the 3D model in image I
630 \warning the 2D coordinate of the point have to be initialized
631 (lispP has to be modified)
632 */
633 void
635  vpCameraParameters &cam,
636  vpColor col)
637 {
638  vpPoint P ;
639  vpImagePoint ip;
640  for(std::list<vpPoint>::const_iterator it=listP.begin(); it != listP.end(); ++it)
641  {
642  P = *it;
643  vpMeterPixelConversion::convertPoint(cam, P.p[0], P.p[1], ip) ;
644  vpDisplay::displayCross(I, ip, 5, col) ;
645  // std::cout << "3D oP " << P.oP.t() ;
646  // std::cout << "3D cP " << P.cP.t() ;
647  // std::cout << "2D " << P.p.t() ;
648  }
649 }
650 
651 
671 double
673  vpPoint &p3,vpPoint &p4,
674  double lx, vpCameraParameters & cam,
675  vpHomogeneousMatrix & cMo)
676 {
677 
678  std::vector<double> rectx(4) ;
679  std::vector<double> recty(4) ;
680  rectx[0]= 0 ;
681  recty[0]=0 ;
682  rectx[1]=1 ;
683  recty[1]=0 ;
684  rectx[2]=1 ;
685  recty[2]=1 ;
686  rectx[3]=0 ;
687  recty[3]=1 ;
688  std::vector<double> irectx(4) ;
689  std::vector<double> irecty(4) ;
690  irectx[0]=(p1.get_x()) ;
691  irecty[0]=(p1.get_y()) ;
692  irectx[1]=(p2.get_x()) ;
693  irecty[1]=(p2.get_y()) ;
694  irectx[2]=(p3.get_x()) ;
695  irecty[2]=(p3.get_y()) ;
696  irectx[3]=(p4.get_x()) ;
697  irecty[3]=(p4.get_y()) ;
698 
699  //calcul de l'homographie
700  vpMatrix H(3,3);
701  vpHomography hom;
702 
703  // vpHomography::HartleyDLT(rectx,recty,irectx,irecty,hom);
704  vpHomography::HLM(rectx,recty,irectx,irecty,1,hom);
705  for (unsigned int i=0 ; i < 3 ; i++)
706  for(unsigned int j=0 ; j < 3 ; j++)
707  H[i][j] = hom[i][j] ;
708  //calcul de s = ||Kh1||/ ||Kh2|| =ratio (length on x axis/ length on y axis)
709  vpColVector kh1(3);
710  vpColVector kh2(3);
711  vpMatrix K(3,3);
712  K = cam.get_K();
713  K.eye();
714  vpMatrix Kinv =K.pseudoInverse();
715 
716  vpMatrix KinvH =Kinv*H;
717  kh1=KinvH.getCol(0);
718  kh2=KinvH.getCol(1);
719 
720  double s= sqrt(kh1.sumSquare())/sqrt(kh2.sumSquare());
721 
722  vpMatrix D(3,3);
723  D.eye();
724  D[1][1]=1/s;
725  vpMatrix cHo=H*D;
726 
727  //Calcul de la rotation et de la translation
728  // PoseFromRectangle(p1,p2,p3,p4,1/s,lx,cam,cMo );
729  p1.setWorldCoordinates(0,0,0) ;
730  p2.setWorldCoordinates(lx,0,0) ;
731  p3.setWorldCoordinates(lx,lx/s,0) ;
732  p4.setWorldCoordinates(0,lx/s,0) ;
733 
734 
735  vpPose P ;
736  P.addPoint(p1) ;
737  P.addPoint(p2) ;
738  P.addPoint(p3) ;
739  P.addPoint(p4) ;
740 
742  return lx/s ;
743 }
Implementation of a matrix and operations on matrices.
Definition: vpMatrix.h:92
virtual ~vpPose()
destructor
Definition: vpPose.cpp:113
double residual
compute the residual in meter
Definition: vpPose.h:93
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:186
Implementation of an homogeneous matrix and operations on such kind of matrices.
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 ...
#define vpERROR_TRACE
Definition: vpDebug.h:391
void init()
basic initialisation (called by the constructors)
Definition: vpPose.cpp:63
Class to define colors available for display functionnalities.
Definition: vpColor.h:121
void displayModel(vpImage< unsigned char > &I, vpCameraParameters &cam, vpColor col=vpColor::none)
Definition: vpPose.cpp:611
double get_oY() const
Get the point Y coordinate in the object frame.
Definition: vpPoint.cpp:449
void track(const vpHomogeneousMatrix &cMo)
double get_y() const
Get the point y coordinate in the image plane.
Definition: vpPoint.cpp:458
std::list< vpPoint > listP
array of point (use here class vpPoint)
Definition: vpPose.h:91
void poseVirtualVS(vpHomogeneousMatrix &cMo)
compute the pose using virtual visual servoing approach
Class that defines what is a point.
Definition: vpPoint.h:59
bool poseRansac(vpHomogeneousMatrix &cMo, bool(*func)(vpHomogeneousMatrix *)=NULL)
compute the pose using the Ransac approach
static void HLM(const std::vector< double > &xb, const std::vector< double > &yb, const std::vector< double > &xa, const std::vector< double > &ya, bool isplanar, vpHomography &aHb)
double lambda
parameters use for the virtual visual servoing approach
Definition: vpPose.h:96
vpColVector cP
Definition: vpTracker.h:77
Implementation of an homography and operations on homographies.
Definition: vpHomography.h:179
static void display(vpImage< unsigned char > &I, vpHomogeneousMatrix &cMo, vpCameraParameters &cam, double size, vpColor col=vpColor::none)
Definition: vpPose.cpp:585
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:672
static double sqr(double x)
Definition: vpMath.h:110
bool computePose(vpPoseMethodType methode, vpHomogeneousMatrix &cMo, bool(*func)(vpHomogeneousMatrix *)=NULL)
compute the pose for a given method
Definition: vpPose.cpp:382
vpRowVector t() const
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:74
Generic class defining intrinsic camera parameters.
double distanceToPlaneForCoplanarityTest
Definition: vpPose.h:142
vpColVector getCol(const unsigned int j) const
Definition: vpMatrix.cpp:2250
double get_oZ() const
Get the point Z coordinate in the object frame.
Definition: vpPoint.cpp:451
void printPoint()
Definition: vpPose.cpp:570
void poseLowe(vpHomogeneousMatrix &cMo)
Compute the pose using the Lowe non linear approach it consider the minimization of a residual using ...
Definition: vpPoseLowe.cpp:284
double get_x() const
Get the point x coordinate in the image plane.
Definition: vpPoint.cpp:456
vpPose()
Definition: vpPose.cpp:92
unsigned int npt
number of point used in pose computation
Definition: vpPose.h:90
double sumSquare() const
double get_oX() const
Get the point X coordinate in the object frame.
Definition: vpPoint.cpp:447
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))
Definition: vpDisplay.cpp:373
vpMatrix get_K() const
void setWorldCoordinates(const double oX, const double oY, const double oZ)
Definition: vpPoint.cpp:111
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)
Implementation of column vector and the associated operations.
Definition: vpColVector.h:72
vpPoseMethodType
Definition: vpPose.h:77
#define vpDEBUG_TRACE
Definition: vpDebug.h:478
void setDistanceToPlaneForCoplanarityTest(double d)
Definition: vpPose.cpp:168
vpMatrix pseudoInverse(double svThreshold=1e-6) const
Compute the pseudo inverse of the matrix using the SVD.
Definition: vpMatrix.cpp:1756
Class that defines a 2D point in an image. This class is useful for image processing and stores only ...
Definition: vpImagePoint.h:88
static vpColVector crossProd(const vpColVector &a, const vpColVector &b)
void addPoint(const vpPoint &P)
Add a new point in this array.
Definition: vpPose.cpp:151
void eye()
Definition: vpMatrix.cpp:194
vpColVector p
Definition: vpTracker.h:73
double computeResidual(const vpHomogeneousMatrix &cMo) const
Compute and return the residual expressed in meter for the pose matrix 'cMo'.
Definition: vpPose.cpp:340
void clearPoint()
suppress all the point in the array of point
Definition: vpPose.cpp:129