Visual Servoing Platform  version 3.0.1
 All Classes Namespaces Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
vpPoseDementhon.cpp
1 /****************************************************************************
2  *
3  * This file is part of the ViSP software.
4  * Copyright (C) 2005 - 2017 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 
40 
41 #include <visp3/vision/vpPose.h>
42 #include <visp3/core/vpMath.h>
43 
44 #define DEBUG_LEVEL1 0
45 #define DEBUG_LEVEL2 0
46 #define DEBUG_LEVEL3 0
47 
48 /* FC
49 #ifndef DEG
50 #define DEG (180.0/M_PI)
51 #endif
52 */
53 
61 void
63 {
64  double normI = 0., normJ = 0.;
65  double Z0 = 0.;
66  //double seuil=1.0;
67  double f=1.;
68 
69  vpPoint p0 = listP.front() ;
70 
71  c3d.clear();
72  vpPoint P;
73  for (std::list<vpPoint>::const_iterator it = listP.begin(); it != listP.end(); ++it)
74  {
75  P = (*it);
76  P.set_oX(P.get_oX()-p0.get_oX()) ;
77  P.set_oY(P.get_oY()-p0.get_oY()) ;
78  P.set_oZ(P.get_oZ()-p0.get_oZ()) ;
79  c3d.push_back(P) ;
80  }
81 
82  vpMatrix a(npt,3) ;
83 
84  for (unsigned int i=0 ; i < npt ; i++)
85  {
86  a[i][0]=c3d[i].get_oX();
87  a[i][1]=c3d[i].get_oY();
88  a[i][2]=c3d[i].get_oZ();
89  }
90 
91  //std::cout << a << std::endl ;
92  // calcul a^T a
93  vpMatrix ata ;
94  ata = a.t()*a ;
95 
96  // calcul (a^T a)^-1 par decomposition LU
97  vpMatrix ata1 ;
98  ata1 = ata.pseudoInverse(1e-6) ; //InverseByLU() ;
99 
100  vpMatrix b ;
101  b = (a*ata1).t() ;
102 
103 #if (DEBUG_LEVEL2)
104  {
105  std::cout << "a" << std::endl <<a<<std::endl ;
106  std::cout << "ata" << std::endl <<ata<<std::endl ;
107  std::cout << "ata1" << std::endl <<ata1<<std::endl ;
108  std::cout<< " ata*ata1" << std::endl << ata*ata1 ;
109  std::cout<< " b" << std::endl << (a*ata1).t() ;
110 
111  }
112 #endif
113 
114  // calcul de la premiere solution
115 
116  vpColVector eps(npt) ;
117  eps =0 ;
118 
119  int cpt = 0 ;
120  vpColVector I, J, k ;
121  I.resize(3) ;
122  J.resize(3) ;
123  k.resize(3) ;
124 
125  while(cpt < 20)
126  {
127  I = 0 ;
128  J = 0 ;
129 
130  vpColVector xprim(npt) ;
131  vpColVector yprim(npt) ;
132  for (unsigned int i=0;i<npt;i++)
133  {
134  xprim[i]=(1+ eps[i])*c3d[i].get_x() - c3d[0].get_x();
135  yprim[i]=(1+ eps[i])*c3d[i].get_y() - c3d[0].get_y();
136  }
137  I = b*xprim ;
138  J = b*yprim ;
139  normI = sqrt(I.sumSquare()) ;
140  normJ = sqrt(J.sumSquare()) ;
141  I = I/normI ;
142  J = J/normJ ;
143 
144  if (normI+normJ < 1e-10)
145  {
146  //vpERROR_TRACE(" normI+normJ = 0, division par zero " ) ;
148  "Division by zero in Dementhon pose computation: normI+normJ = 0")) ;
149  }
150 
151  k = vpColVector::cross(I,J) ;
152  Z0=2*f/(normI+normJ);
153  cpt=cpt+1; //seuil=0.0;
154  for (unsigned int i=0; i<npt; i++)
155  {
156  //double epsi_1 = eps[i] ;
157  eps[i]=(c3d[i].get_oX()*k[0]+c3d[i].get_oY()*k[1]+c3d[i].get_oZ()*k[2])/Z0;
158  //seuil+=fabs(eps[i]-epsi_1);
159  }
160  if (npt==0)
161  {
162  //vpERROR_TRACE( " npt = 0, division par zero ");
164  "Division by zero in Dementhon pose computation: no points")) ;
165  }
166  //seuil/=npt;
167  }
168  k.normalize();
169  J = vpColVector::cross(k,I) ;
170  /*matrice de passage*/
171 
172  cMo[0][0]=I[0];
173  cMo[0][1]=I[1];
174  cMo[0][2]=I[2];
175  cMo[0][3]=c3d[0].get_x()*2/(normI+normJ);
176 
177  cMo[1][0]=J[0];
178  cMo[1][1]=J[1];
179  cMo[1][2]=J[2];
180  cMo[1][3]=c3d[0].get_y()*2/(normI+normJ);
181 
182  cMo[2][0]=k[0];
183  cMo[2][1]=k[1];
184  cMo[2][2]=k[2];
185  cMo[2][3]=Z0;
186 
187  cMo[0][3] -= (p0.get_oX()*cMo[0][0]+p0.get_oY()*cMo[0][1]+p0.get_oZ()*cMo[0][2]);
188  cMo[1][3] -= (p0.get_oX()*cMo[1][0]+p0.get_oY()*cMo[1][1]+p0.get_oZ()*cMo[1][2]);
189  cMo[2][3] -= (p0.get_oX()*cMo[2][0]+p0.get_oY()*cMo[2][1]+p0.get_oZ()*cMo[2][2]);
190 }
191 
192 
193 #define DMIN 0.01 /* distance min entre la cible et la camera */
194 #define EPS 0.0000001
195 #define EPS_DEM 0.001
196 
197 static void
198 calculRTheta(double s, double c, double &r, double &theta)
199 {
200  if ((fabs(c) > EPS_DEM) || (fabs(s) > EPS_DEM))
201  {
202  r = sqrt(sqrt(s*s+c*c));
203  theta = atan2(s,c)/2.0;
204  }
205  else
206  {
207  if (fabs(c) > fabs(s))
208  {
209  r = fabs(c);
210  if (c >= 0.0)
211  theta = M_PI/2;
212  else
213  theta = -M_PI/2;
214  }
215  else
216  {
217  r = fabs(s);
218  if (s >= 0.0)
219  theta = M_PI/4.0;
220  else
221  theta = -M_PI/4.0;
222  }
223  }
224 }
225 
226 static
227 void calculSolutionDementhon(double xi0, double yi0,
228  vpColVector &I, vpColVector &J,
229  vpHomogeneousMatrix &cMo )
230 {
231 
232 #if (DEBUG_LEVEL1)
233  std::cout << "begin (Dementhon.cc)CalculSolutionDementhon() " << std::endl;
234 #endif
235 
236  double normI, normJ, normk, Z0;
237  vpColVector k(3);
238 
239  // normalisation de I et J
240  normI = sqrt(I.sumSquare()) ;
241  normJ = sqrt(J.sumSquare()) ;
242 
243  I/=normI;
244  J/=normJ;
245 
246 
247  k = vpColVector::cross(I,J) ; // k = I^I
248 
249  Z0=2.0/(normI+normJ);
250 
251  normk = sqrt(k.sumSquare()) ;
252  k /= normk ;
253 
254  J = vpColVector::cross(k,I) ;
255 
256  //calcul de la matrice de passage
257  cMo[0][0]=I[0];
258  cMo[0][1]=I[1];
259  cMo[0][2]=I[2];
260  cMo[0][3]=xi0*Z0;
261 
262  cMo[1][0]=J[0];
263  cMo[1][1]=J[1];
264  cMo[1][2]=J[2];
265  cMo[1][3]=yi0*Z0;
266 
267  cMo[2][0]=k[0];
268  cMo[2][1]=k[1];
269  cMo[2][2]=k[2];
270  cMo[2][3]=Z0;
271 
272 
273 #if (DEBUG_LEVEL1)
274  std::cout << "end (Dementhon.cc)CalculSolutionDementhon() " << std::endl;
275 #endif
276 
277 }
278 
279 int
281  vpHomogeneousMatrix &cMo)
282 {
283 
284 #if (DEBUG_LEVEL1)
285  std::cout << "begin vpPose::CalculArbreDementhon() " << std::endl;
286 #endif
287 
288  int erreur = 0;
289  double smin;
290  vpHomogeneousMatrix cMo1,cMo2,cMo_old;
291 
292  unsigned int iter_max = 20;
293  vpMatrix eps(iter_max+1,npt) ;
294 
295 
296  // on test si tous les points sont devant la camera
297  for(unsigned int i = 0; i < npt; i++)
298  {
299  double z ;
300  z = cMo[2][0]*c3d[i].get_oX()+cMo[2][1]*c3d[i].get_oY()+cMo[2][2]*c3d[i].get_oZ() + cMo[2][3];
301  if (z <= 0.0) erreur = -1;
302  }
303 
304  smin = sqrt(computeResidualDementhon(cMo)/npt) ;
305 
306  vpColVector xi(npt) ;
307  vpColVector yi(npt) ;
308 
309  if (erreur==0)
310  {
311  unsigned int k=0;
312  for(unsigned int i = 0; i < npt; i++)
313  {
314  xi[k] = c3d[i].get_x();
315  yi[k] = c3d[i].get_y();
316 
317  if (k != 0)
318  { // On ne prend pas le 1er point
319  eps[0][k] = (cMo[2][0]*c3d[i].get_oX() +
320  cMo[2][1]*c3d[i].get_oY() +
321  cMo[2][2]*c3d[i].get_oZ())/cMo[2][3];
322  }
323  k++;
324  }
325 
326 
327  vpColVector I0(3) ;
328  vpColVector J0(3) ;
329  vpColVector I(3) ;
330  vpColVector J(3) ;
331 
332  double smin_old = 2*smin ;
333 
334  unsigned int cpt = 0;
335  while ((cpt<20) && (smin_old > 0.01) && (smin <= smin_old))
336  {
337  double r, theta, s1, s2;
338 
339 #if (DEBUG_LEVEL2)
340  {
341  std::cout << "cpt " << cpt << std::endl ;
342  std::cout << "smin_old " << smin_old << std::endl ;
343  std::cout << "smin " << smin << std::endl ;
344  }
345 #endif
346 
347  smin_old = smin;
348  cMo_old = cMo;
349 
350  I0 = 0 ;
351  J0 = 0 ;
352 
353  for (unsigned int i=1;i<npt;i++)
354  {
355  double s = (1.0+eps[cpt][i])*xi[i] - xi[0];
356  I0[0] += b[0][i-1] * s;
357  I0[1] += b[1][i-1] * s;
358  I0[2] += b[2][i-1] * s;
359  s = (1.0+eps[cpt][i])*yi[i] - yi[0];
360  J0[0] += b[0][i-1] * s;
361  J0[1] += b[1][i-1] * s;
362  J0[2] += b[2][i-1] * s;
363  }
364 
365  double s = -2.0*(vpColVector::dotProd(I0,J0));
366  double c = J0.sumSquare() - I0.sumSquare() ;
367 
368  calculRTheta(s,c,r,theta);
369  double co = cos(theta);
370  double si = sin(theta);
371 
372  /* 1ere branche */
373  I = I0 + U*r*co ;
374  J = J0 + U*r*si ;
375 
376 #if (DEBUG_LEVEL3)
377  {
378  std::cout << "I " << I.t() ;
379  std::cout << "J " << J.t() ;
380  }
381 #endif
382 
383  calculSolutionDementhon(xi[0],yi[0],I,J,cMo1);
384  s1 = sqrt(computeResidualDementhon(cMo1)/npt) ;
385 #if (DEBUG_LEVEL3)
386  std::cout << "cMo1 "<< std::endl << cMo1 << std::endl ;
387 #endif
388 
389  /* 2eme branche */
390  I = I0 - U*r*co ;
391  J = J0 - U*r*si ;
392 #if (DEBUG_LEVEL3)
393  {
394  std::cout << "I " << I.t() ;
395  std::cout << "J " << J.t() ;
396  }
397 #endif
398 
399  calculSolutionDementhon(xi[0],yi[0],I,J,cMo2);
400  s2 = sqrt(computeResidualDementhon(cMo2)/npt) ;
401 #if (DEBUG_LEVEL3)
402  std::cout << "cMo2 "<< std::endl << cMo2 << std::endl ;
403 #endif
404 
405  cpt ++;
406  if (s1 <= s2)
407  {
408  smin = s1;
409  k = 0;
410  for(unsigned int i = 0; i < npt; i++)
411  {
412  if (k != 0) { // On ne prend pas le 1er point
413  eps[cpt][k] = (cMo1[2][0]*c3d[i].get_oX() + cMo1[2][1]*c3d[i].get_oY()
414  + cMo1[2][2]*c3d[i].get_oZ())/cMo1[2][3];
415  }
416  k++;
417  }
418  cMo = cMo1 ;
419  }
420  else
421  {
422  smin = s2;
423  k = 0;
424  for(unsigned int i = 0; i < npt; i++)
425  {
426  if (k != 0) { // On ne prend pas le 1er point
427  eps[cpt][k] = (cMo2[2][0]*c3d[i].get_oX() + cMo2[2][1]*c3d[i].get_oY()
428  + cMo2[2][2]*c3d[i].get_oZ())/cMo2[2][3];
429  }
430  k++;
431  }
432  cMo = cMo2 ;
433  }
434 
435  if (smin > smin_old)
436  {
437 #if (DEBUG_LEVEL2)
438  std::cout << "Divergence " << std::endl ;
439 #endif
440 
441  cMo = cMo_old ;
442  }
443 #if (DEBUG_LEVEL2)
444  {
445  std::cout << "s1 = " << s1 << std::endl ;
446  std::cout << "s2 = " << s2 << std::endl ;
447  std::cout << "smin = " << smin << std::endl ;
448  std::cout << "smin_old = " << smin_old << std::endl ;
449  }
450 #endif
451  }
452  }
453 #if (DEBUG_LEVEL1)
454  std::cout << "end vpPose::CalculArbreDementhon() return "<< erreur << std::endl;
455 #endif
456 
457  return erreur ;
458 }
459 
468 void
470 {
471 #if (DEBUG_LEVEL1)
472  std::cout << "begin CCalculPose::PoseDementhonPlan()" << std::endl ;
473 #endif
474 
475  unsigned int i,j,k ;
476 
477  vpPoint p0 = listP.front() ;
478 
479  vpPoint P ;
480  c3d.clear();
481  for (std::list<vpPoint>::const_iterator it = listP.begin(); it != listP.end(); ++it)
482  {
483  P = *it;
484  P.set_oX(P.get_oX()-p0.get_oX()) ;
485  P.set_oY(P.get_oY()-p0.get_oY()) ;
486  P.set_oZ(P.get_oZ()-p0.get_oZ()) ;
487  c3d.push_back(P);
488  }
489 
490  vpMatrix a ;
491  try
492  {
493  a.resize(npt-1,3) ;
494  }
495  catch(...)
496  {
497  vpERROR_TRACE(" ") ;
498  throw ;
499  }
500 
501 
502  for (i=1 ; i < npt ; i++)
503  {
504  a[i-1][0]=c3d[i].get_oX();
505  a[i-1][1]=c3d[i].get_oY();
506  a[i-1][2]=c3d[i].get_oZ();
507  }
508 
509  // calcul a^T a
510  vpMatrix ata ;
511  ata = a.t()*a ;
512 
513  /* essai FC pour debug SVD */
514  /*
515  vpMatrix ata_old ;
516  ata_old = a.t()*a ;
517 
518  vpMatrix ata((ata_old.getRows()-1),(ata_old.getCols()-1)) ;
519  for (i=0;i<ata.getRows();i++)
520  for (j=0;j<ata.getCols();j++) ata[i][j] = ata_old[i][j];
521  */
522  vpMatrix ata_sav;
523  ata_sav = ata;
524 
525 #if (DEBUG_LEVEL2)
526  {
527  std::cout << "a" << std::endl <<a<<std::endl ;
528  std::cout << "ata" << std::endl <<ata<<std::endl ;
529  }
530 #endif
531 
532  // calcul (a^T a)^-1
533  vpMatrix ata1(ata.getRows(),ata.getCols()) ;
534  vpMatrix v(ata.getRows(),ata.getCols());
535  vpColVector sv(ata.getRows());
536  // ata1 = ata.i() ;
537  unsigned int imin = 0;
538  double s = 0.0;
539 
540  //calcul de ata^-1
541  ata.svd(sv,v) ;
542 
543  unsigned int nc = sv.getRows() ;
544  for (i=0; i < nc ; i++)
545  if (sv[i] > s) s = sv[i];
546 
547  s *= 0.0002;
548  int irank = 0;
549  for (i=0;i<nc;i++)
550  if (sv[i] > s ) irank++;
551 
552  double svm = 100.0;
553  for (i = 0; i < nc; i++)
554  if (sv[i] < svm) { imin = i; svm = sv[i]; }
555 
556 #if (DEBUG_LEVEL2)
557  {
558  std::cout << "rang: " << irank << std::endl ;;
559  std::cout <<"imin = " << imin << std::endl ;
560  std::cout << "sv " << sv.t() << std::endl ;
561  }
562 #endif
563 
564  for (i=0 ; i < ata.getRows() ; i++)
565  for (j=0 ; j < ata.getCols() ; j++)
566  {
567  ata1[i][j] = 0.0;
568  for (k=0 ; k < nc ; k++)
569  if (sv[k] > s)
570  ata1[i][j] += ((v[i][k]*ata[j][k])/sv[k]);
571  }
572 
573 
574 
575  vpMatrix b ; // b=(at a)^-1*at
576  b = ata1*a.t() ;
577 
578  //calcul de U
579  vpColVector U(3) ;
580  U = ata.getCol(imin) ;
581 
582 #if (DEBUG_LEVEL2)
583  {
584  std::cout << "a" << std::endl <<a<<std::endl ;
585  std::cout << "ata" << std::endl <<ata_sav<<std::endl ;
586  std::cout << "ata1" << std::endl <<ata1<<std::endl ;
587  std::cout << "ata1*ata" << std::endl << ata1*ata_sav ;
588  std::cout << "b" << std::endl << b ;
589  std::cout << "U " << U.t() << std::endl ;
590  }
591 #endif
592 
593  vpColVector xi(npt) ;
594  vpColVector yi(npt) ;
595  //calcul de la premiere solution
596  for (i = 0; i < npt; i++)
597  {
598  xi[i] = c3d[i].get_x() ;
599  yi[i] = c3d[i].get_y() ;
600 
601  }
602 
603  vpColVector I0(3) ; I0 = 0 ;
604  vpColVector J0(3) ; J0 = 0 ;
605  vpColVector I(3) ;
606  vpColVector J(3) ;
607 
608  for (i=1;i<npt;i++)
609  {
610  I0[0] += b[0][i-1] * (xi[i]-xi[0]);
611  I0[1] += b[1][i-1] * (xi[i]-xi[0]);
612  I0[2] += b[2][i-1] * (xi[i]-xi[0]);
613 
614  J0[0] += b[0][i-1] * (yi[i]-yi[0]);
615  J0[1] += b[1][i-1] * (yi[i]-yi[0]);
616  J0[2] += b[2][i-1] * (yi[i]-yi[0]);
617  }
618 
619 
620 #if (DEBUG_LEVEL2)
621  {
622  std::cout << "I0 "<<I0.t() ;
623  std::cout << "J0 "<<J0.t() ;
624  }
625 #endif
626 
627  s = -2.0*vpColVector::dotProd(I0,J0);
628  double c = J0.sumSquare() - I0.sumSquare() ;
629 
630  double r,theta,si,co ;
631  calculRTheta(s, c, r, theta);
632  co = cos(theta);
633  si = sin(theta);
634 
635  // calcul de la premiere solution
636  I = I0 + U*r*co ;
637  J = J0 + U*r*si ;
638 
639  vpHomogeneousMatrix cMo1f ;
640  calculSolutionDementhon(xi[0], yi[0], I, J, cMo1f);
641 
642 
643  int erreur1 = calculArbreDementhon(b, U, cMo1f);
644 
645  // calcul de la deuxieme solution
646  I = I0 - U*r*co ;
647  J = J0 - U*r*si ;
648 
649  vpHomogeneousMatrix cMo2f;
650  calculSolutionDementhon(xi[0], yi[0], I, J, cMo2f);
651 
652  int erreur2 = calculArbreDementhon(b, U, cMo2f);
653 
654  if ((erreur1 == 0) && (erreur2 == -1)) cMo = cMo1f ;
655  if ((erreur1 == -1) && (erreur2 == 0)) cMo = cMo2f ;
656  if ((erreur1 == 0) && (erreur2 == 0))
657  {
658  double s1 = sqrt(computeResidualDementhon(cMo1f)/npt) ;
659  double s2 = sqrt(computeResidualDementhon(cMo2f)/npt) ;
660 
661  if (s1<=s2) cMo = cMo1f ; else cMo = cMo2f ;
662  }
663 
664  cMo[0][3] -= p0.get_oX()*cMo[0][0]+p0.get_oY()*cMo[0][1]+p0.get_oZ()*cMo[0][2];
665  cMo[1][3] -= p0.get_oX()*cMo[1][0]+p0.get_oY()*cMo[1][1]+p0.get_oZ()*cMo[1][2];
666  cMo[2][3] -= p0.get_oX()*cMo[2][0]+p0.get_oY()*cMo[2][1]+p0.get_oZ()*cMo[2][2];
667 
668 #if (DEBUG_LEVEL1)
669  std::cout << "end CCalculPose::PoseDementhonPlan()" << std::endl ;
670 #endif
671 }
672 
673 #undef DMIN
674 #undef EPS
675 #undef EPS_DEM
676 
677 
687 {
688  double residual_ = 0 ;
689 
690  residual_ =0 ;
691  for (unsigned int i =0 ; i < npt ; i++)
692  {
693 
694  double X = c3d[i].get_oX()*cMo[0][0]+c3d[i].get_oY()*cMo[0][1]+c3d[i].get_oZ()*cMo[0][2] + cMo[0][3];
695  double Y = c3d[i].get_oX()*cMo[1][0]+c3d[i].get_oY()*cMo[1][1]+c3d[i].get_oZ()*cMo[1][2] + cMo[1][3];
696  double Z = c3d[i].get_oX()*cMo[2][0]+c3d[i].get_oY()*cMo[2][1]+c3d[i].get_oZ()*cMo[2][2] + cMo[2][3];
697 
698  double x = X/Z ;
699  double y = Y/Z ;
700 
701  residual_ += vpMath::sqr(x-c3d[i].get_x()) + vpMath::sqr(y-c3d[i].get_y()) ;
702  }
703  return residual_ ;
704 }
705 
706 
707 #undef DEBUG_LEVEL1
708 #undef DEBUG_LEVEL2
709 #undef DEBUG_LEVEL3
710 
int calculArbreDementhon(vpMatrix &b, vpColVector &U, vpHomogeneousMatrix &cMo)
Implementation of a matrix and operations on matrices.
Definition: vpMatrix.h:97
void set_oZ(const double oZ)
Set the point Z coordinate in the object frame.
Definition: vpPoint.cpp:491
void resize(const unsigned int nrows, const unsigned int ncols, const bool flagNullify=true)
Definition: vpArray2D.h:167
static vpColVector cross(const vpColVector &a, const vpColVector &b)
Definition: vpColVector.h:266
Implementation of an homogeneous matrix and operations on such kind of matrices.
#define vpERROR_TRACE
Definition: vpDebug.h:391
double get_oY() const
Get the point Y coordinate in the object frame.
Definition: vpPoint.cpp:449
error that can be emited by ViSP classes.
Definition: vpException.h:73
unsigned int getCols() const
Return the number of columns of the 2D array.
Definition: vpArray2D.h:154
std::list< vpPoint > listP
Array of point (use here class vpPoint)
Definition: vpPose.h:101
Class that defines what is a point.
Definition: vpPoint.h:59
vpColVector & normalize()
void svd(vpColVector &w, vpMatrix &v)
Definition: vpMatrix.cpp:1631
static double sqr(double x)
Definition: vpMath.h:110
vpRowVector t() const
vpColVector getCol(const unsigned int j) const
Definition: vpMatrix.cpp:2235
double get_oZ() const
Get the point Z coordinate in the object frame.
Definition: vpPoint.cpp:451
void set_oX(const double oX)
Set the point X coordinate in the object frame.
Definition: vpPoint.cpp:487
unsigned int getRows() const
Return the number of rows of the 2D array.
Definition: vpArray2D.h:152
unsigned int npt
Number of point used in pose computation.
Definition: vpPose.h:100
double sumSquare() const
double get_oX() const
Get the point X coordinate in the object frame.
Definition: vpPoint.cpp:447
vpMatrix t() const
Definition: vpMatrix.cpp:207
void poseDementhonPlan(vpHomogeneousMatrix &cMo)
Compute the pose using Dementhon approach for planar objects this is a direct implementation of the a...
void poseDementhonNonPlan(vpHomogeneousMatrix &cMo)
Compute the pose using Dementhon approach for non planar objects this is a direct implementation of t...
Implementation of column vector and the associated operations.
Definition: vpColVector.h:72
static double dotProd(const vpColVector &a, const vpColVector &b)
void set_oY(const double oY)
Set the point Y coordinate in the object frame.
Definition: vpPoint.cpp:489
vpMatrix pseudoInverse(double svThreshold=1e-6) const
Compute the pseudo inverse of the matrix using the SVD.
Definition: vpMatrix.cpp:1741
double computeResidualDementhon(const vpHomogeneousMatrix &cMo)
Compute and return the residual expressed in meter for the pose matrix 'pose'.
void resize(const unsigned int i, const bool flagNullify=true)
Definition: vpColVector.h:225