Main MRPT website > C++ reference for MRPT 1.5.9
Classes | Typedefs | Functions
Chessboard calibration

Detailed Description

Collaboration diagram for Chessboard calibration:

Classes

struct  mrpt::vision::TImageCalibData
 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). More...
 
struct  mrpt::vision::TImageStereoCalibData
 Data associated to each stereo image in the calibration process mrpt::vision::checkerBoardCameraCalibration (All the information can be left empty and will be filled up in the calibration method). More...
 
struct  mrpt::vision::TImageStereoCallbackData
 Params of the optional callback provided by the user. More...
 
struct  mrpt::vision::TStereoCalibParams
 Input parameters for mrpt::vision::checkerBoardStereoCalibration. More...
 
struct  mrpt::vision::TStereoCalibResults
 Output results for mrpt::vision::checkerBoardStereoCalibration. More...
 

Typedefs

typedef std::map< std::string, TImageCalibDatamrpt::vision::TCalibrationImageList
 A list of images, used in checkerBoardCameraCalibration. More...
 
typedef void(* mrpt::vision::TSteroCalibCallbackFunctor) (const TImageStereoCallbackData &d, void *user_data)
 Prototype of optional user callback function. More...
 
typedef std::vector< TImageStereoCalibDatamrpt::vision::TCalibrationStereoImageList
 A list of images, used in checkerBoardStereoCalibration. More...
 

Functions

bool VISION_IMPEXP mrpt::vision::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 of captured images of a checkerboard. More...
 
bool VISION_IMPEXP mrpt::vision::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::math::CMatrixDouble33 &intrinsicParams, std::vector< double > &distortionParams, 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 of captured images of a checkerboard. More...
 
bool VISION_IMPEXP mrpt::vision::findChessboardCorners (const mrpt::utils::CImage &img, std::vector< mrpt::utils::TPixelCoordf > &cornerCoords, unsigned int check_size_x, unsigned int check_size_y, bool normalize_image=true, bool useScaramuzzaMethod=false)
 Look for the corners of a chessboard in the image using one of two different methods. More...
 
void VISION_IMPEXP mrpt::vision::findMultipleChessboardsCorners (const mrpt::utils::CImage &img, std::vector< std::vector< mrpt::utils::TPixelCoordf > > &cornerCoords, unsigned int check_size_x, unsigned int check_size_y)
 Look for the corners of one or more chessboard/checkerboards in the image. More...
 
bool VISION_IMPEXP mrpt::vision::checkerBoardStereoCalibration (TCalibrationStereoImageList &images, const TStereoCalibParams &params, TStereoCalibResults &out_results)
 Optimize the calibration parameters of a stereo camera or a RGB+D (Kinect) camera. More...
 

Typedef Documentation

◆ TCalibrationImageList

A list of images, used in checkerBoardCameraCalibration.

See also
checkerBoardCameraCalibration

Definition at line 46 of file chessboard_camera_calib.h.

◆ TCalibrationStereoImageList

A list of images, used in checkerBoardStereoCalibration.

See also
checkerBoardStereoCalibration

Definition at line 104 of file chessboard_stereo_camera_calib.h.

◆ TSteroCalibCallbackFunctor

typedef void(* mrpt::vision::TSteroCalibCallbackFunctor) (const TImageStereoCallbackData &d, void *user_data)

Prototype of optional user callback function.

Definition at line 47 of file chessboard_stereo_camera_calib.h.

Function Documentation

◆ checkerBoardCameraCalibration() [1/2]

bool mrpt::vision::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 of captured images of a checkerboard.

Parameters
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.
check_size_x[IN] The number of squares in the checkerboard in the X direction.
check_size_y[IN] The number of squares in the checkerboard in the Y direction.
check_squares_length_X_meters[IN] The size of each square in the checkerboard, in meters, in the X axis.
check_squares_length_Y_meters[IN] This will typically be equal to check_squares_length_X_meters.
intrinsicParams[OUT] The 3x3 intrinsic parameters matrix. See http://www.mrpt.org/Camera_Parameters
distortionParams[OUT] The 1x4 vector of distortion parameters: k1 k2 p1 p2. See http://www.mrpt.org/Camera_Parameters
normalize_image[IN] Select OpenCV flag
out_MSE[OUT] If set to !=NULL, the mean square error of the reprojection will be stored here (in pixel units).
skipDrawDetectedImgs[IN] Whether to skip the generation of the undistorted and detected images in each TImageCalibData
useScaramuzzaAlternativeDetector[IN] Whether to use an alternative detector. See CImage::findChessboardCorners for more deatails and references.
See also
The camera-calib-gui application is a user-friendly GUI to this class.
Returns
false on any error (more info will be dumped to cout), or true on success.
See also
CImage::findChessboardCorners, checkerBoardStereoCalibration

