用于 3D 重建的自定义校准模式


名称空间

cv::omnidir::internal

class cv::ccalib::CustomPattern
class cv::multicalib::MultiCameraCalibration
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. 更多...
class cv::randpattern::RandomPatternCornerFinder
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. 更多...
class cv::randpattern::RandomPatternGenerator

#define HEAD -1
#define INVALID -2

枚举

enum {
cv::omnidir::CALIB_USE_GUESS = 1,
cv::omnidir::CALIB_FIX_SKEW = 2,
cv::omnidir::CALIB_FIX_K1 = 4,
cv::omnidir::CALIB_FIX_K2 = 8,
cv::omnidir::CALIB_FIX_P1 = 16,
cv::omnidir::CALIB_FIX_P2 = 32,
cv::omnidir::CALIB_FIX_XI = 64,
cv::omnidir::CALIB_FIX_GAMMA = 128,
cv::omnidir::CALIB_FIX_CENTER = 256
}
enum {
cv::omnidir::RECTIFY_PERSPECTIVE = 1,
cv::omnidir::RECTIFY_CYLINDRICAL = 2,
cv::omnidir::RECTIFY_LONGLATI = 3,
cv::omnidir::RECTIFY_STEREOGRAPHIC = 4
}
enum {
cv::omnidir::XYZRGB = 1,
cv::omnidir::XYZ = 2
}

函数

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 ())
Perform omnidirectional camera calibration, the default depth of outputs is CV_64F. 更多...
void cv::omnidir::initUndistortRectifyMap ( InputArray K, InputArray D, InputArray xi, InputArray R, InputArray P, const cv::Size &size, int mltype, OutputArray map1, OutputArray map2, int flags)
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. 更多...
void cv::omnidir::projectPoints ( InputArray objectPoints, OutputArray imagePoints, InputArray rvec, InputArray tvec, InputArray K, double xi, InputArray D, OutputArray jacobian= noArray ())
Projects points for omnidirectional camera using CMei's model. 更多...
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 ())
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. 更多...
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 )
Stereo 3D reconstruction from a pair of images. 更多...
void cv::omnidir::stereoRectify ( InputArray R, InputArray T, OutputArray R1, OutputArray R2)
Stereo rectification for omnidirectional camera model. It computes the rectification rotations for two cameras. 更多...
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 ))
Undistort omnidirectional images to perspective images. 更多...
void cv::omnidir::undistortPoints ( InputArray distorted, OutputArray undistorted, InputArray K, InputArray D, InputArray xi, InputArray R)
Undistort 2D image points for omnidirectional camera using CMei's model. 更多...

详细描述

宏定义文档编制

HEAD

#define HEAD   -1

INVALID

#define INVALID   -2

枚举类型文档编制

anonymous enum

anonymous enum

#include < opencv2/ccalib/omnidir.hpp >

枚举器
CALIB_USE_GUESS
Python: cv.omnidir.CALIB_USE_GUESS
CALIB_FIX_SKEW
Python: cv.omnidir.CALIB_FIX_SKEW
CALIB_FIX_K1
Python: cv.omnidir.CALIB_FIX_K1
CALIB_FIX_K2
Python: cv.omnidir.CALIB_FIX_K2
CALIB_FIX_P1
Python: cv.omnidir.CALIB_FIX_P1
CALIB_FIX_P2
Python: cv.omnidir.CALIB_FIX_P2
CALIB_FIX_XI
Python: cv.omnidir.CALIB_FIX_XI
CALIB_FIX_GAMMA
Python: cv.omnidir.CALIB_FIX_GAMMA
CALIB_FIX_CENTER
Python: cv.omnidir.CALIB_FIX_CENTER

anonymous enum

anonymous enum

#include < opencv2/ccalib/omnidir.hpp >

枚举器
RECTIFY_PERSPECTIVE
Python: cv.omnidir.RECTIFY_PERSPECTIVE
RECTIFY_CYLINDRICAL
Python: cv.omnidir.RECTIFY_CYLINDRICAL
RECTIFY_LONGLATI
Python: cv.omnidir.RECTIFY_LONGLATI
RECTIFY_STEREOGRAPHIC
Python: cv.omnidir.RECTIFY_STEREOGRAPHIC

anonymous enum

anonymous enum

#include < opencv2/ccalib/omnidir.hpp >

枚举器
XYZRGB
Python: cv.omnidir.XYZRGB
XYZ
Python: cv.omnidir.XYZ

函数文档编制

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 ()
)
Python:
retval, K, xi, D, rvecs, tvecs, idx = cv.omnidir.calibrate( objectPoints, imagePoints, size, K, xi, D, flags, criteria[, rvecs[, tvecs[, idx]]] )

