Main MRPT website > C++ reference
MRPT logo
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-2014, 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  using namespace mrpt::utils;
24 
25  /** \addtogroup chessboard_calib Chessboard calibration
26  * \ingroup mrpt_vision_grp
27  * @{ */
28 
29  /** 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).
30  */
32  {
33  CImage img_original; //!< This image will be automatically loaded from the file name passed to checkerBoardCameraCalibration
34  CImage img_checkboard; //!< At output, this will contain the detected checkerboard overprinted to the image.
35  CImage img_rectified; //!< At output, this will be the rectified image
36  std::vector<mrpt::utils::TPixelCoordf> detected_corners; //!< At output, the detected corners (x,y) in pixel units.
37  mrpt::poses::CPose3D reconstructed_camera_pose; //!< At output, the reconstructed pose of the camera.
38  std::vector<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.
39  std::vector<TPixelCoordf> projectedPoints_undistorted; //!< At output, like projectedPoints_distorted but for the undistorted image.
40 
41  /** Empty all the data */
42  void clear() { *this = TImageCalibData(); }
43  };
44 
45  /** A list of images, used in checkerBoardCameraCalibration
46  * \sa checkerBoardCameraCalibration
47  */
48  typedef std::map<std::string,TImageCalibData> TCalibrationImageList;
49 
50  /** Performs a camera calibration (computation of projection and distortion parameters) from a sequence of captured images of a checkerboard.
51  * \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.
52  * \param check_size_x [IN] The number of squares in the checkerboard in the X direction.
53  * \param check_size_y [IN] The number of squares in the checkerboard in the Y direction.
54  * \param check_squares_length_X_meters [IN] The size of each square in the checkerboard, in meters, in the X axis.
55  * \param check_squares_length_Y_meters [IN] This will typically be equal to check_squares_length_X_meters.
56  * \param intrinsicParams [OUT] The 3x3 intrinsic parameters matrix. See http://www.mrpt.org/Camera_Parameters
57  * \param distortionParams [OUT] The 1x4 vector of distortion parameters: k1 k2 p1 p2. See http://www.mrpt.org/Camera_Parameters
58  * \param normalize_image [IN] Select OpenCV flag
59  * \param out_MSE [OUT] If set to !=NULL, the mean square error of the reprojection will be stored here (in pixel units).
60  * \param skipDrawDetectedImgs [IN] Whether to skip the generation of the undistorted and detected images in each TImageCalibData
61  * \param useScaramuzzaAlternativeDetector [IN] Whether to use an alternative detector. See CImage::findChessboardCorners for more deatails and references.
62  * \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.
63  * \return false on any error (more info will be dumped to cout), or true on success.
64  * \sa CImage::findChessboardCorners, checkerBoardStereoCalibration
65  */
67  TCalibrationImageList &images,
68  unsigned int check_size_x,
69  unsigned int check_size_y,
70  double check_squares_length_X_meters,
71  double check_squares_length_Y_meters,
72  mrpt::utils::TCamera &out_camera_params,
73  bool normalize_image = true,
74  double *out_MSE = NULL,
75  bool skipDrawDetectedImgs = false,
76  bool useScaramuzzaAlternativeDetector = false
77  );
78 
79  /** Performs a camera calibration (computation of projection and distortion parameters) from a sequence of captured images of a checkerboard.
80  * \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.
81  * \param check_size_x [IN] The number of squares in the checkerboard in the X direction.
82  * \param check_size_y [IN] The number of squares in the checkerboard in the Y direction.
83  * \param check_squares_length_X_meters [IN] The size of each square in the checkerboard, in meters, in the X axis.
84  * \param check_squares_length_Y_meters [IN] This will typically be equal to check_squares_length_X_meters.
85  * \param intrinsicParams [OUT] The 3x3 intrinsic parameters matrix. See http://www.mrpt.org/Camera_Parameters
86  * \param distortionParams [OUT] The 1x4 vector of distortion parameters: k1 k2 p1 p2. See http://www.mrpt.org/Camera_Parameters
87  * \param normalize_image [IN] Select OpenCV flag
88  * \param out_MSE [OUT] If set to !=NULL, the mean square error of the reprojection will be stored here (in pixel units).
89  * \param skipDrawDetectedImgs [IN] Whether to skip the generation of the undistorted and detected images in each TImageCalibData
90  * \param useScaramuzzaAlternativeDetector [IN] Whether to use an alternative detector. See CImage::findChessboardCorners for more deatails and references.
91  * \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.
92  * \return false on any error (more info will be dumped to cout), or true on success.
93  * \sa CImage::findChessboardCorners
94  */
96  TCalibrationImageList &images,
97  unsigned int check_size_x,
98  unsigned int check_size_y,
99  double check_squares_length_X_meters,
100  double check_squares_length_Y_meters,
101  mrpt::math::CMatrixDouble33 &intrinsicParams,
102  std::vector<double> &distortionParams,
103  bool normalize_image = true,
104  double *out_MSE = NULL,
105  bool skipDrawDetectedImgs = false,
106  bool useScaramuzzaAlternativeDetector = false
107  );
108 
109  /** @} */ // end of grouping
110 
111  }
112 }
113 
114 
115 #endif
void clear()
Empty all the data.
Classes for serialization, sockets, ini-file manipulation, streams, list of properties-values, timewatch, extensions to STL.
Definition: zip.h:16
A class for storing images as grayscale or RGB bitmaps.
Definition: CImage.h:97
CImage img_rectified
At output, this will be the rectified image.
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...
Data associated to each image in the calibration process mrpt::vision::checkerBoardCameraCalibration ...
A numeric matrix of compile-time fixed size.
std::vector< 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.
std::vector< TPixelCoordf > projectedPoints_undistorted
At output, like projectedPoints_distorted but for the undistorted 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:69
CImage img_original
This image will be automatically loaded from the file name passed to checkerBoardCameraCalibration.
mrpt::poses::CPose3D reconstructed_camera_pose
At output, the reconstructed pose of the camera.
CImage img_checkboard
At output, this will contain the detected checkerboard overprinted to the image.
Structure to hold the parameters of a pinhole camera model.
Definition: TCamera.h:31



Page generated by Doxygen 1.8.8 for MRPT 1.2.2 SVN:Unversioned directory at Tue Oct 14 02:14:08 UTC 2014