Definition at line 100 of file checkerboard_cam_calib.cpp.

References ASSERT_, mrpt::utils::CImage::colorImage(), mrpt::vision::TImageCalibData::detected_corners, mrpt::utils::TCamera::dist, mrpt::system::extractFileExtension(), mrpt::system::extractFileName(), mrpt::utils::FAST_REF_OR_CONVERT_TO_GRAY, mrpt::vision::findChessboardCorners(), mrpt::format(), mrpt::utils::CImage::getAs(), mrpt::utils::CConfigFileMemory::getContent(), mrpt::utils::TCamera::getDistortionParamsAsVector(), mrpt::utils::CImage::getHeight(), mrpt::utils::CImage::getWidth(), mrpt::vision::TImageCalibData::img_checkboard, mrpt::vision::TImageCalibData::img_original, mrpt::vision::TImageCalibData::img_rectified, mrpt::utils::TCamera::intrinsicParams, mrpt::utils::CImage::isExternallyStored(), mrpt::utils::CImage::loadFromFile(), MRPT_UNUSED_PARAM, cv::my_cv2eigen(), mrpt::utils::TCamera::ncols, mrpt::utils::TCamera::nrows, mrpt::vision::TImageCalibData::projectedPoints_distorted, mrpt::vision::TImageCalibData::projectedPoints_undistorted, mrpt::vision::pinhole::projectPoints_no_distortion(), mrpt::vision::pinhole::projectPoints_with_distortion(), mrpt::vision::TImageCalibData::reconstructed_camera_pose, mrpt::utils::CImage::rectifyImage(), mrpt::utils::TCamera::saveToConfigFile(), mrpt::math::square(), THROW_EXCEPTION, and THROW_EXCEPTION_FMT.

Referenced by mrpt::vision::checkerBoardCameraCalibration().

◆ checkerBoardCameraCalibration() [2/2]

bool mrpt::vision::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::math::CMatrixDouble33 intrinsicParams,
std::vector< double > &  distortionParams,
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 of captured images of a checkerboard.

Parameters
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.
check_size_x[IN] The number of squares in the checkerboard in the X direction.
check_size_y[IN] The number of squares in the checkerboard in the Y direction.
check_squares_length_X_meters[IN] The size of each square in the checkerboard, in meters, in the X axis.
check_squares_length_Y_meters[IN] This will typically be equal to check_squares_length_X_meters.
intrinsicParams[OUT] The 3x3 intrinsic parameters matrix. See http://www.mrpt.org/Camera_Parameters
distortionParams[OUT] The 1x4 vector of distortion parameters: k1 k2 p1 p2. See http://www.mrpt.org/Camera_Parameters
normalize_image[IN] Select OpenCV flag
out_MSE[OUT] If set to !=NULL, the mean square error of the reprojection will be stored here (in pixel units).
skipDrawDetectedImgs[IN] Whether to skip the generation of the undistorted and detected images in each TImageCalibData
useScaramuzzaAlternativeDetector[IN] Whether to use an alternative detector. See CImage::findChessboardCorners for more deatails and references.
See also
The camera-calib-gui application is a user-friendly GUI to this class.
Returns
false on any error (more info will be dumped to cout), or true on success.
See also
CImage::findChessboardCorners

Definition at line 32 of file checkerboard_cam_calib.cpp.

References mrpt::vision::checkerBoardCameraCalibration(), mrpt::utils::TCamera::getDistortionParamsAsVector(), and mrpt::utils::TCamera::intrinsicParams.

◆ checkerBoardStereoCalibration()

bool mrpt::vision::checkerBoardStereoCalibration ( TCalibrationStereoImageList images,
const TStereoCalibParams params,
TStereoCalibResults out_results 
)

Optimize the calibration parameters of a stereo camera or a RGB+D (Kinect) camera.

This computes the projection and distortion parameters of each camera, and their relative spatial pose, from a sequence of pairs of captured images of a checkerboard. A custom implementation of an optimizer (Levenberg-Marquartd) seeks for the set of selected parameters to estimate that minimize the reprojection errors.

Parameters
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.
params[IN] Mandatory: the user must provide the size of the checkerboard, which parameters to optimize and which to leave fixed to zero, etc.
out_results[OUT] The results of the calibration, and its uncertainty measure, will be found here upon return.
Returns
false on any error (more info will be dumped to cout), or true on success.
Note
See also the ready-to-use application: kinect-calibrate
See also
CImage::findChessboardCorners, checkerBoardCameraCalibration, mrpt::hwdrivers::CKinect

