Main MRPT website > C++ reference for MRPT 1.9.9
chessboard_stereo_camera_calib.h
Go to the documentation of this file.
1 /* +------------------------------------------------------------------------+
2  | Mobile Robot Programming Toolkit (MRPT) |
3  | http://www.mrpt.org/ |
4  | |
5  | Copyright (c) 2005-2017, Individual contributors, see AUTHORS file |
6  | See: http://www.mrpt.org/Authors - All rights reserved. |
7  | Released under BSD License. See details in http://www.mrpt.org/License |
8  +------------------------------------------------------------------------+ */
9 
10 #ifndef mrpt_vision_chessboard_stereo_calib_H
11 #define mrpt_vision_chessboard_stereo_calib_H
12 
13 #include <mrpt/utils/CImage.h>
15 #include <mrpt/vision/types.h>
17 
18 namespace mrpt
19 {
20 namespace vision
21 {
22 /** \addtogroup chessboard_calib Chessboard calibration
23  * \ingroup mrpt_vision_grp
24  * @{ */
25 
26 /** Data associated to each stereo image in the calibration process
27  * mrpt::vision::checkerBoardCameraCalibration (All the information can be left
28  * empty and will be filled up in the calibration method).
29  */
31 {
33 
34  /** Empty all the data */
35  void clear() { *this = TImageStereoCalibData(); }
36 };
37 
38 /** Params of the optional callback provided by the user */
40 {
41  /** =-1:Processing images; =0: Initial calib without distortion, =1: Calib
42  * of all parameters */
44  size_t current_iter;
45  /** Current root-mean square reprojection error (in pixels) */
46  double current_rmse;
47  /** Info for calibRound==-1 */
49 };
50 
51 /** Prototype of optional user callback function. */
53  const TImageStereoCallbackData& d, void* user_data);
54 
55 /** Input parameters for mrpt::vision::checkerBoardStereoCalibration */
57 {
58  /** The number of squares in the checkerboard in the "X" & "Y" direction. */
59  unsigned int check_size_x, check_size_y;
60  /** The size of each square in the checkerboard, in meters, in the "X" & Y"
61  * axes. */
65  /** Show progress messages to std::cout console (default=true) */
66  bool verbose;
67  /** Maximum number of iterations of the optimizer (default=300) */
68  size_t maxIters;
69 
70  /** Select which distortion parameters (of both left/right cameras) will be
71  * optimzed:
72  * k1,k2,k3 are the r^2, r^4 and r^6 radial distorion coeficients, and t1
73  * and t2 are the tangential distortion coeficients (see
74  * mrpt::utils::TCamera).
75  * Those set to false will be assumed to be fixed to zero (no distortion).
76  * \note Default values are to only assume distortion via k1 and k2 (the
77  * rest are zeros).
78  */
80 
81  /** Employ a Pseudo-Huber robustifier kernel (Default: false) */
83  /** The parameter of the robust kernel, in pixels (only if
84  * use_robust_kernel=true) (Default=10) */
86 
87  /** If set to !=NULL, this function will be called within each Lev-Marq.
88  * iteration (don't do heavy stuff here since performance will degrade) */
90  /** If using a callback function, you can use this to pass custom data to
91  * your callback. */
93 
94  // Ctor: Set default values
96 };
97 
98 /** Output results for mrpt::vision::checkerBoardStereoCalibration */
100 {
102 
103  /** Recovered parameters of the stereo camera */
105  /** The pose of the left camera as seen from the right camera */
107 
108  /** Poses of the origin of coordinates of the pattern wrt the left camera
109  * (i.e. the origin of coordinates, as seen from the different camera poses)
110  */
112  /** true if a checkerboard was correctly detected in both left/right images.
113  * false if it wasn't, so the image pair didn't make it to the optimization.
114  */
115  std::vector<bool> image_pair_was_used;
116 
117  /** Final reprojection square Root Mean Square Error (in pixels). */
118  double final_rmse;
119  /** Final number of optimization iterations executed. */
120  size_t final_iters;
121  /** Number of image pairs in which valid checkerboards were correctly
122  * detected. */
124 
125  /** The inverse variance (information/precision) of each of the 9 left/right
126  * camera parameters [fx fy cx cy k1 k2 k3 t1 t2].
127  * Those not estimated as indicated in TStereoCalibParams will be zeros
128  * (i.e. an "infinite uncertainty")
129  */
130  Eigen::Array<double, 9, 1> left_params_inv_variance,
132 };
133 
134 /** A list of images, used in checkerBoardStereoCalibration
135  * \sa checkerBoardStereoCalibration
136  */
137 typedef std::vector<TImageStereoCalibData> TCalibrationStereoImageList;
138 
139 /** Optimize the calibration parameters of a stereo camera or a RGB+D (Kinect)
140  * camera.
141  * This computes the projection and distortion parameters of each camera, and
142  * their relative spatial pose,
143  * from a sequence of pairs of captured images of a checkerboard.
144  * A custom implementation of an optimizer (Levenberg-Marquartd) seeks for the
145  * set of selected parameters to estimate that minimize the reprojection errors.
146  *
147  * \param input_images [IN/OUT] At input, this list must have one entry for
148  * each image to process. At output the original, detected checkboard and
149  * rectified images can be found here. See TImageCalibData.
150  * \param params [IN] Mandatory: the user must provide the size of the
151  * checkerboard, which parameters to optimize and which to leave fixed to zero,
152  * etc.
153  * \param out_results [OUT] The results of the calibration, and its
154  * uncertainty measure, will be found here upon return.
155  *
156  * \return false on any error (more info will be dumped to cout), or true on
157  * success.
158  * \note See also the ready-to-use application: <a
159  * href="http://www.mrpt.org/list-of-mrpt-apps/application-kinect-calibrate"
160  * >kinect-calibrate</a>
161  * \sa CImage::findChessboardCorners, checkerBoardCameraCalibration,
162  * mrpt::hwdrivers::CKinect
163  */
166  TStereoCalibResults& out_results);
167 
168 /** @} */ // end of grouping
169 }
170 }
171 
172 #endif
bool optimize_k1
Select which distortion parameters (of both left/right cameras) will be optimzed: k1...
double final_rmse
Final reprojection square Root Mean Square Error (in pixels).
std::vector< TImageStereoCalibData > TCalibrationStereoImageList
A list of images, used in checkerBoardStereoCalibration.
mrpt::utils::TStereoCamera cam_params
Recovered parameters of the stereo camera.
std::vector< bool > image_pair_was_used
true if a checkerboard was correctly detected in both left/right images.
void * callback_user_param
If using a callback function, you can use this to pass custom data to your callback.
Eigen::Array< double, 9, 1 > left_params_inv_variance
The inverse variance (information/precision) of each of the 9 left/right camera parameters [fx fy cx ...
size_t final_number_good_image_pairs
Number of image pairs in which valid checkerboards were correctly detected.
Data associated to each stereo image in the calibration process mrpt::vision::checkerBoardCameraCalib...
size_t maxIters
Maximum number of iterations of the optimizer (default=300)
size_t final_iters
Final number of optimization iterations executed.
TSteroCalibCallbackFunctor callback
If set to !=NULL, this function will be called within each Lev-Marq.
double check_squares_length_X_meters
The size of each square in the checkerboard, in meters, in the "X" & Y" axes.
Structure to hold the parameters of a pinhole stereo camera model.
Definition: TStereoCamera.h:25
Data associated to each image in the calibration process mrpt::vision::checkerBoardCameraCalibration ...
Input parameters for mrpt::vision::checkerBoardStereoCalibration.
mrpt::aligned_containers< mrpt::poses::CPose3D >::vector_t left_cam_poses
Poses of the origin of coordinates of the pattern wrt the left camera (i.e.
Params of the optional callback provided by the user.
void(* TSteroCalibCallbackFunctor)(const TImageStereoCallbackData &d, void *user_data)
Prototype of optional user callback function.
unsigned int check_size_x
The number of squares in the checkerboard in the "X" & "Y" direction.
bool checkerBoardStereoCalibration(TCalibrationStereoImageList &images, const TStereoCalibParams &params, TStereoCalibResults &out_results)
Optimize the calibration parameters of a stereo camera or a RGB+D (Kinect) camera.
This is the global namespace for all Mobile Robot Programming Toolkit (MRPT) libraries.
double current_rmse
Current root-mean square reprojection error (in pixels)
unsigned int nImgsProcessed
Info for calibRound==-1.
A class used to store a 3D pose (a 3D translation + a rotation in 3D).
Definition: CPose3D.h:88
mrpt::poses::CPose3D right2left_camera_pose
The pose of the left camera as seen from the right camera.
typedef void(APIENTRYP PFNGLBLENDCOLORPROC)(GLclampf red
bool use_robust_kernel
Employ a Pseudo-Huber robustifier kernel (Default: false)
bool verbose
Show progress messages to std::cout console (default=true)
double robust_kernel_param
The parameter of the robust kernel, in pixels (only if use_robust_kernel=true) (Default=10) ...
Output results for mrpt::vision::checkerBoardStereoCalibration.
int calibRound
=-1:Processing images; =0: Initial calib without distortion, =1: Calib of all parameters ...
Eigen::Array< double, 9, 1 > right_params_inv_variance
GLenum const GLfloat * params
Definition: glext.h:3534
std::vector< TYPE1, Eigen::aligned_allocator< TYPE1 > > vector_t



Page generated by Doxygen 1.8.14 for MRPT 1.9.9 Git: ae4571287 Thu Nov 23 00:06:53 2017 +0100 at dom oct 27 23:51:55 CET 2019