@@ -5,6 +5,8 @@ This module includes calibration, rectification and stereo reconstruction of omn
*C. Mei and P. Rives, Single view point omnidirectional camera calibration from planar grids, in ICRA 2007.*
The model is capable of describing catadioptric cameras, which may have 360 degrees of field of view. Also, it can be used for fisheye cameras.
The implementation of the calibration part is based on Li's calibration toolbox:
*B. Li, L. Heng, K. Kevin and M. Pollefeys, "A Multiple-Camera System Calibration Toolbox Using A Feature Descriptor-Based Calibration Pattern", in IROS 2013.*
...
...
@@ -15,6 +17,7 @@ This tutorial will introduce the following parts of omnidirectional camera calib
- calibrate a system with multiple cameras.
- rectify images so that large distoration is removed.
- reconstruct 3D from two stereo images, with large filed of view.
- comparison with fisheye model in opencv/calib3d/
Single Camera Calibration
---------------------
...
...
@@ -23,10 +26,21 @@ The first step to calibrate camera is to get a calibration object and take some
Next extract checkerboard corners and get their positions in all images by Opencv function *findChessboardCorners* or by hand (if you do want to make sure that corners are perfectly extracted). Save the positions in images in imagePoints, with vector of Mat type of CV_64FC2. That is, you get a 1XN or NX1 CV_64FC2 mat for each image, N is the number of corners. Then set the world coordinate to one of the four extreme corners and set xy plane as the checkerboard plane so that the position of checkerboard corners in world frame can be determined. Save the points in world coordiante in objectPoints, with vector of Mat type of CV_64FC3. Each element in vector objectPoints and imagePoints must come from the same image.
Now run the calibration function like:
In the folder *data*, the file *omni_calib_data.xml* stores an example of objectPoints, imagePoints and imageSize. Use the following code to load them:
The variable *size* of tyep Size is the size of images. *flags* is a enumeration for some features, including:
...
...
@@ -34,9 +48,9 @@ The variable *size* of tyep Size is the size of images. *flags* is a enumeration
- CALIB_USE_GUESS: initialize camera parameters by input K, xi, D, om, t.
- CALIB_FIX_SKEW, CALIB_FIX_K1, CALIB_FIX_K2, CALIB_FIX_P1, CALIB_FIX_P2, CALIB_FIX_XI, CALIB_FIX_GAMMA, CALIB_FIX_CENTER: fix the corresponding parameters during calibration, you can use 'plus' operator to set multiple features. For example, CALIB_FIX_SKEW+CALIB_FIX_K1 means fix skew and K1.
K, xi, D, om, t are output internal and external parameters.
*K*, *xi*, *D*, *om*, *t* are output internal and external parameters. The returned value *rms* is the root mean square of reprojection errors.
critia is the stopping critia during optimization, set it to be, for example, cv::TermCriteria(cv::TermCriteria::COUNT + cv::TermCriteria::EPS, 200, 0.0001);
critia is the stopping critia during optimization, set it to be, for example, cv::TermCriteria(cv::TermCriteria::COUNT + cv::TermCriteria::EPS, 200, 0.0001), which means using 200 iterations and stopping when relative change is smaller than 0.0001.