Custom Calibration Pattern for 3D reconstruction#
Detailed Description#
Namespaces#
Classes#
Name |
Description |
|---|---|
Class for multiple camera calibration that supports pinhole camera and omnidirection camera. For omnidirectional camera model, please refer to omnidir.hpp in ccalib module. It first calibrate each camera individually, then a bundle adjustment like optimization is applied to refine extrinsic parameters. So far, it only support “random” pattern for calibration, see randomPattern.hpp in ccalib module for details. Images that are used should be named by “cameraIdx-timestamp.*”, several images with the same timestamp means that they are the same pattern that are photographed. cameraIdx should start from 0. View details |
|
Class for finding features points and corresponding 3D in world coordinate of a “random” pattern, which can be to be used in calibration. It is useful when pattern is partly occluded or only a part of pattern can be observed in multiple cameras calibration. The pattern can be generated by RandomPatternGenerator class described in this file. View details |
|
Enumerations#
enum cv::omnidir {
cv::CALIB_USE_GUESS = 1,
cv::CALIB_FIX_SKEW = 2,
cv::CALIB_FIX_K1 = 4,
cv::CALIB_FIX_K2 = 8,
cv::CALIB_FIX_P1 = 16,
cv::CALIB_FIX_P2 = 32,
cv::CALIB_FIX_XI = 64,
cv::CALIB_FIX_GAMMA = 128,
cv::CALIB_FIX_CENTER = 256
}
enum cv::omnidir {
cv::RECTIFY_PERSPECTIVE = 1,
cv::RECTIFY_CYLINDRICAL = 2,
cv::RECTIFY_LONGLATI = 3,
cv::RECTIFY_STEREOGRAPHIC = 4
}
enum cv::omnidir {
cv::XYZRGB = 1,
cv::XYZ = 2
}Enumeration Type Documentation#
enum#
#include <opencv2/ccalib/omnidir.hpp>
Enumerator:
|
|
|
|
|
|
|
|
|
enum#
#include <opencv2/ccalib/omnidir.hpp>
Enumerator:
|
|
|
|
enum#
#include <opencv2/ccalib/omnidir.hpp>
Enumerator:
|
|
Function Documentation#
calibrate()#
double cv::omnidir::calibrate(
InputArrayOfArrays objectPoints,
InputArrayOfArrays imagePoints,
Size size,
InputOutputArray K,
InputOutputArray xi,
InputOutputArray D,
OutputArrayOfArrays rvecs,
OutputArrayOfArrays tvecs,
int flags,
TermCriteria criteria,
OutputArray idx = noArray() )
#include <opencv2/ccalib/omnidir.hpp>
Perform omnidirectional camera calibration, the default depth of outputs is CV_64F.
Parameters
objectPoints— Vector of vector of Vec3f object points in world (pattern) coordinate. It also can be vector of Mat with size 1xN/Nx1 and type CV_32FC3. Data with depth of 64_F is also acceptable.imagePoints— Vector of vector of Vec2f corresponding image points of objectPoints. It must be the same size and the same type with objectPoints.size— Image size of calibration images.K— Output calibrated camera matrix.xi— Output parameter xi for CMei’s modelD— Output distortion parameters \((k_1, k_2, p_1, p_2)\)rvecs— Output rotations for each calibration imagestvecs— Output translation for each calibration imagesflags— The flags that control calibratecriteria— Termination criteria for optimizationidx— Indices of images that pass initialization, which are really used in calibration. So the size of rvecs is the same as idx.total().
initUndistortRectifyMap()#
void cv::omnidir::initUndistortRectifyMap(
InputArray K,
InputArray D,
InputArray xi,
InputArray R,
InputArray P,
const cv::Size & size,
int m1type,
OutputArray map1,
OutputArray map2,
int flags )
#include <opencv2/ccalib/omnidir.hpp>
Computes undistortion and rectification maps for omnidirectional camera image transform by a rotation R. It output two maps that are used for cv::remap(). If D is empty then zero distortion is used, if R or P is empty then identity matrices are used.
Parameters
K— Camera matrix \(K = \vecthreethree{f_x}{s}{c_x}{0}{f_y}{c_y}{0}{0}{_1}\), with depth CV_32F or CV_64FD— Input vector of distortion coefficients \((k_1, k_2, p_1, p_2)\), with depth CV_32F or CV_64Fxi— The parameter xi for CMei’s modelR— Rotation transform between the original and object space : 3x3 1-channel, or vector: 3x1/1x3, with depth CV_32F or CV_64FP— New camera matrix (3x3) or new projection matrix (3x4)size— Undistorted image size.m1type— Type of the first output map that can be CV_32FC1 or CV_16SC2 . See convertMaps() for details.map1— The first output map.map2— The second output map.flags— Flags indicates the rectification type, RECTIFY_PERSPECTIVE, RECTIFY_CYLINDRICAL, RECTIFY_LONGLATI and RECTIFY_STEREOGRAPHIC are supported.
projectPoints()#
void cv::omnidir::projectPoints(
InputArray objectPoints,
OutputArray imagePoints,
const Affine3d & affine,
InputArray K,
double xi,
InputArray D,
OutputArray jacobian = noArray() )
#include <opencv2/ccalib/omnidir.hpp>
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
projectPoints()#
void cv::omnidir::projectPoints(
InputArray objectPoints,
OutputArray imagePoints,
InputArray rvec,
InputArray tvec,
InputArray K,
double xi,
InputArray D,
OutputArray jacobian = noArray() )
#include <opencv2/ccalib/omnidir.hpp>
Projects points for omnidirectional camera using CMei’s model.
This module was accepted as a GSoC 2015 project for OpenCV, authored by Baisheng Lai, mentored by Bo Li.
The function projects object 3D points of world coordinate to image pixels, parameter by intrinsic and extrinsic parameters. Also, it optionally compute a by-product: the jacobian matrix containing contains the derivatives of image pixel points wrt intrinsic and extrinsic parameters.
Parameters
objectPoints— Object points in world coordinate, vector of vector of Vec3f or Mat of 1xN/Nx1 3-channel of type CV_32F and N is the number of points. 64F is also acceptable.imagePoints— Output array of image points, vector of vector of Vec2f or 1xN/Nx1 2-channel of type CV_32F. 64F is also acceptable.rvec— vector of rotation between world coordinate and camera coordinate, i.e., omtvec— vector of translation between pattern coordinate and camera coordinateK— Camera matrix \(K = \vecthreethree{f_x}{s}{c_x}{0}{f_y}{c_y}{0}{0}{_1}\).D— Input vector of distortion coefficients \((k_1, k_2, p_1, p_2)\).xi— The parameter xi for CMei’s modeljacobian— Optional output 2Nx16 of type CV_64F jacobian matrix, contains the derivatives of image pixel points wrt parameters including \(om, T, f_x, f_y, s, c_x, c_y, xi, k_1, k_2, p_1, p_2\). This matrix will be used in calibration by optimization.
stereoCalibrate()#
double cv::omnidir::stereoCalibrate(
InputOutputArrayOfArrays objectPoints,
InputOutputArrayOfArrays imagePoints1,
InputOutputArrayOfArrays imagePoints2,
const Size & imageSize1,
const Size & imageSize2,
InputOutputArray K1,
InputOutputArray xi1,
InputOutputArray D1,
InputOutputArray K2,
InputOutputArray xi2,
InputOutputArray D2,
OutputArray rvec,
OutputArray tvec,
OutputArrayOfArrays rvecsL,
OutputArrayOfArrays tvecsL,
int flags,
TermCriteria criteria,
OutputArray idx = noArray() )
#include <opencv2/ccalib/omnidir.hpp>
Stereo calibration for omnidirectional camera model. It computes the intrinsic parameters for two cameras and the extrinsic parameters between two cameras. The default depth of outputs is CV_64F.
Parameters
objectPoints— Object points in world (pattern) coordinate. Its type is vector<vector>. It also can be vector of Mat with size 1xN/Nx1 and type CV_32FC3. Data with depth of 64_F is also acceptable. imagePoints1— The corresponding image points of the first camera, with type vector<vector>. It must be the same size and the same type as objectPoints. imagePoints2— The corresponding image points of the second camera, with type vector<vector>. It must be the same size and the same type as objectPoints. imageSize1— Image size of calibration images of the first camera.imageSize2— Image size of calibration images of the second camera.K1— Output camera matrix for the first camera.xi1— Output parameter xi of Mei’s model for the first cameraD1— Output distortion parameters \((k_1, k_2, p_1, p_2)\) for the first cameraK2— Output camera matrix for the first camera.xi2— Output parameter xi of CMei’s model for the second cameraD2— Output distortion parameters \((k_1, k_2, p_1, p_2)\) for the second camerarvec— Output rotation between the first and second cameratvec— Output translation between the first and second camerarvecsL— Output rotation for each image of the first cameratvecsL— Output translation for each image of the first cameraflags— The flags that control stereoCalibratecriteria— Termination criteria for optimizationidx— Indices of image pairs that pass initialization, which are really used in calibration. So the size of rvecs is the same as idx.total(). @
stereoReconstruct()#
void cv::omnidir::stereoReconstruct(
InputArray image1,
InputArray image2,
InputArray K1,
InputArray D1,
InputArray xi1,
InputArray K2,
InputArray D2,
InputArray xi2,
InputArray R,
InputArray T,
int flag,
int numDisparities,
int SADWindowSize,
OutputArray disparity,
OutputArray image1Rec,
OutputArray image2Rec,
const Size & newSize = Size(),
InputArray Knew = cv::noArray(),
OutputArray pointCloud = cv::noArray(),
int pointType = XYZRGB )
#include <opencv2/ccalib/omnidir.hpp>
Stereo 3D reconstruction from a pair of images.
Parameters
image1— The first input imageimage2— The second input imageK1— Input camera matrix of the first cameraD1— Input distortion parameters \((k_1, k_2, p_1, p_2)\) for the first cameraxi1— Input parameter xi for the first camera for CMei’s modelK2— Input camera matrix of the second cameraD2— Input distortion parameters \((k_1, k_2, p_1, p_2)\) for the second cameraxi2— Input parameter xi for the second camera for CMei’s modelR— Rotation between the first and second cameraT— Translation between the first and second cameraflag— Flag of rectification type, RECTIFY_PERSPECTIVE or RECTIFY_LONGLATInumDisparities— The parameter ‘numDisparities’ in StereoSGBM, see StereoSGBM for details.SADWindowSize— The parameter ‘SADWindowSize’ in StereoSGBM, see StereoSGBM for details.disparity— Disparity map generated by stereo matchingimage1Rec— Rectified image of the first imageimage2Rec— rectified image of the second imagenewSize— Image size of rectified image, see omnidir::undistortImageKnew— New camera matrix of rectified image, see omnidir::undistortImagepointCloud— Point cloud of 3D reconstruction, with type CV_64FC3pointType— Point cloud type, it can be XYZRGB or XYZ
stereoRectify()#
void cv::omnidir::stereoRectify(
InputArray R,
InputArray T,
OutputArray R1,
OutputArray R2 )
#include <opencv2/ccalib/omnidir.hpp>
Stereo rectification for omnidirectional camera model. It computes the rectification rotations for two cameras.
Parameters
R— Rotation between the first and second cameraT— Translation between the first and second cameraR1— Output 3x3 rotation matrix for the first cameraR2— Output 3x3 rotation matrix for the second camera
undistortImage()#
void cv::omnidir::undistortImage(
InputArray distorted,
OutputArray undistorted,
InputArray K,
InputArray D,
InputArray xi,
int flags,
InputArray Knew = cv::noArray(),
const Size & new_size = Size(),
InputArray R = Mat::eye(3, 3, CV_64F) )
#include <opencv2/ccalib/omnidir.hpp>
Undistort omnidirectional images to perspective images.
Parameters
distorted— The input omnidirectional image.undistorted— The output undistorted image.K— Camera matrix \(K = \vecthreethree{f_x}{s}{c_x}{0}{f_y}{c_y}{0}{0}{_1}\).D— Input vector of distortion coefficients \((k_1, k_2, p_1, p_2)\).xi— The parameter xi for CMei’s model.flags— Flags indicates the rectification type, RECTIFY_PERSPECTIVE, RECTIFY_CYLINDRICAL, RECTIFY_LONGLATI and RECTIFY_STEREOGRAPHICKnew— Camera matrix of the distorted image. If it is not assigned, it is just K.new_size— The new image size. By default, it is the size of distorted.R— Rotation matrix between the input and output images. By default, it is identity matrix.
undistortPoints()#
void cv::omnidir::undistortPoints(
InputArray distorted,
OutputArray undistorted,
InputArray K,
InputArray D,
InputArray xi,
InputArray R )
#include <opencv2/ccalib/omnidir.hpp>
Undistort 2D image points for omnidirectional camera using CMei’s model.
Parameters
distorted— Array of distorted image points, vector of Vec2f or 1xN/Nx1 2-channel Mat of type CV_32F, 64F depth is also acceptableK— Camera matrix \(K = \vecthreethree{f_x}{s}{c_x}{0}{f_y}{c_y}{0}{0}{_1}\).D— Distortion coefficients \((k_1, k_2, p_1, p_2)\).xi— The parameter xi for CMei’s modelR— Rotation trainsform between the original and object space : 3x3 1-channel, or vector: 3x1/1x3 1-channel or 1x1 3-channelundistorted— array of normalized object points, vector of Vec2f/Vec2d or 1xN/Nx1 2-channel Mat with the same depth of distorted points.
Macro Definition Documentation#
HEAD#
#define HEAD
#include <opencv2/ccalib/multicalib.hpp>
Value:
-1
INVALID#
#define INVALID
#include <opencv2/ccalib/multicalib.hpp>
Value:
-2