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-2018, 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/img/CImage.h>
14 #include <mrpt/img/TStereoCamera.h>
15 #include <mrpt/vision/types.h>
17 
18 namespace mrpt::vision
19 {
20 /** \addtogroup chessboard_calib Chessboard calibration
21  * \ingroup mrpt_vision_grp
22  * @{ */
23 
24 /** Data associated to each stereo image in the calibration process
25  * mrpt::vision::checkerBoardCameraCalibration (All the information can be left
26  * empty and will be filled up in the calibration method).
27  */
29 {
31 
32  /** Empty all the data */
33  void clear() { *this = TImageStereoCalibData(); }
34 };
35 
36 /** Params of the optional callback provided by the user */
38 {
39  /** =-1:Processing images; =0: Initial calib without distortion, =1: Calib
40  * of all parameters */
42  size_t current_iter;
43  /** Current root-mean square reprojection error (in pixels) */
44  double current_rmse;
45  /** Info for calibRound==-1 */
47 };
48 
49 /** Prototype of optional user callback function. */
51  void (*)(const TImageStereoCallbackData& d, void* user_data);
52 
53 /** Input parameters for mrpt::vision::checkerBoardStereoCalibration */
55 {
56  /** The number of squares in the checkerboard in the "X" & "Y" direction. */
57  unsigned int check_size_x, check_size_y;
58  /** The size of each square in the checkerboard, in meters, in the "X" & Y"
59  * axes. */
63  /** Show progress messages to std::cout console (default=true) */
64  bool verbose;
65  /** Maximum number of iterations of the optimizer (default=300) */
66  size_t maxIters;
67 
68  /** Select which distortion parameters (of both left/right cameras) will be
69  * optimzed:
70  * k1,k2,k3 are the r^2, r^4 and r^6 radial distorion coeficients, and t1
71  * and t2 are the tangential distortion coeficients (see
72  * mrpt::img::TCamera).
73  * Those set to false will be assumed to be fixed to zero (no distortion).
74  * \note Default values are to only assume distortion via k1 and k2 (the
75  * rest are zeros).
76  */
78 
79  /** Employ a Pseudo-Huber robustifier kernel (Default: false) */
81  /** The parameter of the robust kernel, in pixels (only if
82  * use_robust_kernel=true) (Default=10) */
84 
85  /** If set to !=NULL, this function will be called within each Lev-Marq.
86  * iteration (don't do heavy stuff here since performance will degrade) */
88  /** If using a callback function, you can use this to pass custom data to
89  * your callback. */
91 
92  // Ctor: Set default values
94 };
95 
96 /** Output results for mrpt::vision::checkerBoardStereoCalibration */
98 {
100 
101  /** Recovered parameters of the stereo camera */
103  /** The pose of the left camera as seen from the right camera */
105 
106  /** Poses of the origin of coordinates of the pattern wrt the left camera
107  * (i.e. the origin of coordinates, as seen from the different camera poses)
108  */
110  /** true if a checkerboard was correctly detected in both left/right images.
111  * false if it wasn't, so the image pair didn't make it to the optimization.
112  */
113  std::vector<bool> image_pair_was_used;
114 
115  /** Final reprojection square Root Mean Square Error (in pixels). */
116  double final_rmse;
117  /** Final number of optimization iterations executed. */
118  size_t final_iters;
119  /** Number of image pairs in which valid checkerboards were correctly
120  * detected. */
122 
123  /** The inverse variance (information/precision) of each of the 9 left/right
124  * camera parameters [fx fy cx cy k1 k2 k3 t1 t2].
125  * Those not estimated as indicated in TStereoCalibParams will be zeros
126  * (i.e. an "infinite uncertainty")
127  */
128  Eigen::Array<double, 9, 1> left_params_inv_variance,
130 };
131 
132 /** A list of images, used in checkerBoardStereoCalibration
133  * \sa checkerBoardStereoCalibration
134  */
135 using TCalibrationStereoImageList = std::vector<TImageStereoCalibData>;
136 
137 /** Optimize the calibration parameters of a stereo camera or a RGB+D (Kinect)
138  * camera.
139  * This computes the projection and distortion parameters of each camera, and
140  * their relative spatial pose,
141  * from a sequence of pairs of captured images of a checkerboard.
142  * A custom implementation of an optimizer (Levenberg-Marquartd) seeks for the
143  * set of selected parameters to estimate that minimize the reprojection errors.
144  *
145  * \param input_images [IN/OUT] At input, this list must have one entry for
146  * each image to process. At output the original, detected checkboard and
147  * rectified images can be found here. See TImageCalibData.
148  * \param params [IN] Mandatory: the user must provide the size of the
149  * checkerboard, which parameters to optimize and which to leave fixed to zero,
150  * etc.
151  * \param out_results [OUT] The results of the calibration, and its
152  * uncertainty measure, will be found here upon return.
153  *
154  * \return false on any error (more info will be dumped to cout), or true on
155  * success.
156  * \note See also the ready-to-use application: <a
157  * href="http://www.mrpt.org/list-of-mrpt-apps/application-kinect-calibrate"
158  * >kinect-calibrate</a>
159  * \sa CImage::findChessboardCorners, checkerBoardCameraCalibration,
160  * mrpt::hwdrivers::CKinect
161  */
164  TStereoCalibResults& out_results);
165 
166 /** @} */ // end of grouping
167 }
168 #endif
169 
170 
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).
mrpt::aligned_std_vector< mrpt::poses::CPose3D > left_cam_poses
Poses of the origin of coordinates of the pattern wrt the left camera (i.e.
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.
std::vector< T, mrpt::aligned_allocator_cpp11< T > > aligned_std_vector
double check_squares_length_X_meters
The size of each square in the checkerboard, in meters, in the "X" & Y" axes.
mrpt::img::TStereoCamera cam_params
Recovered parameters of the stereo camera.
Data associated to each image in the calibration process mrpt::vision::checkerBoardCameraCalibration ...
Input parameters for mrpt::vision::checkerBoardStereoCalibration.
Params of the optional callback provided by the user.
Classes for computer vision, detectors, features, etc.
Definition: CCamModel.h:18
void(*)(const TImageStereoCallbackData &d, void *user_data) TSteroCalibCallbackFunctor
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.
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:86
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
Structure to hold the parameters of a pinhole stereo camera model.
Definition: TStereoCamera.h:23
std::vector< TImageStereoCalibData > TCalibrationStereoImageList
A list of images, used in checkerBoardStereoCalibration.



Page generated by Doxygen 1.8.14 for MRPT 1.9.9 Git: 7d5e6d718 Fri Aug 24 01:51:28 2018 +0200 at lun nov 2 08:35:50 CET 2020