#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 model
D Output distortion parameters \((k_1, k_2, p_1, p_2)\)
rvecs Output rotations for each calibration images
tvecs Output translation for each calibration images
flags The flags that control calibrate
criteria Termination criteria for optimization
idx 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 mltype ,
OutputArray map1 ,
OutputArray map2 ,
int flags
)
Python:
map1, map2 = cv.omnidir.initUndistortRectifyMap( K, D, xi, R, P, size, mltype, flags[, map1[, map2]] )

#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_64F
D Input vector of distortion coefficients \((k_1, k_2, p_1, p_2)\), with depth CV_32F or CV_64F
xi The parameter xi for CMei's model
R Rotation transform between the original and object space : 3x3 1-channel, or vector: 3x1/1x3, with depth CV_32F or CV_64F
P New camera matrix (3x3) or new projection matrix (3x4)
size Undistorted image size.
mltype 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 ,
InputArray rvec ,
InputArray tvec ,
InputArray K ,
double xi ,
InputArray D ,
OutputArray jacobian = noArray ()
)
Python:
imagePoints, jacobian = cv.omnidir.projectPoints( objectPoints, rvec, tvec, K, xi, D[, imagePoints[, jacobian]] )

#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.

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., om
tvec vector of translation between pattern coordinate and camera coordinate
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
jacobian 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.

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.

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 ()
)
Python:
retval, objectPoints, imagePoints1, imagePoints2, K1, xi1, D1, K2, xi2, D2, rvec, tvec, rvecsL, tvecsL, idx = cv.omnidir.stereoCalibrate( objectPoints, imagePoints1, imagePoints2, imageSize1, imageSize2, K1, xi1, D1, K2, xi2, D2, flags, criteria[, rvec[, tvec[, rvecsL[, tvecsL[, idx]]]]] )

#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<Vec3f> >. 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<Vec2f> >. 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<Vec2f> >. 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 camera
D1 Output distortion parameters \((k_1, k_2, p_1, p_2)\) for the first camera
K2 Output camera matrix for the first camera.
xi2 Output parameter xi of CMei's model for the second camera
D2 Output distortion parameters \((k_1, k_2, p_1, p_2)\) for the second camera
rvec Output rotation between the first and second camera
tvec Output translation between the first and second camera
rvecsL Output rotation for each image of the first camera
tvecsL Output translation for each image of the first camera
flags The flags that control stereoCalibrate
criteria Termination criteria for optimization
idx 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
)
Python:
disparity, image1Rec, image2Rec, pointCloud = cv.omnidir.stereoReconstruct( image1, image2, K1, D1, xi1, K2, D2, xi2, R, T, flag, numDisparities, SADWindowSize[, disparity[, image1Rec[, image2Rec[, newSize[, Knew[, pointCloud[, pointType]]]]]]] )

#include < opencv2/ccalib/omnidir.hpp >

Stereo 3D reconstruction from a pair of images.

Parameters
image1 The first input image
image2 The second input image
K1 Input camera matrix of the first camera
D1 Input distortion parameters \((k_1, k_2, p_1, p_2)\) for the first camera
xi1 Input parameter xi for the first camera for CMei's model
K2 Input camera matrix of the second camera
D2 Input distortion parameters \((k_1, k_2, p_1, p_2)\) for the second camera
xi2 Input parameter xi for the second camera for CMei's model
R Rotation between the first and second camera
T Translation between the first and second camera
flag Flag of rectification type, RECTIFY_PERSPECTIVE or RECTIFY_LONGLATI
numDisparities 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 matching
image1Rec Rectified image of the first image
image2Rec rectified image of the second image
newSize Image size of rectified image, see omnidir::undistortImage
Knew New camera matrix of rectified image, see omnidir::undistortImage
pointCloud Point cloud of 3D reconstruction, with type CV_64FC3
pointType Point cloud type, it can be XYZRGB or XYZ

stereoRectify()

void cv::omnidir::stereoRectify ( InputArray R ,
InputArray T ,
OutputArray R1 ,
OutputArray R2
)
Python:
R1, R2 = cv.omnidir.stereoRectify( R, T[, R1[, 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 camera
T Translation between the first and second camera
R1 Output 3x3 rotation matrix for the first camera
R2 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 )
)
Python:
undistorted = cv.omnidir.undistortImage( distorted, K, D, xi, flags[, undistorted[, Knew[, new_size[, R]]]] )

#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_STEREOGRAPHIC
Knew 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
)
Python:
undistorted = cv.omnidir.undistortPoints( distorted, K, D, xi, R[, undistorted] )

#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 acceptable
K 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 model
R Rotation trainsform between the original and object space : 3x3 1-channel, or vector: 3x1/1x3 1-channel or 1x1 3-channel
undistorted array of normalized object points, vector of Vec2f/Vec2d or 1xN/Nx1 2-channel Mat with the same depth of distorted points.