Main MRPT website > C++ reference for MRPT 1.5.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>
18 
19 namespace mrpt
20 {
21  namespace vision
22  {
23  /** \addtogroup chessboard_calib Chessboard calibration
24  * \ingroup mrpt_vision_grp
25  * @{ */
26 
27  /** Data associated to each 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  {
31  mrpt::utils::CImage img_original; //!< This image will be automatically loaded from the file name passed to checkerBoardCameraCalibration
32  mrpt::utils::CImage img_checkboard; //!< At output, this will contain the detected checkerboard overprinted to the image.
33  mrpt::utils::CImage img_rectified; //!< At output, this will be the rectified image
34  std::vector<mrpt::utils::TPixelCoordf> detected_corners; //!< At output, the detected corners (x,y) in pixel units.
35  mrpt::poses::CPose3D reconstructed_camera_pose; //!< At output, the reconstructed pose of the camera.
36  std::vector<mrpt::utils::TPixelCoordf> projectedPoints_distorted; //!< At output, only will have an empty vector if the checkerboard was not found in this image, or the predicted (reprojected) corners, which were used to estimate the average square error.
37  std::vector<mrpt::utils::TPixelCoordf> projectedPoints_undistorted; //!< At output, like projectedPoints_distorted but for the undistorted image.
38 
39  /** Empty all the data */
40  void clear() { *this = TImageCalibData(); }
41  };
42 
43  /** A list of images, used in checkerBoardCameraCalibration
44  * \sa checkerBoardCameraCalibration
45  */
46  typedef std::map<std::string,TImageCalibData> TCalibrationImageList;
47 
48  /** Performs a camera calibration (computation of projection and distortion parameters) from a sequence of captured images of a checkerboard.
49  * \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.
50  * \param check_size_x [IN] The number of squares in the checkerboard in the X direction.
51  * \param check_size_y [IN] The number of squares in the checkerboard in the Y direction.
52  * \param check_squares_length_X_meters [IN] The size of each square in the checkerboard, in meters, in the X axis.
53  * \param check_squares_length_Y_meters [IN] This will typically be equal to check_squares_length_X_meters.
54  * \param intrinsicParams [OUT] The 3x3 intrinsic parameters matrix. See http://www.mrpt.org/Camera_Parameters
55  * \param distortionParams [OUT] The 1x4 vector of distortion parameters: k1 k2 p1 p2. See http://www.mrpt.org/Camera_Parameters
56  * \param normalize_image [IN] Select OpenCV flag
57  * \param out_MSE [OUT] If set to !=NULL, the mean square error of the reprojection will be stored here (in pixel units).
58  * \param skipDrawDetectedImgs [IN] Whether to skip the generation of the undistorted and detected images in each TImageCalibData
59  * \param useScaramuzzaAlternativeDetector [IN] Whether to use an alternative detector. See CImage::findChessboardCorners for more deatails and references.
60  * \sa The <a href="http://www.mrpt.org/Application:camera-calib-gui" >camera-calib-gui application</a> is a user-friendly GUI to this class.
61  * \return false on any error (more info will be dumped to cout), or true on success.
62  * \sa CImage::findChessboardCorners, checkerBoardStereoCalibration
63  */
65  TCalibrationImageList &images,
66  unsigned int check_size_x,
67  unsigned int check_size_y,
68  double check_squares_length_X_meters,
69  double check_squares_length_Y_meters,
70  mrpt::utils::TCamera &out_camera_params,
71  bool normalize_image = true,
72  double *out_MSE = NULL,
73  bool skipDrawDetectedImgs = false,
74  bool useScaramuzzaAlternativeDetector = false
75  );
76 
77  /** Performs a camera calibration (computation of projection and distortion parameters) from a sequence of captured images of a checkerboard.
78  * \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.
79  * \param check_size_x [IN] The number of squares in the checkerboard in the X direction.
80  * \param check_size_y [IN] The number of squares in the checkerboard in the Y direction.
81  * \param check_squares_length_X_meters [IN] The size of each square in the checkerboard, in meters, in the X axis.
82  * \param check_squares_length_Y_meters [IN] This will typically be equal to check_squares_length_X_meters.
83  * \param intrinsicParams [OUT] The 3x3 intrinsic parameters matrix. See http://www.mrpt.org/Camera_Parameters
84  * \param distortionParams [OUT] The 1x4 vector of distortion parameters: k1 k2 p1 p2. See http://www.mrpt.org/Camera_Parameters
85  * \param normalize_image [IN] Select OpenCV flag
86  * \param out_MSE [OUT] If set to !=NULL, the mean square error of the reprojection will be stored here (in pixel units).
87  * \param skipDrawDetectedImgs [IN] Whether to skip the generation of the undistorted and detected images in each TImageCalibData
88  * \param useScaramuzzaAlternativeDetector [IN] Whether to use an alternative detector. See CImage::findChessboardCorners for more deatails and references.
89  * \sa The <a href="http://www.mrpt.org/Application:camera-calib-gui" >camera-calib-gui application</a> is a user-friendly GUI to this class.
90  * \return false on any error (more info will be dumped to cout), or true on success.
91  * \sa CImage::findChessboardCorners
92  */
94  TCalibrationImageList &images,
95  unsigned int check_size_x,
96  unsigned int check_size_y,
97  double check_squares_length_X_meters,
98  double check_squares_length_Y_meters,
99  mrpt::math::CMatrixDouble33 &intrinsicParams,
100  std::vector<double> &distortionParams,
101  bool normalize_image = true,
102  double *out_MSE = NULL,
103  bool skipDrawDetectedImgs = false,
104  bool useScaramuzzaAlternativeDetector = false
105  );
106 
107  /** @} */ // end of grouping
108 
109  }
110 }
111 
112 
113 #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:101
std::vector< mrpt::utils::TPixelCoordf > detected_corners
At output, the detected corners (x,y) in pixel units.
bool VISION_IMPEXP 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=NULL, 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_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.
std::vector< mrpt::utils::TPixelCoordf > projectedPoints_distorted
At output, only will have an empty vector if the checkerboard was not found in this image...
std::map< std::string, TImageCalibData > TCalibrationImageList
A list of images, used in checkerBoardCameraCalibration.
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:72
mrpt::utils::CImage img_rectified
At output, this will be the rectified image.
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:31



Page generated by Doxygen 1.8.14 for MRPT 1.5.9 Git: 690a4699f Wed Apr 15 19:29:53 2020 +0200 at miƩ abr 15 19:30:12 CEST 2020