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