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-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_camera_calib_H
11 #define mrpt_vision_chessboard_camera_calib_H
12 
13 #include <mrpt/img/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::img::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::img::TPixelCoordf> projectedPoints_distorted;
48  /** At output, like projectedPoints_distorted but for the undistorted image.
49  */
50  std::vector<mrpt::img::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 using TCalibrationImageList = std::map<std::string, TImageCalibData>;
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, mrpt::img::TCamera& out_camera_params,
95  bool normalize_image = true, double* out_MSE = nullptr,
96  bool skipDrawDetectedImgs = false,
97  bool useScaramuzzaAlternativeDetector = false);
98 
99 /** \overload with matrix of intrinsic params instead of mrpt::img::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
mrpt::vision::TImageCalibData::projectedPoints_undistorted
std::vector< mrpt::img::TPixelCoordf > projectedPoints_undistorted
At output, like projectedPoints_distorted but for the undistorted image.
Definition: chessboard_camera_calib.h:50
mrpt::vision::TCalibrationImageList
std::map< std::string, TImageCalibData > TCalibrationImageList
A list of images, used in checkerBoardCameraCalibration.
Definition: chessboard_camera_calib.h:59
CMatrixFixedNumeric.h
mrpt
This is the global namespace for all Mobile Robot Programming Toolkit (MRPT) libraries.
Definition: CKalmanFilterCapable.h:30
mrpt::vision::TImageCalibData
Data associated to each image in the calibration process mrpt::vision::checkerBoardCameraCalibration ...
Definition: chessboard_camera_calib.h:30
mrpt::vision::TImageCalibData::img_original
mrpt::img::CImage img_original
This image will be automatically loaded from the file name passed to checkerBoardCameraCalibration.
Definition: chessboard_camera_calib.h:34
mrpt::vision::TImageCalibData::img_checkboard
mrpt::img::CImage img_checkboard
At output, this will contain the detected checkerboard overprinted to the image.
Definition: chessboard_camera_calib.h:37
mrpt::vision::TImageCalibData::reconstructed_camera_pose
mrpt::poses::CPose3D reconstructed_camera_pose
At output, the reconstructed pose of the camera.
Definition: chessboard_camera_calib.h:43
mrpt::vision::TImageCalibData::detected_corners
std::vector< mrpt::img::TPixelCoordf > detected_corners
At output, the detected corners (x,y) in pixel units.
Definition: chessboard_camera_calib.h:41
mrpt::poses::CPose3D
A class used to store a 3D pose (a 3D translation + a rotation in 3D).
Definition: CPose3D.h:88
mrpt::vision::checkerBoardCameraCalibration
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::img::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...
Definition: checkerboard_cam_calib.cpp:98
mrpt::img::TCamera
Structure to hold the parameters of a pinhole camera model.
Definition: TCamera.h:29
mrpt::vision::TImageCalibData::img_rectified
mrpt::img::CImage img_rectified
At output, this will be the rectified image.
Definition: chessboard_camera_calib.h:39
mrpt::math::CMatrixFixedNumeric< double, 3, 3 >
mrpt::img::CImage
A class for storing images as grayscale or RGB bitmaps.
Definition: img/CImage.h:130
CPose3D.h
mrpt::vision::TImageCalibData::projectedPoints_distorted
std::vector< mrpt::img::TPixelCoordf > projectedPoints_distorted
At output, only will have an empty vector if the checkerboard was not found in this image,...
Definition: chessboard_camera_calib.h:47
CImage.h
types.h
mrpt::vision::TImageCalibData::clear
void clear()
Empty all the data.
Definition: chessboard_camera_calib.h:53



Page generated by Doxygen 1.8.17 for MRPT 1.9.9 Git: ad3a9d8ae Tue May 1 23:10:22 2018 -0700 at miƩ 12 jul 2023 10:03:34 CEST