Main MRPT website > C++ reference for MRPT 1.4.0
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-2016, 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>
18
19namespace mrpt
20{
21 namespace vision
22 {
23 /** \addtogroup chessboard_calib Chessboard calibration
24 * \ingroup mrpt_vision_grp
25 * @{ */
26
27 /** Data associated to each stereo image in the calibration process mrpt::vision::checkerBoardCameraCalibration (All the information can be left empty and will be filled up in the calibration method).
28 */
30 {
32
33 /** Empty all the data */
34 void clear() { *this = TImageStereoCalibData(); }
35 };
36
37 /** Params of the optional callback provided by the user */
39 {
40 int calibRound; //!< =-1:Processing images; =0: Initial calib without distortion, =1: Calib of all parameters
42 double current_rmse; //!< Current root-mean square reprojection error (in pixels)
43 unsigned int nImgsProcessed, nImgsToProcess; //!< Info for calibRound==-1
44 };
45
46 /** Prototype of optional user callback function. */
47 typedef void (*TSteroCalibCallbackFunctor)(const TImageStereoCallbackData &d, void* user_data);
48
49
50 /** Input parameters for mrpt::vision::checkerBoardStereoCalibration */
52 {
53 unsigned int check_size_x,check_size_y; //!< The number of squares in the checkerboard in the "X" & "Y" direction.
54 double check_squares_length_X_meters,check_squares_length_Y_meters; //!< The size of each square in the checkerboard, in meters, in the "X" & "Y" axes.
57 bool verbose; //!< Show progress messages to std::cout console (default=true)
58 size_t maxIters; //!< Maximum number of iterations of the optimizer (default=300)
59
60 /** Select which distortion parameters (of both left/right cameras) will be optimzed:
61 * k1,k2,k3 are the r^2, r^4 and r^6 radial distorion coeficients, and t1 and t2 are the tangential distortion coeficients (see mrpt::utils::TCamera).
62 * Those set to false will be assumed to be fixed to zero (no distortion).
63 * \note Default values are to only assume distortion via k1 and k2 (the rest are zeros).
64 */
65 bool optimize_k1, optimize_k2, optimize_k3, optimize_t1, optimize_t2;
66
67 bool use_robust_kernel; //!< Employ a Pseudo-Huber robustifier kernel (Default: false)
68 double robust_kernel_param; //!< The parameter of the robust kernel, in pixels (only if use_robust_kernel=true) (Default=10)
69
70
71 TSteroCalibCallbackFunctor callback; //!< If set to !=NULL, this function will be called within each Lev-Marq. iteration (don't do heavy stuff here since performance will degrade)
72 void * callback_user_param; //!< If using a callback function, you can use this to pass custom data to your callback.
73
74 // Ctor: Set default values
76 };
77
78 /** Output results for mrpt::vision::checkerBoardStereoCalibration */
80 {
82
83 mrpt::utils::TStereoCamera cam_params; //!< Recovered parameters of the stereo camera
84 mrpt::poses::CPose3D right2left_camera_pose; //!< The pose of the left camera as seen from the right camera
85
86 /** Poses of the origin of coordinates of the pattern wrt the left camera (i.e. the origin of coordinates, as seen from the different camera poses)
87 */
89 std::vector<bool> image_pair_was_used; //!< true if a checkerboard was correctly detected in both left/right images. false if it wasn't, so the image pair didn't make it to the optimization.
90
91 double final_rmse; //!< Final reprojection square Root Mean Square Error (in pixels).
92 size_t final_iters; //!< Final number of optimization iterations executed.
93 size_t final_number_good_image_pairs; //!< Number of image pairs in which valid checkerboards were correctly detected.
94
95 /** The inverse variance (information/precision) of each of the 9 left/right camera parameters [fx fy cx cy k1 k2 k3 t1 t2].
96 * Those not estimated as indicated in TStereoCalibParams will be zeros (i.e. an "infinite uncertainty")
97 */
98 Eigen::Array<double,9,1> left_params_inv_variance, right_params_inv_variance;
99 };
100
101 /** A list of images, used in checkerBoardStereoCalibration
102 * \sa checkerBoardStereoCalibration
103 */
104 typedef std::vector<TImageStereoCalibData> TCalibrationStereoImageList;
105
106 /** Optimize the calibration parameters of a stereo camera or a RGB+D (Kinect) camera.
107 * This computes the projection and distortion parameters of each camera, and their relative spatial pose,
108 * from a sequence of pairs of captured images of a checkerboard.
109 * A custom implementation of an optimizer (Levenberg-Marquartd) seeks for the set of selected parameters to estimate that minimize the reprojection errors.
110 *
111 * \param input_images [IN/OUT] At input, this list must have one entry for each image to process. At output the original, detected checkboard and rectified images can be found here. See TImageCalibData.
112 * \param params [IN] Mandatory: the user must provide the size of the checkerboard, which parameters to optimize and which to leave fixed to zero, etc.
113 * \param out_results [OUT] The results of the calibration, and its uncertainty measure, will be found here upon return.
114 *
115 * \return false on any error (more info will be dumped to cout), or true on success.
116 * \note See also the ready-to-use application: <a href="http://www.mrpt.org/Application:kinect-calibrate" >kinect-calibrate</a>
117 * \sa CImage::findChessboardCorners, checkerBoardCameraCalibration, mrpt::hwdrivers::CKinect
118 */
121 const TStereoCalibParams & params,
122 TStereoCalibResults & out_results
123 );
124
125 /** @} */ // end of grouping
126
127 }
128}
129
130
131#endif
A class used to store a 3D pose (a 3D translation + a rotation in 3D).
Definition: CPose3D.h:73
Structure to hold the parameters of a pinhole stereo camera model.
Definition: TStereoCamera.h:26
bool VISION_IMPEXP checkerBoardStereoCalibration(TCalibrationStereoImageList &images, const TStereoCalibParams &params, TStereoCalibResults &out_results)
Optimize the calibration parameters of a stereo camera or a RGB+D (Kinect) camera.
void(* TSteroCalibCallbackFunctor)(const TImageStereoCallbackData &d, void *user_data)
Prototype of optional user callback function.
std::vector< TImageStereoCalibData > TCalibrationStereoImageList
A list of images, used in checkerBoardStereoCalibration.
This is the global namespace for all Mobile Robot Programming Toolkit (MRPT) libraries.
std::vector< TYPE1, Eigen::aligned_allocator< TYPE1 > > vector_t
Data associated to each image in the calibration process mrpt::vision::checkerBoardCameraCalibration ...
Data associated to each stereo image in the calibration process mrpt::vision::checkerBoardCameraCalib...
Params of the optional callback provided by the user.
int calibRound
=-1:Processing images; =0: Initial calib without distortion, =1: Calib of all parameters
double current_rmse
Current root-mean square reprojection error (in pixels)
Input parameters for mrpt::vision::checkerBoardStereoCalibration.
TSteroCalibCallbackFunctor callback
If set to !=NULL, this function will be called within each Lev-Marq. iteration (don't do heavy stuff ...
void * callback_user_param
If using a callback function, you can use this to pass custom data to your callback.
size_t maxIters
Maximum number of iterations of the optimizer (default=300)
double robust_kernel_param
The parameter of the robust kernel, in pixels (only if use_robust_kernel=true) (Default=10)
bool use_robust_kernel
Employ a Pseudo-Huber robustifier kernel (Default: false)
bool verbose
Show progress messages to std::cout console (default=true)
bool optimize_k1
Select which distortion parameters (of both left/right cameras) will be optimzed: k1,...
Output results for mrpt::vision::checkerBoardStereoCalibration.
std::vector< bool > image_pair_was_used
true if a checkerboard was correctly detected in both left/right images. false if it wasn't,...
size_t final_iters
Final number of optimization iterations executed.
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 ...
mrpt::poses::CPose3D right2left_camera_pose
The pose of the left camera as seen from the right camera.
double final_rmse
Final reprojection square Root Mean Square Error (in pixels).
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.
mrpt::utils::TStereoCamera cam_params
Recovered parameters of the stereo camera.
size_t final_number_good_image_pairs
Number of image pairs in which valid checkerboards were correctly detected.



Page generated by Doxygen 1.9.2 for MRPT 1.4.0 SVN: at Mon Sep 20 00:47:55 UTC 2021