00001 /* +---------------------------------------------------------------------------+ 00002 | The Mobile Robot Programming Toolkit (MRPT) C++ library | 00003 | | 00004 | http://www.mrpt.org/ | 00005 | | 00006 | Copyright (C) 2005-2011 University of Malaga | 00007 | | 00008 | This software was written by the Machine Perception and Intelligent | 00009 | Robotics Lab, University of Malaga (Spain). | 00010 | Contact: Jose-Luis Blanco <jlblanco@ctima.uma.es> | 00011 | | 00012 | This file is part of the MRPT project. | 00013 | | 00014 | MRPT is free software: you can redistribute it and/or modify | 00015 | it under the terms of the GNU General Public License as published by | 00016 | the Free Software Foundation, either version 3 of the License, or | 00017 | (at your option) any later version. | 00018 | | 00019 | MRPT is distributed in the hope that it will be useful, | 00020 | but WITHOUT ANY WARRANTY; without even the implied warranty of | 00021 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | 00022 | GNU General Public License for more details. | 00023 | | 00024 | You should have received a copy of the GNU General Public License | 00025 | along with MRPT. If not, see <http://www.gnu.org/licenses/>. | 00026 | | 00027 +---------------------------------------------------------------------------+ */ 00028 00029 #ifndef mrpt_vision_chessboard_camera_calib_H 00030 #define mrpt_vision_chessboard_camera_calib_H 00031 00032 #include <mrpt/utils/CImage.h> 00033 00034 #include <mrpt/vision/types.h> 00035 00036 #include <mrpt/vision/link_pragmas.h> 00037 00038 namespace mrpt 00039 { 00040 namespace vision 00041 { 00042 using namespace mrpt::utils; 00043 00044 /** \addtogroup chessboard_calib Chessboard calibration 00045 * \ingroup mrpt_vision_grp 00046 * @{ */ 00047 00048 /** 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). 00049 */ 00050 struct VISION_IMPEXP TImageCalibData 00051 { 00052 CImage img_original; //!< This image will be automatically loaded from the file name passed to checkerBoardCameraCalibration 00053 CImage img_checkboard; //!< At output, this will contain the detected checkerboard overprinted to the image. 00054 CImage img_rectified; //!< At output, this will be the rectified image 00055 std::vector<mrpt::utils::TPixelCoordf> detected_corners; //!< At output, the detected corners (x,y) in pixel units. 00056 mrpt::poses::CPose3D reconstructed_camera_pose; //!< At output, the reconstructed pose of the camera. 00057 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. 00058 std::vector<TPixelCoordf> projectedPoints_undistorted; //!< At output, like projectedPoints_distorted but for the undistorted image. 00059 }; 00060 00061 /** A list of images, used in checkerBoardCameraCalibration 00062 * \sa checkerBoardCameraCalibration 00063 */ 00064 typedef std::map<std::string,TImageCalibData> TCalibrationImageList; 00065 00066 /** Performs a camera calibration (computation of projection and distortion parameters) from a sequence of captured images of a checkerboard. 00067 * \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. 00068 * \param check_size_x [IN] The number of squares in the checkerboard in the X direction. 00069 * \param check_size_y [IN] The number of squares in the checkerboard in the Y direction. 00070 * \param check_squares_length_X_meters [IN] The size of each square in the checkerboard, in meters, in the X axis. 00071 * \param check_squares_length_Y_meters [IN] This will typically be equal to check_squares_length_X_meters. 00072 * \param intrinsicParams [OUT] The 3x3 intrinsic parameters matrix. See http://www.mrpt.org/Camera_Parameters 00073 * \param distortionParams [OUT] The 1x4 vector of distortion parameters: k1 k2 p1 p2. See http://www.mrpt.org/Camera_Parameters 00074 * \param normalize_image [IN] Select OpenCV flag 00075 * \param out_MSE [OUT] If set to !=NULL, the mean square error of the reprojection will be stored here (in pixel units). 00076 * \param skipDrawDetectedImgs [IN] Whether to skip the generation of the undistorted and detected images in each TImageCalibData 00077 * \param useScaramuzzaAlternativeDetector [IN] Whether to use an alternative detector. See CImage::findChessboardCorners for more deatails and references. 00078 * \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. 00079 * \return false on any error (more info will be dumped to cout), or true on success. 00080 * \sa CImage::findChessboardCorners 00081 */ 00082 bool VISION_IMPEXP checkerBoardCameraCalibration( 00083 TCalibrationImageList &images, 00084 unsigned int check_size_x, 00085 unsigned int check_size_y, 00086 double check_squares_length_X_meters, 00087 double check_squares_length_Y_meters, 00088 mrpt::utils::TCamera &out_camera_params, 00089 bool normalize_image = true, 00090 double *out_MSE = NULL, 00091 bool skipDrawDetectedImgs = false, 00092 bool useScaramuzzaAlternativeDetector = false 00093 ); 00094 00095 /** Performs a camera calibration (computation of projection and distortion parameters) from a sequence of captured images of a checkerboard. 00096 * \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. 00097 * \param check_size_x [IN] The number of squares in the checkerboard in the X direction. 00098 * \param check_size_y [IN] The number of squares in the checkerboard in the Y direction. 00099 * \param check_squares_length_X_meters [IN] The size of each square in the checkerboard, in meters, in the X axis. 00100 * \param check_squares_length_Y_meters [IN] This will typically be equal to check_squares_length_X_meters. 00101 * \param intrinsicParams [OUT] The 3x3 intrinsic parameters matrix. See http://www.mrpt.org/Camera_Parameters 00102 * \param distortionParams [OUT] The 1x4 vector of distortion parameters: k1 k2 p1 p2. See http://www.mrpt.org/Camera_Parameters 00103 * \param normalize_image [IN] Select OpenCV flag 00104 * \param out_MSE [OUT] If set to !=NULL, the mean square error of the reprojection will be stored here (in pixel units). 00105 * \param skipDrawDetectedImgs [IN] Whether to skip the generation of the undistorted and detected images in each TImageCalibData 00106 * \param useScaramuzzaAlternativeDetector [IN] Whether to use an alternative detector. See CImage::findChessboardCorners for more deatails and references. 00107 * \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. 00108 * \return false on any error (more info will be dumped to cout), or true on success. 00109 * \sa CImage::findChessboardCorners 00110 */ 00111 bool VISION_IMPEXP checkerBoardCameraCalibration( 00112 TCalibrationImageList &images, 00113 unsigned int check_size_x, 00114 unsigned int check_size_y, 00115 double check_squares_length_X_meters, 00116 double check_squares_length_Y_meters, 00117 CMatrixDouble33 &intrinsicParams, 00118 std::vector<double> &distortionParams, 00119 bool normalize_image = true, 00120 double *out_MSE = NULL, 00121 bool skipDrawDetectedImgs = false, 00122 bool useScaramuzzaAlternativeDetector = false 00123 ); 00124 00125 /** @} */ // end of grouping 00126 00127 } 00128 } 00129 00130 00131 #endif
| Page generated by Doxygen 1.7.5 for MRPT 0.9.5 SVN: at Thu Oct 13 21:25:36 UTC 2011 |