Definition at line 43 of file chessboard_stereo_camera_calib.cpp.

References mrpt::vision::add_lm_increment(), ASSERT_, ASSERT_EQUAL_, mrpt::vision::build_linear_system(), mrpt::vision::TImageStereoCallbackData::calibRound, mrpt::vision::TStereoCalibResults::cam_params, mrpt::utils::CImage::colorImage(), mrpt::vision::TImageStereoCallbackData::current_iter, mrpt::vision::TImageStereoCallbackData::current_rmse, mrpt::utils::TCamera::cx(), mrpt::utils::TCamera::cy(), mrpt::vision::TImageCalibData::detected_corners, mrpt::utils::CImage::drawChessboardCorners(), eps, mrpt::utils::FAST_REF_OR_CONVERT_TO_GRAY, mrpt::vision::TStereoCalibResults::final_iters, mrpt::vision::TStereoCalibResults::final_number_good_image_pairs, mrpt::vision::TStereoCalibResults::final_rmse, mrpt::vision::findChessboardCorners(), mrpt::format(), mrpt::utils::TCamera::fx(), mrpt::utils::TCamera::fy(), mrpt::utils::CImage::getHeight(), mrpt::utils::CImage::getSize(), mrpt::utils::CImage::getWidth(), mrpt::vision::TStereoCalibResults::image_pair_was_used, mrpt::vision::TImageCalibData::img_checkboard, mrpt::vision::TImageCalibData::img_original, mrpt::vision::TImageCalibData::img_rectified, mrpt::utils::CImage::isExternallyStored(), mrpt::utils::TCamera::k1(), mrpt::utils::TCamera::k2(), mrpt::utils::TCamera::k3(), mrpt::vision::lm_stat_t::left_cam_params, mrpt::vision::lm_stat_t::left_cam_poses, mrpt::vision::TStereoCalibResults::left_cam_poses, mrpt::vision::TStereoCalibResults::left_params_inv_variance, mrpt::utils::TStereoCamera::leftCamera, mrpt::utils::TCamera::ncols, mrpt::vision::TImageStereoCallbackData::nImgsProcessed, mrpt::vision::TImageStereoCallbackData::nImgsToProcess, mrpt::utils::TCamera::nrows, mrpt::utils::TCamera::p1(), mrpt::utils::TCamera::p2(), mrpt::vision::TImageCalibData::projectedPoints_distorted, mrpt::vision::pinhole::projectPoints_with_distortion(), mrpt::vision::recompute_errors_and_Jacobians(), mrpt::vision::TImageCalibData::reconstructed_camera_pose, mrpt::vision::TStereoCalibResults::right2left_camera_pose, mrpt::vision::lm_stat_t::right2left_pose, mrpt::vision::lm_stat_t::right_cam_params, mrpt::vision::TStereoCalibResults::right_params_inv_variance, mrpt::utils::TStereoCamera::rightCamera, mrpt::vision::lm_stat_t::swap(), mrpt::math::TPoint2D::x, mrpt::utils::TPixelCoord::x, mrpt::math::TPoint2D::y, and mrpt::utils::TPixelCoord::y.

◆ findChessboardCorners()

bool mrpt::vision::findChessboardCorners ( const mrpt::utils::CImage in_img,
std::vector< mrpt::utils::TPixelCoordf > &  cornerCoords,
unsigned int  check_size_x,
unsigned int  check_size_y,
bool  normalize_image = true,
bool  useScaramuzzaMethod = false 
)

Look for the corners of a chessboard in the image using one of two different methods.

Look for the corners of a chessboard in the image.

