Main MRPT website > C++ reference for MRPT 1.9.9
chessboard_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_camera_calib_H
11 #define mrpt_vision_chessboard_camera_calib_H
12 
13 #include <mrpt/utils/CImage.h>
14 #include <mrpt/poses/CPose3D.h>
16 #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 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 {
32  /** This image will be automatically loaded from the file name passed to
33  * checkerBoardCameraCalibration */
35  /** At output, this will contain the detected checkerboard overprinted to
36  * the image. */
38  /** At output, this will be the rectified image */
40  /** At output, the detected corners (x,y) in pixel units. */
41  std::vector<mrpt::utils::TPixelCoordf> detected_corners;
42  /** At output, the reconstructed pose of the camera. */
44  /** At output, only will have an empty vector if the checkerboard was not
45  * found in this image, or the predicted (reprojected) corners, which were
46  * used to estimate the average square error. */
47  std::vector<mrpt::utils::TPixelCoordf> projectedPoints_distorted;
48  /** At output, like projectedPoints_distorted but for the undistorted image.
49  */
50  std::vector<mrpt::utils::TPixelCoordf> projectedPoints_undistorted;
51 
52  /** Empty all the data */
53  void clear() { *this = TImageCalibData(); }
54 };
55 
56 /** A list of images, used in checkerBoardCameraCalibration
57  * \sa checkerBoardCameraCalibration
58  */
59 typedef std::map<std::string, TImageCalibData> TCalibrationImageList;
60 
61 /** Performs a camera calibration (computation of projection and distortion
62  * parameters) from a sequence of captured images of a checkerboard.
63  * \param input_images [IN/OUT] At input, this list must have one entry for
64  * each image to process. At output the original, detected checkboard and
65  * rectified images can be found here. See TImageCalibData.
66  * \param check_size_x [IN] The number of squares in the checkerboard in the X
67  * direction.
68  * \param check_size_y [IN] The number of squares in the checkerboard in the Y
69  * direction.
70  * \param check_squares_length_X_meters [IN] The size of each square in the
71  * checkerboard, in meters, in the X axis.
72  * \param check_squares_length_Y_meters [IN] This will typically be equal to
73  * check_squares_length_X_meters.
74  * \param intrinsicParams [OUT] The 3x3 intrinsic parameters matrix. See
75  * http://www.mrpt.org/Camera_Parameters
76  * \param distortionParams [OUT] The 1x4 vector of distortion parameters: k1 k2
77  * p1 p2. See http://www.mrpt.org/Camera_Parameters
78  * \param normalize_image [IN] Select OpenCV flag
79  * \param out_MSE [OUT] If set to !=nullptr, the mean square error of the
80  * reprojection will be stored here (in pixel units).
81  * \param skipDrawDetectedImgs [IN] Whether to skip the generation of the
82  * undistorted and detected images in each TImageCalibData
83  * \param useScaramuzzaAlternativeDetector [IN] Whether to use an alternative
84  * detector. See CImage::findChessboardCorners for more deatails and references.
85  * \sa The <a href="http://www.mrpt.org/Application:camera-calib-gui"
86  * >camera-calib-gui application</a> is a user-friendly GUI to this class.
87  * \return false on any error (more info will be dumped to cout), or true on
88  * success.
89  * \sa CImage::findChessboardCorners, checkerBoardStereoCalibration
90  */
92  TCalibrationImageList& images, unsigned int check_size_x,
93  unsigned int check_size_y, double check_squares_length_X_meters,
94  double check_squares_length_Y_meters,
95  mrpt::utils::TCamera& out_camera_params, bool normalize_image = true,
96  double* out_MSE = nullptr, bool skipDrawDetectedImgs = false,
97  bool useScaramuzzaAlternativeDetector = false);
98 
99 /** \overload with matrix of intrinsic params instead of mrpt::utils::TCamera
100  */
102  TCalibrationImageList& images, unsigned int check_size_x,
103  unsigned int check_size_y, double check_squares_length_X_meters,
104  double check_squares_length_Y_meters,
105  mrpt::math::CMatrixDouble33& intrinsicParams,
106  std::vector<double>& distortionParams, bool normalize_image = true,
107  double* out_MSE = nullptr, bool skipDrawDetectedImgs = false,
108  bool useScaramuzzaAlternativeDetector = false);
109 
110 /** @} */ // end of grouping
111 }
112 }
113 
114 #endif
void clear()
Empty all the data.
mrpt::utils::CImage img_original
This image will be automatically loaded from the file name passed to checkerBoardCameraCalibration.
A class for storing images as grayscale or RGB bitmaps.
Definition: CImage.h:118
std::vector< mrpt::utils::TPixelCoordf > detected_corners
At output, the detected corners (x,y) in pixel units.
std::vector< mrpt::utils::TPixelCoordf > projectedPoints_undistorted
At output, like projectedPoints_distorted but for the undistorted image.
Data associated to each image in the calibration process mrpt::vision::checkerBoardCameraCalibration ...
mrpt::utils::CImage img_checkboard
At output, this will contain the detected checkerboard overprinted to the image.
bool checkerBoardCameraCalibration(TCalibrationImageList &images, unsigned int check_size_x, unsigned int check_size_y, double check_squares_length_X_meters, double check_squares_length_Y_meters, mrpt::utils::TCamera &out_camera_params, bool normalize_image=true, double *out_MSE=nullptr, bool skipDrawDetectedImgs=false, bool useScaramuzzaAlternativeDetector=false)
Performs a camera calibration (computation of projection and distortion parameters) from a sequence o...
std::vector< mrpt::utils::TPixelCoordf > projectedPoints_distorted
At output, only will have an empty vector if the checkerboard was not found in this image...
This is the global namespace for all Mobile Robot Programming Toolkit (MRPT) libraries.
A class used to store a 3D pose (a 3D translation + a rotation in 3D).
Definition: CPose3D.h:88
mrpt::utils::CImage img_rectified
At output, this will be the rectified image.
std::map< std::string, TImageCalibData > TCalibrationImageList
A list of images, used in checkerBoardCameraCalibration.
mrpt::poses::CPose3D reconstructed_camera_pose
At output, the reconstructed pose of the camera.
Structure to hold the parameters of a pinhole camera model.
Definition: TCamera.h:32



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