Visual Servoing Platform  version 3.1.0
vpCalibration.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 modify
7  * it under the terms of the GNU General Public License as published by
8  * the Free Software Foundation; either version 2 of the License, or
9  * (at your option) any later version.
10  * See the file LICENSE.txt at the root directory of this source
11  * distribution for additional information about the GNU GPL.
12  *
13  * For using ViSP with software that can not be combined with the GNU
14  * GPL, please contact Inria about acquiring a ViSP Professional
15  * Edition License.
16  *
17  * See http://visp.inria.fr for more information.
18  *
19  * This software was developed at:
20  * Inria Rennes - Bretagne Atlantique
21  * Campus Universitaire de Beaulieu
22  * 35042 Rennes Cedex
23  * France
24  *
25  * If you have questions regarding the use of this file, please contact
26  * Inria at visp@inria.fr
27  *
28  * This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
29  * WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
30  *
31  * Description:
32  * Camera calibration.
33  *
34  * Authors:
35  * Eric Marchand
36  * Francois Chaumette
37  * Anthony Saunier
38  *
39  *****************************************************************************/
40 
46 #include <visp3/core/vpDebug.h>
47 #include <visp3/core/vpPixelMeterConversion.h>
48 #include <visp3/vision/vpCalibration.h>
49 #include <visp3/vision/vpPose.h>
50 
51 double vpCalibration::threshold = 1e-10f;
52 unsigned int vpCalibration::nbIterMax = 4000;
53 double vpCalibration::gain = 0.25;
58 {
59  npt = 0;
60 
61  residual = residual_dist = 1000.;
62 
63  LoX.clear();
64  LoY.clear();
65  LoZ.clear();
66  Lip.clear();
67 
68  return 0;
69 }
70 
75  : cMo(), cMo_dist(), cam(), cam_dist(), rMe(), eMc(), eMc_dist(), npt(0), LoX(), LoY(), LoZ(), Lip(), residual(1000.),
76  residual_dist(1000.)
77 {
78  init();
79 }
84  : cMo(), cMo_dist(), cam(), cam_dist(), rMe(), eMc(), eMc_dist(), npt(0), LoX(), LoY(), LoZ(), Lip(), residual(1000.),
85  residual_dist(1000.)
86 {
87  (*this) = c;
88 }
89 
94 
101 {
102  npt = twinCalibration.npt;
103  LoX = twinCalibration.LoX;
104  LoY = twinCalibration.LoY;
105  LoZ = twinCalibration.LoZ;
106  Lip = twinCalibration.Lip;
107 
108  residual = twinCalibration.residual;
109  cMo = twinCalibration.cMo;
110  residual_dist = twinCalibration.residual_dist;
111  cMo_dist = twinCalibration.cMo_dist;
112 
113  cam = twinCalibration.cam;
114  cam_dist = twinCalibration.cam_dist;
115 
116  rMe = twinCalibration.rMe;
117 
118  eMc = twinCalibration.eMc;
119  eMc_dist = twinCalibration.eMc_dist;
120 
121  return (*this);
122 }
123 
128 {
129  LoX.clear();
130  LoY.clear();
131  LoZ.clear();
132  Lip.clear();
133  npt = 0;
134 
135  return 0;
136 }
137 
144 int vpCalibration::addPoint(double X, double Y, double Z, vpImagePoint &ip)
145 {
146  LoX.push_back(X);
147  LoY.push_back(Y);
148  LoZ.push_back(Z);
149 
150  Lip.push_back(ip);
151 
152  npt++;
153 
154  return 0;
155 }
156 
162 void vpCalibration::computePose(const vpCameraParameters &camera, vpHomogeneousMatrix &cMo_est)
163 {
164  // The vpPose class mainly contents a list of vpPoint (that is (X,Y,Z, x, y)
165  // )
166  vpPose pose;
167  // the list of point is cleared (if that's not done before)
168  pose.clearPoint();
169  // we set the 3D points coordinates (in meter !) in the object/world frame
170  std::list<double>::const_iterator it_LoX = LoX.begin();
171  std::list<double>::const_iterator it_LoY = LoY.begin();
172  std::list<double>::const_iterator it_LoZ = LoZ.begin();
173  std::list<vpImagePoint>::const_iterator it_Lip = Lip.begin();
174 
175  for (unsigned int i = 0; i < npt; i++) {
176  vpPoint P(*it_LoX, *it_LoY, *it_LoZ);
177  double x = 0, y = 0;
178  vpPixelMeterConversion::convertPoint(camera, *it_Lip, x, y);
179  P.set_x(x);
180  P.set_y(y);
181 
182  pose.addPoint(P);
183  ++it_LoX;
184  ++it_LoY;
185  ++it_LoZ;
186  ++it_Lip;
187  }
188  vpHomogeneousMatrix cMo_dementhon; // computed pose with dementhon
189  vpHomogeneousMatrix cMo_lagrange; // computed pose with dementhon
190 
191  // compute the initial pose using Lagrange method followed by a non linear
192  // minimisation method
193  // Pose by Lagrange it provides an initialization of the pose
194  pose.computePose(vpPose::LAGRANGE, cMo_lagrange);
195  double residual_lagrange = pose.computeResidual(cMo_lagrange);
196 
197  // compute the initial pose using Dementhon method followed by a non linear
198  // minimisation method
199  // Pose by Dementhon it provides an initialization of the pose
200  pose.computePose(vpPose::DEMENTHON, cMo_dementhon);
201  double residual_dementhon = pose.computeResidual(cMo_dementhon);
202 
203  // we keep the better initialization
204  if (residual_lagrange < residual_dementhon)
205  cMo_est = cMo_lagrange;
206  else
207  cMo_est = cMo_dementhon;
208 
209  // the pose is now refined using the virtual visual servoing approach
210  // Warning: cMo needs to be initialized otherwise it may diverge
211  pose.computePose(vpPose::VIRTUAL_VS, cMo_est);
212 }
213 
222 {
223  double residual_ = 0;
224 
225  std::list<double>::const_iterator it_LoX = LoX.begin();
226  std::list<double>::const_iterator it_LoY = LoY.begin();
227  std::list<double>::const_iterator it_LoZ = LoZ.begin();
228  std::list<vpImagePoint>::const_iterator it_Lip = Lip.begin();
229 
230  double u0 = camera.get_u0();
231  double v0 = camera.get_v0();
232  double px = camera.get_px();
233  double py = camera.get_py();
234  vpImagePoint ip;
235 
236  for (unsigned int i = 0; i < npt; i++) {
237  double oX = *it_LoX;
238  double oY = *it_LoY;
239  double oZ = *it_LoZ;
240 
241  double cX = oX * cMo_est[0][0] + oY * cMo_est[0][1] + oZ * cMo_est[0][2] + cMo_est[0][3];
242  double cY = oX * cMo_est[1][0] + oY * cMo_est[1][1] + oZ * cMo_est[1][2] + cMo_est[1][3];
243  double cZ = oX * cMo_est[2][0] + oY * cMo_est[2][1] + oZ * cMo_est[2][2] + cMo_est[2][3];
244 
245  double x = cX / cZ;
246  double y = cY / cZ;
247 
248  ip = *it_Lip;
249  double u = ip.get_u();
250  double v = ip.get_v();
251 
252  double xp = u0 + x * px;
253  double yp = v0 + y * py;
254 
255  residual_ += (vpMath::sqr(xp - u) + vpMath::sqr(yp - v));
256 
257  ++it_LoX;
258  ++it_LoY;
259  ++it_LoZ;
260  ++it_Lip;
261  }
262  this->residual = residual_;
263  return sqrt(residual_ / npt);
264 }
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 = camera.get_u0();
282  double v0 = camera.get_v0();
283  double px = camera.get_px();
284  double py = camera.get_py();
285  double kud = camera.get_kud();
286  double kdu = camera.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  double oX = *it_LoX;
294  double oY = *it_LoY;
295  double oZ = *it_LoZ;
296 
297  double cX = oX * cMo_est[0][0] + oY * cMo_est[0][1] + oZ * cMo_est[0][2] + cMo_est[0][3];
298  double cY = oX * cMo_est[1][0] + oY * cMo_est[1][1] + oZ * cMo_est[1][2] + cMo_est[1][3];
299  double cZ = oX * cMo_est[2][0] + oY * cMo_est[2][1] + oZ * cMo_est[2][2] + cMo_est[2][3];
300 
301  double x = cX / cZ;
302  double y = cY / cZ;
303 
304  ip = *it_Lip;
305  double u = ip.get_u();
306  double v = ip.get_v();
307 
308  double r2ud = 1 + kud * (vpMath::sqr(x) + vpMath::sqr(y));
309 
310  double xp = u0 + x * px * r2ud;
311  double yp = v0 + y * py * r2ud;
312 
313  residual_ += (vpMath::sqr(xp - u) + vpMath::sqr(yp - v));
314 
315  double r2du = (vpMath::sqr((u - u0) * inv_px) + vpMath::sqr((v - v0) * inv_py));
316 
317  xp = u0 + x * px - kdu * (u - u0) * r2du;
318  yp = v0 + y * py - kdu * (v - v0) * r2du;
319 
320  residual_ += (vpMath::sqr(xp - u) + vpMath::sqr(yp - v));
321  ++it_LoX;
322  ++it_LoY;
323  ++it_LoZ;
324  ++it_Lip;
325  }
326  residual_ /= 2;
327 
328  this->residual_dist = residual_;
329  return sqrt(residual_ / npt);
330 }
331 
339 void vpCalibration::computeStdDeviation(double &deviation, double &deviation_dist)
340 {
341  deviation = computeStdDeviation(cMo, cam);
342  deviation_dist = computeStdDeviation_dist(cMo_dist, cam_dist);
343 }
344 
357  vpCameraParameters &cam_est, bool verbose)
358 {
359  try {
360  computePose(cam_est, cMo_est);
361  switch (method) {
362  case CALIB_LAGRANGE:
364  calibLagrange(cam_est, cMo_est);
365  } break;
366  case CALIB_VIRTUAL_VS:
369  default:
370  break;
371  }
372 
373  switch (method) {
374  case CALIB_VIRTUAL_VS:
378  if (verbose) {
379  std::cout << "start calibration without distortion" << std::endl;
380  }
381  calibVVS(cam_est, cMo_est, verbose);
382  } break;
383  case CALIB_LAGRANGE:
384  default:
385  break;
386  }
387  this->cMo = cMo_est;
388  this->cMo_dist = cMo_est;
389 
390  // Print camera parameters
391  if (verbose) {
392  // std::cout << "Camera parameters without distortion :" <<
393  // std::endl;
394  cam_est.printParameters();
395  }
396 
397  this->cam = cam_est;
398 
399  switch (method) {
402  if (verbose) {
403  std::cout << "start calibration with distortion" << std::endl;
404  }
405  calibVVSWithDistortion(cam_est, cMo_est, verbose);
406  } break;
407  case CALIB_LAGRANGE:
408  case CALIB_VIRTUAL_VS:
410  default:
411  break;
412  }
413  // Print camera parameters
414  if (verbose) {
415  // std::cout << "Camera parameters without distortion :" <<
416  // std::endl;
417  this->cam.printParameters();
418  // std::cout << "Camera parameters with distortion :" <<
419  // std::endl;
420  cam_est.printParameters();
421  }
422 
423  this->cam_dist = cam_est;
424 
425  this->cMo_dist = cMo_est;
426  return 0;
427  } catch (...) {
428  throw;
429  }
430 }
431 
445 int vpCalibration::computeCalibrationMulti(vpCalibrationMethodType method, std::vector<vpCalibration> &table_cal,
446  vpCameraParameters &cam_est, double &globalReprojectionError, bool verbose)
447 {
448  try {
449  unsigned int nbPose = (unsigned int)table_cal.size();
450  for (unsigned int i = 0; i < nbPose; i++) {
451  if (table_cal[i].get_npt() > 3)
452  table_cal[i].computePose(cam_est, table_cal[i].cMo);
453  }
454  switch (method) {
455  case CALIB_LAGRANGE: {
456  if (nbPose > 1) {
457  std::cout << "this calibration method is not available in" << std::endl
458  << "vpCalibration::computeCalibrationMulti()" << std::endl;
459  return -1;
460  } else {
461  table_cal[0].calibLagrange(cam_est, table_cal[0].cMo);
462  table_cal[0].cam = cam_est;
463  table_cal[0].cam_dist = cam_est;
464  table_cal[0].cMo_dist = table_cal[0].cMo;
465  }
466  break;
467  }
470  if (nbPose > 1) {
471  std::cout << "this calibration method is not available in" << std::endl
472  << "vpCalibration::computeCalibrationMulti()" << std::endl
473  << "with several images." << std::endl;
474  return -1;
475  } else {
476  table_cal[0].calibLagrange(cam_est, table_cal[0].cMo);
477  table_cal[0].cam = cam_est;
478  table_cal[0].cam_dist = cam_est;
479  table_cal[0].cMo_dist = table_cal[0].cMo;
480  }
481  calibVVSMulti(table_cal, cam_est, globalReprojectionError, verbose);
482  break;
483  }
484  case CALIB_VIRTUAL_VS:
485  case CALIB_VIRTUAL_VS_DIST: {
486  calibVVSMulti(table_cal, cam_est, globalReprojectionError, verbose);
487  break;
488  }
489  }
490  // Print camera parameters
491  if (verbose) {
492  // std::cout << "Camera parameters without distortion :" <<
493  // std::endl;
494  cam_est.printParameters();
495  }
496 
497  switch (method) {
498  case CALIB_LAGRANGE:
500  case CALIB_VIRTUAL_VS:
501  verbose = false;
502  break;
504  case CALIB_VIRTUAL_VS_DIST: {
505  if (verbose)
506  std::cout << "Compute camera parameters with distortion" << std::endl;
507 
508  calibVVSWithDistortionMulti(table_cal, cam_est, globalReprojectionError, verbose);
509  } break;
510  }
511  // Print camera parameters
512  if (verbose) {
513  // std::cout << "Camera parameters without distortion :" <<
514  // std::endl;
515  table_cal[0].cam.printParameters();
516  // std::cout << "Camera parameters with distortion:" << std::endl;
517  cam_est.printParameters();
518  std::cout << std::endl;
519  }
520  return 0;
521  } catch (...) {
522  throw;
523  }
524 }
525 
543 int vpCalibration::computeCalibrationTsai(const std::vector<vpCalibration> &table_cal, vpHomogeneousMatrix &eMc,
545 {
546  try {
547  unsigned int nbPose = (unsigned int)table_cal.size();
548  if (nbPose > 2) {
549  std::vector<vpHomogeneousMatrix> table_cMo(nbPose);
550  std::vector<vpHomogeneousMatrix> table_cMo_dist(nbPose);
551  std::vector<vpHomogeneousMatrix> table_rMe(nbPose);
552 
553  for (unsigned int i = 0; i < nbPose; i++) {
554  table_cMo[i] = table_cal[i].cMo;
555  table_cMo_dist[i] = table_cal[i].cMo_dist;
556  table_rMe[i] = table_cal[i].rMe;
557  }
558  calibrationTsai(table_cMo, table_rMe, eMc);
559  calibrationTsai(table_cMo_dist, table_rMe, eMc_dist);
560 
561  return 0;
562  } else {
563  vpERROR_TRACE("Three images are needed to compute Tsai calibration !\n");
564  return -1;
565  }
566  } catch (...) {
567  throw;
568  }
569 }
570 
578 int vpCalibration::writeData(const char *filename)
579 {
580  std::ofstream f(filename);
581  vpImagePoint ip;
582 
583  std::list<double>::const_iterator it_LoX = LoX.begin();
584  std::list<double>::const_iterator it_LoY = LoY.begin();
585  std::list<double>::const_iterator it_LoZ = LoZ.begin();
586  std::list<vpImagePoint>::const_iterator it_Lip = Lip.begin();
587 
588  f.precision(10);
589  f.setf(std::ios::fixed, std::ios::floatfield);
590  f << LoX.size() << std::endl;
591 
592  for (unsigned int i = 0; i < LoX.size(); i++) {
593 
594  double oX = *it_LoX;
595  double oY = *it_LoY;
596  double oZ = *it_LoZ;
597 
598  ip = *it_Lip;
599  double u = ip.get_u();
600  double v = ip.get_v();
601 
602  f << oX << " " << oY << " " << oZ << " " << u << " " << v << std::endl;
603 
604  ++it_LoX;
605  ++it_LoY;
606  ++it_LoZ;
607  ++it_Lip;
608  }
609 
610  f.close();
611  return 0;
612 }
613 
620 int vpCalibration::readData(const char *filename)
621 {
622  vpImagePoint ip;
623  std::ifstream f;
624  f.open(filename);
625  if (!f.fail()) {
626  unsigned int n;
627  f >> n;
628  std::cout << "There are " << n << " point on the calibration grid " << std::endl;
629 
630  clearPoint();
631 
632  if (n > 100000)
633  throw(vpException(vpException::badValue, "Bad number of point in the calibration grid"));
634 
635  for (unsigned int i = 0; i < n; i++) {
636  double x, y, z, u, v;
637  f >> x >> y >> z >> u >> v;
638  std::cout << x << " " << y << " " << z << " " << u << " " << v << std::endl;
639  ip.set_u(u);
640  ip.set_v(v);
641  addPoint(x, y, z, ip);
642  }
643 
644  f.close();
645  return 0;
646  } else {
647  return -1;
648  }
649 }
666 int vpCalibration::readGrid(const char *filename, unsigned int &n, std::list<double> &oX, std::list<double> &oY,
667  std::list<double> &oZ, bool verbose)
668 {
669  try {
670  std::ifstream f;
671  f.open(filename);
672  if (!f.fail()) {
673 
674  f >> n;
675  if (verbose)
676  std::cout << "There are " << n << " points on the calibration grid " << std::endl;
677  int no_pt;
678  double x, y, z;
679 
680  // clear the list
681  oX.clear();
682  oY.clear();
683  oZ.clear();
684 
685  if (n > 100000)
686  throw(vpException(vpException::badValue, "Bad number of point in the calibration grid"));
687 
688  for (unsigned int i = 0; i < n; i++) {
689  f >> no_pt >> x >> y >> z;
690  if (verbose) {
691  std::cout << no_pt << std::endl;
692  std::cout << x << " " << y << " " << z << std::endl;
693  }
694  oX.push_back(x);
695  oY.push_back(y);
696  oZ.push_back(z);
697  }
698 
699  f.close();
700  } else {
701  return -1;
702  }
703  } catch (...) {
704  return -1;
705  }
706  return 0;
707 }
708 
719 int vpCalibration::displayData(vpImage<unsigned char> &I, vpColor color, unsigned int thickness, int subsampling_factor)
720 {
721 
722  for (std::list<vpImagePoint>::const_iterator it = Lip.begin(); it != Lip.end(); ++it) {
723  vpImagePoint ip = *it;
724  if (subsampling_factor > 1.) {
725  ip.set_u(ip.get_u() / subsampling_factor);
726  ip.set_v(ip.get_v() / subsampling_factor);
727  }
728  vpDisplay::displayCross(I, ip, 12, color, thickness);
729  }
730  return 0;
731 }
732 
743 int vpCalibration::displayGrid(vpImage<unsigned char> &I, vpColor color, unsigned int thickness, int subsampling_factor)
744 {
745  double u0_dist = cam_dist.get_u0() / subsampling_factor;
746  double v0_dist = cam_dist.get_v0() / subsampling_factor;
747  double px_dist = cam_dist.get_px() / subsampling_factor;
748  double py_dist = cam_dist.get_py() / subsampling_factor;
749  double kud_dist = cam_dist.get_kud();
750  // double kdu_dist = cam_dist.get_kdu() ;
751 
752  // double u0 = cam.get_u0() ;
753  // double v0 = cam.get_v0() ;
754  // double px = cam.get_px() ;
755  // double py = cam.get_py() ;
756 
757  std::list<double>::const_iterator it_LoX = LoX.begin();
758  std::list<double>::const_iterator it_LoY = LoY.begin();
759  std::list<double>::const_iterator it_LoZ = LoZ.begin();
760 
761  for (unsigned int i = 0; i < npt; i++) {
762  double oX = *it_LoX;
763  double oY = *it_LoY;
764  double oZ = *it_LoZ;
765 
766  // double cX = oX*cMo[0][0]+oY*cMo[0][1]+oZ*cMo[0][2] + cMo[0][3];
767  // double cY = oX*cMo[1][0]+oY*cMo[1][1]+oZ*cMo[1][2] + cMo[1][3];
768  // double cZ = oX*cMo[2][0]+oY*cMo[2][1]+oZ*cMo[2][2] + cMo[2][3];
769 
770  // double x = cX/cZ ;
771  // double y = cY/cZ ;
772 
773  // double xp = u0 + x*px ;
774  // double yp = v0 + y*py ;
775 
776  // vpDisplay::displayCross(I,(int)vpMath::round(yp),
777  // (int)vpMath::round(xp),
778  // 5,col) ;
779 
780  double cX = oX * cMo_dist[0][0] + oY * cMo_dist[0][1] + oZ * cMo_dist[0][2] + cMo_dist[0][3];
781  double cY = oX * cMo_dist[1][0] + oY * cMo_dist[1][1] + oZ * cMo_dist[1][2] + cMo_dist[1][3];
782  double cZ = oX * cMo_dist[2][0] + oY * cMo_dist[2][1] + oZ * cMo_dist[2][2] + cMo_dist[2][3];
783 
784  double x = cX / cZ;
785  double y = cY / cZ;
786 
787  double r2 = 1 + kud_dist * (vpMath::sqr(x) + vpMath::sqr(y));
788 
789  vpImagePoint ip;
790  ip.set_u(u0_dist + x * px_dist * r2);
791  ip.set_v(v0_dist + y * py_dist * r2);
792 
793  vpDisplay::displayCross(I, ip, 6, color, thickness);
795 
796  // std::cout << oX << " " << oY << " " <<oZ << std::endl ;
797  // I.getClick() ;
798  ++it_LoX;
799  ++it_LoY;
800  ++it_LoZ;
801  }
802  return 0;
803 }
double get_kdu() const
int computeCalibration(vpCalibrationMethodType method, vpHomogeneousMatrix &cMo_est, vpCameraParameters &cam_est, bool verbose=false)
Implementation of an homogeneous matrix and operations on such kind of matrices.
#define vpERROR_TRACE
Definition: vpDebug.h:393
int readData(const char *filename)
Class to define colors available for display functionnalities.
Definition: vpColor.h:120
error that can be emited by ViSP classes.
Definition: vpException.h:71
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.cpp:470
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...
Tools for perspective camera calibration.
Definition: vpCalibration.h:71
virtual ~vpCalibration()
vpHomogeneousMatrix cMo
(as a 3x4 matrix [R T])
Definition: vpCalibration.h:93
Class that defines what is a point.
Definition: vpPoint.h:58
vpCalibration & operator=(const vpCalibration &twinCalibration)
double get_u() const
Definition: vpImagePoint.h:263
int clearPoint()
Suppress all the point in the array of point.
static int computeCalibrationTsai(const std::vector< vpCalibration > &table_cal, vpHomogeneousMatrix &eMc, vpHomogeneousMatrix &eMc_dist)
Compute the multi-image calibration of effector-camera from R. Tsai and R. Lenz . ...
void set_u(const double u)
Definition: vpImagePoint.h:226
static double sqr(double x)
Definition: vpMath.h:108
int displayGrid(vpImage< unsigned char > &I, vpColor color=vpColor::yellow, unsigned int thickness=1, int subsampling_factor=1)
vpHomogeneousMatrix cMo_dist
Definition: vpCalibration.h:95
unsigned int get_npt() const
get the number of points
void set_v(const double v)
Definition: vpImagePoint.h:237
Class used for pose computation from N points (pose from point only). Some of the algorithms implemen...
Definition: vpPose.h:79
Generic class defining intrinsic camera parameters.
vpHomogeneousMatrix eMc_dist
void set_y(const double y)
Set the point y coordinate in the image plane.
Definition: vpPoint.cpp:472
bool computePose(vpPoseMethodType method, vpHomogeneousMatrix &cMo, bool(*func)(vpHomogeneousMatrix *)=NULL)
Definition: vpPose.cpp:362
vpHomogeneousMatrix rMe
reference coordinates (manipulator base coordinates)
double computeStdDeviation_dist(const vpHomogeneousMatrix &cMo, const vpCameraParameters &cam)
static void displayCross(const vpImage< unsigned char > &I, const vpImagePoint &ip, unsigned int size, const vpColor &color, unsigned int thickness=1)
vpCameraParameters cam_dist
projection model with distortion
static void calibrationTsai(const std::vector< vpHomogeneousMatrix > &cMo, const std::vector< vpHomogeneousMatrix > &rMe, vpHomogeneousMatrix &eMc)
calibration method of effector-camera from R. Tsai and R. Lorenz .
int writeData(const char *filename)
vpHomogeneousMatrix eMc
position of the camera in relation to the effector
double get_kud() const
Class that defines a 2D point in an image. This class is useful for image processing and stores only ...
Definition: vpImagePoint.h:88
void computeStdDeviation(double &deviation, double &deviation_dist)
double computeResidual(const vpHomogeneousMatrix &cMo) const
Compute and return the residual expressed in meter for the pose matrix &#39;cMo&#39;.
Definition: vpPose.cpp:324
vpCameraParameters cam
projection model without distortion
Definition: vpCalibration.h:98
static int computeCalibrationMulti(vpCalibrationMethodType method, std::vector< vpCalibration > &table_cal, vpCameraParameters &cam, double &globalReprojectionError, bool verbose=false)
void addPoint(const vpPoint &P)
Definition: vpPose.cpp:137
int displayData(vpImage< unsigned char > &I, vpColor color=vpColor::red, unsigned int thickness=1, int subsampling_factor=1)
double get_v() const
Definition: vpImagePoint.h:274
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 clearPoint()
Definition: vpPose.cpp:122