The search algorithm will be OpenCV's function cvFindChessboardCorners or its improved version published by M. Rufli, D. Scaramuzza, and R. Siegwart. See: http://robotics.ethz.ch/~scaramuzza/Davide_Scaramuzza_files/Research/OcamCalib_Tutorial.htm and the papers:

  • 1. Scaramuzza, D., Martinelli, A. and Siegwart, R. (2006), A Toolbox for Easily Calibrating Omnidirectional Cameras, Proceedings of the IEEE/RSJ International Conference on Intelligent Robots and Systems (IROS 2006), Beijing, China, October 2006.
  • 2. Scaramuzza, D., Martinelli, A. and Siegwart, R., (2006). "A Flexible Technique for Accurate Omnidirectional Camera Calibration and Structure from Motion", Proceedings of IEEE International Conference of Vision Systems (ICVS'06), New York, January 5-7, 2006.
  • 3. Rufli, M., Scaramuzza, D., and Siegwart, R. (2008), Automatic Detection of Checkerboards on Blurred and Distorted Images, Proceedings of the IEEE/RSJ International Conference on Intelligent Robots and Systems (IROS 2008), Nice, France, September 2008.

After detecting the corners with either method, it's called "cvFindCornerSubPix" to achieve subpixel accuracy.

Parameters
cornerCoords[OUT] The pixel coordinates of all the corners.
check_size_x[IN] The number of squares, in the X direction
check_size_y[IN] The number of squares, in the Y direction
normalize_image[IN] Whether to normalize the image before detection
useScaramuzzaMethod[IN] Whether to use the alternative, more robust method by M. Rufli, D. Scaramuzza, and R. Siegwart.
Returns
true on success
See also
findMultipleChessboardsCorners, mrpt::vision::checkerBoardCameraCalibration, drawChessboardCorners
Parameters
cornerCoords[OUT] The pixel coordinates of all the corners.
check_size_x[IN] The number of squares, in the X direction
check_size_y[IN] The number of squares, in the Y direction
normalize_image[IN] Whether to normalize the image before detection
useScaramuzzaMethod[IN] Whether to use the alternative, more robust method by M. Rufli, D. Scaramuzza, and R. Siegwart.
Returns
true on success

Definition at line 35 of file checkerboard_find_corners.cpp.

References ASSERT_, cvFindChessboardCorners3(), mrpt::utils::FAST_REF_OR_CONVERT_TO_GRAY, MRPT_END, and MRPT_START.

Referenced by mrpt::vision::checkerBoardCameraCalibration(), and mrpt::vision::checkerBoardStereoCalibration().

◆ findMultipleChessboardsCorners()

void mrpt::vision::findMultipleChessboardsCorners ( const mrpt::utils::CImage in_img,
std::vector< std::vector< mrpt::utils::TPixelCoordf > > &  cornerCoords,
unsigned int  check_size_x,
unsigned int  check_size_y 
)

Look for the corners of one or more chessboard/checkerboards in the image.

This method uses an improved version of OpenCV's cvFindChessboardCorners published by M. Rufli, D. Scaramuzza, and R. Siegwart. See: http://robotics.ethz.ch/~scaramuzza/Davide_Scaramuzza_files/Research/OcamCalib_Tutorial.htm and the papers:

  • 1. Scaramuzza, D., Martinelli, A. and Siegwart, R. (2006), A Toolbox for Easily Calibrating Omnidirectional Cameras, Proceedings of the IEEE/RSJ International Conference on Intelligent Robots and Systems (IROS 2006), Beijing, China, October 2006.
  • 2. Scaramuzza, D., Martinelli, A. and Siegwart, R., (2006). "A Flexible Technique for Accurate Omnidirectional Camera Calibration and Structure from Motion", Proceedings of IEEE International Conference of Vision Systems (ICVS'06), New York, January 5-7, 2006.
  • 3. Rufli, M., Scaramuzza, D., and Siegwart, R. (2008), Automatic Detection of Checkerboards on Blurred and Distorted Images, Proceedings of the IEEE/RSJ International Conference on Intelligent Robots and Systems (IROS 2008), Nice, France, September 2008.

That method has been extended in this MRPT implementation to automatically detect a number of different checkerboards in the same image.

Parameters
cornerCoords[OUT] A vector of N vectors of pixel coordinates, for each of the N chessboards detected.
check_size_x[IN] The number of squares, in the X direction
check_size_y[IN] The number of squares, in the Y direction
See also
mrpt::vision::checkerBoardCameraCalibration, drawChessboardCorners

This method uses an improved version of OpenCV's cvFindChessboardCorners published by M. Rufli, D. Scaramuzza, and R. Siegwart. That method has been extended in this MRPT implementation to automatically detect a number of different checkerboards in the same image.

Parameters
cornerCoords[OUT] A vector of N vectors of pixel coordinates, for each of the N chessboards detected.
check_size_x[IN] The number of squares, in the X direction
check_size_y[IN] The number of squares, in the Y direction
See also
mrpt::vision::checkerBoardCameraCalibration, drawChessboardCorners

Definition at line 144 of file checkerboard_find_corners.cpp.

References ASSERT_, begin(), mrpt::math::crossProduct3D(), mrpt::utils::FAST_REF_OR_CONVERT_TO_GRAY, find_chessboard_corners_multiple(), and push_back().




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