ViSP  2.6.2
vpCalibration.cpp
1 /****************************************************************************
2  *
3  * $Id: vpCalibration.cpp 3530 2012-01-03 10:52:12Z fspindle $
4  *
5  * This file is part of the ViSP software.
6  * Copyright (C) 2005 - 2012 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  * Camera calibration.
36  *
37  * Authors:
38  * Eric Marchand
39  * Francois Chaumette
40  * Anthony Saunier
41  *
42  *****************************************************************************/
43 
44 
50 #include <visp/vpCalibration.h>
51 #include <visp/vpDebug.h>
52 #include <visp/vpPose.h>
53 #include <visp/vpPixelMeterConversion.h>
54 
55 double vpCalibration::threshold = 1e-10f;
56 unsigned int vpCalibration::nbIterMax = 4000;
57 double vpCalibration::gain = 0.25;
62 {
63  npt = 0 ;
64 
65  LoX.clear() ;
66  LoY.clear() ;
67  LoZ.clear() ;
68  Lip.clear() ;
69 
70  return 0 ;
71 }
72 
74 {
75  init() ;
76 }
77 
78 
83 {
84  clearPoint() ;
85 }
86 
92 void vpCalibration::operator=(vpCalibration& twinCalibration )
93  {
94  npt = twinCalibration.npt ;
95  LoX = twinCalibration.LoX ;
96  LoY = twinCalibration.LoY ;
97  LoZ = twinCalibration.LoZ ;
98  Lip = twinCalibration.Lip ;
99 
100  residual = twinCalibration.residual;
101  cMo = twinCalibration.cMo;
102  residual_dist = twinCalibration.residual_dist;
103  cMo_dist = twinCalibration.cMo_dist ;
104 
105  cam = twinCalibration.cam ;
106  cam_dist = twinCalibration.cam_dist ;
107 
108  rMe = twinCalibration.rMe;
109 
110  eMc = twinCalibration.eMc;
111  eMc_dist = twinCalibration.eMc_dist;
112 }
113 
114 
119 {
120  LoX.clear() ;
121  LoY.clear() ;
122  LoZ.clear() ;
123  Lip.clear() ;
124  npt = 0 ;
125 
126  return 0 ;
127 }
128 
135 int vpCalibration::addPoint(double X, double Y, double Z, vpImagePoint &ip)
136 {
137  LoX.push_back(X);
138  LoY.push_back(Y);
139  LoZ.push_back(Z);
140 
141  Lip.push_back(ip);
142 
143  npt++ ;
144 
145  return 0 ;
146 }
147 
153 void
154  vpCalibration::computePose(const vpCameraParameters &cam, vpHomogeneousMatrix &cMo)
155 {
156  // The vpPose class mainly contents a list of vpPoint (that is (X,Y,Z, x, y) )
157  vpPose pose ;
158  // the list of point is cleared (if that's not done before)
159  pose.clearPoint() ;
160  // we set the 3D points coordinates (in meter !) in the object/world frame
161  std::list<double>::const_iterator it_LoX = LoX.begin();
162  std::list<double>::const_iterator it_LoY = LoY.begin();
163  std::list<double>::const_iterator it_LoZ = LoZ.begin();
164  std::list<vpImagePoint>::const_iterator it_Lip = Lip.begin();
165 
166  for (unsigned int i =0 ; i < npt ; i++)
167  {
168  vpPoint P;
169  P.setWorldCoordinates(*it_LoX, *it_LoY, *it_LoZ);
170  double x=0,y=0 ;
171  vpPixelMeterConversion::convertPoint(cam, *it_Lip, x,y) ;
172  P.set_x(x) ;
173  P.set_y(y) ;
174 
175  pose.addPoint(P);
176  ++it_LoX;
177  ++it_LoY;
178  ++it_LoZ;
179  ++it_Lip;
180  }
181  vpHomogeneousMatrix cMo_dementhon; // computed pose with dementhon
182  vpHomogeneousMatrix cMo_lagrange; // computed pose with dementhon
183 
184  // compute the initial pose using Lagrange method followed by a non linear
185  // minimisation method
186  // Pose by Lagrange it provides an initialization of the pose
187  pose.computePose(vpPose::LAGRANGE, cMo_lagrange) ;
188  double residual_lagrange = pose.computeResidual(cMo_lagrange);
189 
190  // compute the initial pose using Dementhon method followed by a non linear
191  // minimisation method
192  // Pose by Dementhon it provides an initialization of the pose
193  pose.computePose(vpPose::DEMENTHON, cMo_dementhon) ;
194  double residual_dementhon = pose.computeResidual(cMo_dementhon);
195 
196  //we keep the better initialization
197  if (residual_lagrange < residual_dementhon)
198  cMo = cMo_lagrange;
199  else
200  cMo = cMo_dementhon;
201 
202  // the pose is now refined using the virtual visual servoing approach
203  // Warning: cMo needs to be initialized otherwise it may diverge
204  pose.computePose(vpPose::VIRTUAL_VS, cMo) ;
205 
206 }
207 
215 double
217  vpCameraParameters& cam)
218 {
219  double residual = 0 ;
220 
221  std::list<double>::const_iterator it_LoX = LoX.begin();
222  std::list<double>::const_iterator it_LoY = LoY.begin();
223  std::list<double>::const_iterator it_LoZ = LoZ.begin();
224  std::list<vpImagePoint>::const_iterator it_Lip = Lip.begin();
225 
226  double u0 = cam.get_u0() ;
227  double v0 = cam.get_v0() ;
228  double px = cam.get_px() ;
229  double py = cam.get_py() ;
230  vpImagePoint ip;
231 
232  for (unsigned int i =0 ; i < npt ; i++)
233  {
234 
235  double oX = *it_LoX;
236  double oY = *it_LoY;
237  double oZ = *it_LoZ;
238 
239  double cX = oX*cMo[0][0]+oY*cMo[0][1]+oZ*cMo[0][2] + cMo[0][3];
240  double cY = oX*cMo[1][0]+oY*cMo[1][1]+oZ*cMo[1][2] + cMo[1][3];
241  double cZ = oX*cMo[2][0]+oY*cMo[2][1]+oZ*cMo[2][2] + cMo[2][3];
242 
243  double x = cX/cZ ;
244  double y = cY/cZ ;
245 
246  ip = *it_Lip;
247  double u = ip.get_u() ;
248  double v = ip.get_v() ;
249 
250  double xp = u0 + x*px;
251  double yp = v0 + y*py;
252 
253  residual += (vpMath::sqr(xp-u) + vpMath::sqr(yp-v)) ;
254 
255  ++it_LoX;
256  ++it_LoY;
257  ++it_LoZ;
258  ++it_Lip;
259  }
260  this->residual = residual ;
261  return sqrt(residual/npt) ;
262 }
270 double
272  vpCameraParameters& cam)
273 {
274  double residual = 0 ;
275 
276  std::list<double>::const_iterator it_LoX = LoX.begin();
277  std::list<double>::const_iterator it_LoY = LoY.begin();
278  std::list<double>::const_iterator it_LoZ = LoZ.begin();
279  std::list<vpImagePoint>::const_iterator it_Lip = Lip.begin();
280 
281  double u0 = cam.get_u0() ;
282  double v0 = cam.get_v0() ;
283  double px = cam.get_px() ;
284  double py = cam.get_py() ;
285  double kud = cam.get_kud() ;
286  double kdu = cam.get_kdu() ;
287 
288  double inv_px = 1/px;
289  double inv_py = 1/px;
290  vpImagePoint ip;
291 
292  for (unsigned int i =0 ; i < npt ; i++)
293  {
294 
295  double oX = *it_LoX;
296  double oY = *it_LoY;
297  double oZ = *it_LoZ;
298 
299  double cX = oX*cMo[0][0]+oY*cMo[0][1]+oZ*cMo[0][2] + cMo[0][3];
300  double cY = oX*cMo[1][0]+oY*cMo[1][1]+oZ*cMo[1][2] + cMo[1][3];
301  double cZ = oX*cMo[2][0]+oY*cMo[2][1]+oZ*cMo[2][2] + cMo[2][3];
302 
303  double x = cX/cZ ;
304  double y = cY/cZ ;
305 
306  ip = *it_Lip;
307  double u = ip.get_u() ;
308  double v = ip.get_v() ;
309 
310  double r2ud = 1+kud*(vpMath::sqr(x)+vpMath::sqr(y)) ;
311 
312  double xp = u0 + x*px*r2ud;
313  double yp = v0 + y*py*r2ud;
314 
315  residual += (vpMath::sqr(xp-u) + vpMath::sqr(yp-v)) ;
316 
317  double r2du = (vpMath::sqr((u-u0)*inv_px)+vpMath::sqr((v-v0)*inv_py)) ;
318 
319  xp = u0 + x*px - kdu*(u-u0)*r2du;
320  yp = v0 + y*py - kdu*(v-v0)*r2du;
321 
322  residual += (vpMath::sqr(xp-u) + vpMath::sqr(yp-v)) ;
323  ++it_LoX;
324  ++it_LoY;
325  ++it_LoZ;
326  ++it_Lip;
327  }
328  residual /=2;
329 
330  this->residual_dist = residual;
331  return sqrt(residual/npt) ;
332 }
333 
340 void
341  vpCalibration::computeStdDeviation(double &deviation,double &deviation_dist)
342 {
343  deviation = computeStdDeviation(cMo,cam);
344  deviation_dist = computeStdDeviation_dist(cMo_dist,cam_dist);
345 }
346 
347 
360  vpHomogeneousMatrix &cMo,
361  vpCameraParameters &cam,
362  bool verbose)
363 {
364  try{
365  computePose(cam,cMo);
366  switch (method)
367  {
368  case CALIB_LAGRANGE :
370  {
371  calibLagrange(cam, cMo);
372  }
373  break;
374  case CALIB_VIRTUAL_VS:
377  default:
378  break;
379  }
380 
381  switch (method)
382  {
383  case CALIB_VIRTUAL_VS:
387  {
388  if (verbose){std::cout << "start calibration without distortion"<< std::endl;}
389  calibVVS(cam, cMo, verbose);
390  }
391  break ;
392  case CALIB_LAGRANGE:
393  default:
394  break;
395  }
396  this->cMo = cMo;
397  this->cMo_dist = cMo;
398 
399  //Print camera parameters
400  if(verbose){
401  // std::cout << "Camera parameters without distortion :" << std::endl;
402  cam.printParameters();
403  }
404 
405  this->cam = cam;
406 
407  switch (method)
408  {
411  {
412  if (verbose){std::cout << "start calibration with distortion"<< std::endl;}
413  calibVVSWithDistortion(cam, cMo, verbose);
414  }
415  break ;
416  case CALIB_LAGRANGE:
417  case CALIB_VIRTUAL_VS:
419  default:
420  break;
421  }
422  //Print camera parameters
423  if(verbose){
424  // std::cout << "Camera parameters without distortion :" << std::endl;
425  this->cam.printParameters();
426  // std::cout << "Camera parameters with distortion :" << std::endl;
427  cam.printParameters();
428  }
429 
430  this->cam_dist = cam ;
431 
432  this->cMo_dist = cMo;
433  return 0 ;
434  }
435  catch(...){
436  throw;
437  }
438 }
439 
453  unsigned int nbPose,
454  vpCalibration table_cal[],
455  vpCameraParameters& cam,
456  bool verbose)
457 {
458  try{
459  for(unsigned int i=0;i<nbPose;i++){
460  if(table_cal[i].get_npt()>3)
461  table_cal[i].computePose(cam,table_cal[i].cMo);
462  }
463  switch (method) {
464  case CALIB_LAGRANGE :
465  if(nbPose > 1){
466  std::cout << "this calibration method is not available in" << std::endl
467  << "vpCalibration::computeCalibrationMulti()" << std::endl;
468  return -1 ;
469  }
470  else {
471  table_cal[0].calibLagrange(cam,table_cal[0].cMo);
472  table_cal[0].cam = cam ;
473  table_cal[0].cam_dist = cam ;
474  table_cal[0].cMo_dist = table_cal[0].cMo ;
475  }
476  break;
479  if(nbPose > 1){
480  std::cout << "this calibration method is not available in" << std::endl
481  << "vpCalibration::computeCalibrationMulti()" << std::endl
482  << "with several images." << std::endl;
483  return -1 ;
484  }
485  else {
486  table_cal[0].calibLagrange(cam,table_cal[0].cMo);
487  table_cal[0].cam = cam ;
488  table_cal[0].cam_dist = cam ;
489  table_cal[0].cMo_dist = table_cal[0].cMo ;
490  }
491  case CALIB_VIRTUAL_VS:
493  {
494  calibVVSMulti(nbPose, table_cal, cam, verbose);
495  }
496  break ;
497  }
498  //Print camera parameters
499  if(verbose){
500  // std::cout << "Camera parameters without distortion :" << std::endl;
501  cam.printParameters();
502  }
503 
504  switch (method)
505  {
506  case CALIB_LAGRANGE :
508  case CALIB_VIRTUAL_VS:
509  verbose = false ;
510  break;
513  {
514  if(verbose)
515  std::cout << "Compute camera parameters with distortion"<<std::endl;
516 
517  calibVVSWithDistortionMulti(nbPose, table_cal, cam, verbose);
518  }
519  break ;
520  }
521  //Print camera parameters
522  if(verbose){
523  // std::cout << "Camera parameters without distortion :" << std::endl;
524  table_cal[0].cam.printParameters();
525  // std::cout << "Camera parameters with distortion:" << std::endl;
526  cam.printParameters();
527  std::cout<<std::endl;
528  }
529  return 0 ;
530  }
531  catch(...){ throw; }
532 }
533 
554  vpCalibration table_cal[],
555  vpHomogeneousMatrix& eMc,
556  vpHomogeneousMatrix& eMc_dist)
557 {
558  vpHomogeneousMatrix* table_cMo = new vpHomogeneousMatrix[nbPose];
559  vpHomogeneousMatrix* table_cMo_dist = new vpHomogeneousMatrix[nbPose];
560  vpHomogeneousMatrix* table_rMe = new vpHomogeneousMatrix[nbPose];
561  try{
562  if (nbPose > 2){
563  for(unsigned int i=0;i<nbPose;i++){
564  table_cMo[i] = table_cal[i].cMo;
565  table_cMo_dist[i] = table_cal[i].cMo_dist;
566  table_rMe[i] = table_cal[i].rMe;
567  }
568  calibrationTsai(nbPose,table_cMo,table_rMe,eMc);
569  calibrationTsai(nbPose,table_cMo_dist,table_rMe,eMc_dist);
570  delete [] table_cMo;
571  delete [] table_cMo_dist;
572  delete [] table_rMe;
573  return 0;
574  }
575  else{
576  vpERROR_TRACE("Three images are needed to compute Tsai calibration !\n");
577  delete [] table_cMo;
578  delete [] table_cMo_dist;
579  delete [] table_rMe;
580  return -1;
581  }
582  }
583  catch(...){
584  delete [] table_cMo;
585  delete [] table_cMo_dist;
586  delete [] table_rMe;
587  throw;
588  }
589 }
590 
591 
599 int vpCalibration::writeData(const char *filename)
600 {
601  std::ofstream f(filename) ;
602  vpImagePoint ip;
603 
604  std::list<double>::const_iterator it_LoX = LoX.begin();
605  std::list<double>::const_iterator it_LoY = LoY.begin();
606  std::list<double>::const_iterator it_LoZ = LoZ.begin();
607  std::list<vpImagePoint>::const_iterator it_Lip = Lip.begin();
608 
609  f.precision(10);
610  f.setf(std::ios::fixed,std::ios::floatfield);
611  f << LoX.size() << std::endl ;
612 
613  for (unsigned int i =0 ; i < LoX.size() ; i++)
614  {
615 
616  double oX = *it_LoX;
617  double oY = *it_LoY;
618  double oZ = *it_LoZ;
619 
620  ip = *it_Lip;
621  double u = ip.get_u() ;
622  double v = ip.get_v() ;
623 
624  f << oX <<" " << oY << " " << oZ << " " << u << " " << v <<std::endl ;
625 
626  ++it_LoX;
627  ++it_LoY;
628  ++it_LoZ;
629  ++it_Lip;
630 
631  }
632 
633  f.close() ;
634  return 0 ;
635 }
636 
643 int vpCalibration::readData(const char* filename)
644 {
645  vpImagePoint ip;
646  std::ifstream f;
647  f.open(filename);
648  if (f != NULL){
649  int n ;
650  f >> n ;
651  std::cout << "There are "<< n <<" point on the calibration grid " << std::endl ;
652 
653  clearPoint() ;
654  for (int i=0 ; i < n ; i++)
655  {
656  double x, y, z, u, v ;
657  f >> x >> y >> z >> u >> v ;
658  std::cout << x <<" "<<y <<" "<<z<<" "<<u<<" "<<v <<std::endl ;
659  ip.set_u( u );
660  ip.set_v( v );
661  addPoint(x, y, z, ip) ;
662  }
663 
664  f.close() ;
665  return 0 ;
666  }
667  else{
668  return -1;
669  }
670 }
687 int vpCalibration::readGrid(const char* filename, unsigned int &n,
688  std::list<double> &oX, std::list<double> &oY, std::list<double> &oZ, bool verbose)
689 {
690  try{
691  std::ifstream f;
692  f.open(filename);
693  if (f != NULL){
694 
695  f >> n ;
696  if(verbose)
697  std::cout << "There are "<< n <<" points on the calibration grid " << std::endl ;
698  int no_pt;
699  double x,y,z;
700 
701  // clear the list
702  oX.clear();
703  oY.clear();
704  oZ.clear();
705 
706  for (unsigned int i=0 ; i < n ; i++)
707  {
708  f >> no_pt >> x >> y >> z ;
709  if(verbose){
710  std::cout << no_pt <<std::endl ;
711  std::cout << x <<" "<< y <<" "<< z <<std::endl ;
712  }
713  oX.push_back(x) ;
714  oY.push_back(y) ;
715  oZ.push_back(z) ;
716  }
717 
718  f.close() ;
719  }
720  else{
721  return -1;
722  }
723  }
724  catch(...){return -1;}
725  return 0 ;
726 }
727 
736  unsigned int thickness)
737 {
738 
739  for (std::list<vpImagePoint>::const_iterator it = Lip.begin(); it != Lip.end(); ++ it) {
740  vpDisplay::displayCross(I, *it, 12, color, thickness) ;
741  }
742  return 0 ;
743 }
744 
753  unsigned int thickness)
754 {
755  double u0_dist = cam_dist.get_u0() ;
756  double v0_dist = cam_dist.get_v0() ;
757  double px_dist = cam_dist.get_px() ;
758  double py_dist = cam_dist.get_py() ;
759  double kud_dist = cam_dist.get_kud() ;
760  // double kdu_dist = cam_dist.get_kdu() ;
761 
762  // double u0 = cam.get_u0() ;
763  // double v0 = cam.get_v0() ;
764  // double px = cam.get_px() ;
765  // double py = cam.get_py() ;
766 
767  std::list<double>::const_iterator it_LoX = LoX.begin();
768  std::list<double>::const_iterator it_LoY = LoY.begin();
769  std::list<double>::const_iterator it_LoZ = LoZ.begin();
770 
771  for (unsigned int i =0 ; i < npt ; i++)
772  {
773 
774  double oX = *it_LoX;
775  double oY = *it_LoY;
776  double oZ = *it_LoZ;
777 
778  double cX = oX*cMo[0][0]+oY*cMo[0][1]+oZ*cMo[0][2] + cMo[0][3];
779  double cY = oX*cMo[1][0]+oY*cMo[1][1]+oZ*cMo[1][2] + cMo[1][3];
780  double cZ = oX*cMo[2][0]+oY*cMo[2][1]+oZ*cMo[2][2] + cMo[2][3];
781 
782  double x = cX/cZ ;
783  double y = cY/cZ ;
784 
785  // double xp = u0 + x*px ;
786  // double yp = v0 + y*py ;
787 
788  // vpDisplay::displayCross(I,(int)vpMath::round(yp), (int)vpMath::round(xp),
789  // 5,col) ;
790 
791  cX = oX*cMo_dist[0][0]+oY*cMo_dist[0][1]+oZ*cMo_dist[0][2]+cMo_dist[0][3];
792  cY = oX*cMo_dist[1][0]+oY*cMo_dist[1][1]+oZ*cMo_dist[1][2]+cMo_dist[1][3];
793  cZ = oX*cMo_dist[2][0]+oY*cMo_dist[2][1]+oZ*cMo_dist[2][2]+cMo_dist[2][3];
794 
795  x = cX/cZ ;
796  y = cY/cZ ;
797 
798  double r2 = 1+kud_dist*(vpMath::sqr(x)+vpMath::sqr(y)) ;
799 
800  vpImagePoint ip;
801  ip.set_u( u0_dist + x*px_dist*r2 );
802  ip.set_v( v0_dist + y*py_dist*r2 );
803 
804  vpDisplay::displayCross(I, ip, 6, color, thickness) ;
806 
807  // std::cout << oX << " " << oY << " " <<oZ << std::endl ;
808  // I.getClick() ;
809  ++it_LoX;
810  ++it_LoY;
811  ++it_LoZ;
812  }
813  return 0;
814 }
815 
816 #ifdef VISP_BUILD_DEPRECATED_FUNCTIONS
817 
836 int vpCalibration::readGrid(const char* filename,unsigned int &n,
837  vpList<double> &oX,vpList<double> &oY,vpList<double> &oZ, bool verbose)
838 {
839  try{
840  std::ifstream f;
841  f.open(filename);
842  if (f != NULL){
843 
844  f >> n ;
845  if(verbose)
846  std::cout << "There are "<< n <<" points on the calibration grid " << std::endl ;
847  int no_pt;
848  double x,y,z;
849 
850  oX.front();
851  oY.front();
852  oZ.front();
853  for (unsigned int i=0 ; i < n ; i++)
854  {
855  f >> no_pt >> x >> y >> z ;
856  if(verbose){
857  std::cout << no_pt <<std::endl ;
858  std::cout << x <<" "<< y <<" "<< z <<std::endl ;
859  }
860  oX.addRight(x) ;
861  oY.addRight(y) ;
862  oZ.addRight(z) ;
863  }
864 
865  f.close() ;
866  }
867  else{
868  return -1;
869  }
870  }
871  catch(...){return -1;}
872  return 0 ;
873 }
874 
875 #endif // VISP_BUILD_DEPRECATED_FUNCTIONS
double get_v() const
Definition: vpImagePoint.h:250
double get_u0() const
vpCalibration()
Constructor.
static int computeCalibrationTsai(unsigned int nbPose, vpCalibration table_cal[], vpHomogeneousMatrix &eMc, vpHomogeneousMatrix &eMc_dist)
Compute the multi-image calibration of effector-camera from R. Tsai and R. LorenzTsai.
int displayGrid(vpImage< unsigned char > &I, vpColor color=vpColor::yellow, unsigned int thickness=1)
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
Provide simple list management.
Definition: vpList.h:112
int readData(const char *filename)
Class to define colors available for display functionnalities.
Definition: vpColor.h:123
double get_u() const
Definition: vpImagePoint.h:239
int addPoint(double X, double Y, double Z, vpImagePoint &ip)
void set_x(const double x)
Set the point x coordinate in the image plane.
Definition: vpPoint.h:183
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...
double get_py() const
Tools for perspective camera calibration.
Definition: vpCalibration.h:78
virtual ~vpCalibration()
Destructor.
int computeCalibration(vpCalibrationMethodType method, vpHomogeneousMatrix &cMo, vpCameraParameters &cam, bool verbose=false)
double computeStdDeviation_dist(vpHomogeneousMatrix &cMo, vpCameraParameters &cam)
vpHomogeneousMatrix cMo
(as a 3x4 matrix [R T])
Definition: vpCalibration.h:92
Class that defines what is a point.
Definition: vpPoint.h:65
void operator=(vpCalibration &twinCalibration)
= operator
int displayData(vpImage< unsigned char > &I, vpColor color=vpColor::red, unsigned int thickness=1)
static void calibrationTsai(unsigned int nbPose, vpHomogeneousMatrix cMo[], vpHomogeneousMatrix rMe[], vpHomogeneousMatrix &eMc)
calibration method of effector-camera from R. Tsai and R. Lorenz
int clearPoint()
Suppress all the point in the array of point.
double get_v0() const
void set_u(const double u)
Definition: vpImagePoint.h:203
static double sqr(double x)
Definition: vpMath.h:106
void front(void)
Position the current element on the first element of the list.
Definition: vpList.h:386
vpHomogeneousMatrix cMo_dist
Definition: vpCalibration.h:94
virtual void displayCross(const vpImagePoint &ip, unsigned int size, const vpColor &color, unsigned int thickness=1)=0
void set_v(const double v)
Definition: vpImagePoint.h:214
Class used for pose computation from N points (pose from point only).
Definition: vpPose.h:80
double computeResidual(vpHomogeneousMatrix &cMo)
Compute and return the residual expressed in meter for the pose matrix 'cMo'.
Definition: vpPose.cpp:255
Generic class defining intrinsic camera parameters.
void addRight(const type &el)
add a new element in the list, at the right of the current one
Definition: vpList.h:480
vpHomogeneousMatrix eMc_dist
void set_y(const double y)
Set the point y coordinate in the image plane.
Definition: vpPoint.h:185
static int computeCalibrationMulti(vpCalibrationMethodType method, unsigned int nbPose, vpCalibration table_cal[], vpCameraParameters &cam, bool verbose=false)
unsigned int get_npt() const
get the number of points
double get_px() const
vpHomogeneousMatrix rMe
reference coordinates (manipulator base coordinates)
double get_kud() const
vpCameraParameters cam_dist
projection model with distortion
Definition: vpCalibration.h:99
double get_kdu() const
int writeData(const char *filename)
vpHomogeneousMatrix eMc
position of the camera in relation to the effector
void computePose(vpPoseMethodType methode, vpHomogeneousMatrix &cMo)
compute the pose for a given method
Definition: vpPose.cpp:298
Class that defines a 2D point in an image. This class is useful for image processing and stores only ...
Definition: vpImagePoint.h:92
void computeStdDeviation(double &deviation, double &deviation_dist)
vpCameraParameters cam
projection model without distortion
Definition: vpCalibration.h:97
void addPoint(const vpPoint &P)
Add a new point in this array.
Definition: vpPose.cpp:148
static int readGrid(const char *filename, unsigned int &n, std::list< double > &oX, std::list< double > &oY, std::list< double > &oZ, bool verbose=false)
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:126