http://www.emgu.com
computes the rotation matrices for each camera that (virtually) make both camera image planes the same plane. Consequently, that makes all the epipolar lines parallel and thus simplifies the dense stereo correspondence problem. On input the function takes the matrices computed by cvStereoCalibrate and on output it gives 2 rotation matrices and also 2 projection matrices in the new coordinates. The function is normally called after cvStereoCalibrate that computes both camera matrices, the distortion coefficients, R and T

Namespace: Emgu.CV
Assembly: Emgu.CV (in Emgu.CV.dll) Version: 2.4.2.1777 (2.4.2.1777)

Syntax

C#
public static void cvStereoRectify(
	IntPtr cameraMatrix1,
	IntPtr cameraMatrix2,
	IntPtr distCoeffs1,
	IntPtr distCoeffs2,
	Size imageSize,
	IntPtr R,
	IntPtr T,
	IntPtr R1,
	IntPtr R2,
	IntPtr P1,
	IntPtr P2,
	IntPtr Q,
	STEREO_RECTIFY_TYPE flags,
	double alpha,
	Size newImageSize,
	ref Rectangle validPixROI1,
	ref Rectangle validPixROI2
)
Visual Basic
Public Shared Sub cvStereoRectify ( _
	cameraMatrix1 As IntPtr, _
	cameraMatrix2 As IntPtr, _
	distCoeffs1 As IntPtr, _
	distCoeffs2 As IntPtr, _
	imageSize As Size, _
	R As IntPtr, _
	T As IntPtr, _
	R1 As IntPtr, _
	R2 As IntPtr, _
	P1 As IntPtr, _
	P2 As IntPtr, _
	Q As IntPtr, _
	flags As STEREO_RECTIFY_TYPE, _
	alpha As Double, _
	newImageSize As Size, _
	ByRef validPixROI1 As Rectangle, _
	ByRef validPixROI2 As Rectangle _
)
Visual C++
public:
static void cvStereoRectify(
	IntPtr cameraMatrix1, 
	IntPtr cameraMatrix2, 
	IntPtr distCoeffs1, 
	IntPtr distCoeffs2, 
	Size imageSize, 
	IntPtr R, 
	IntPtr T, 
	IntPtr R1, 
	IntPtr R2, 
	IntPtr P1, 
	IntPtr P2, 
	IntPtr Q, 
	STEREO_RECTIFY_TYPE flags, 
	double alpha, 
	Size newImageSize, 
	Rectangle% validPixROI1, 
	Rectangle% validPixROI2
)

Parameters

cameraMatrix1
Type: System..::..IntPtr
The camera matrices [fx_k 0 cx_k; 0 fy_k cy_k; 0 0 1]
cameraMatrix2
Type: System..::..IntPtr
The camera matrices [fx_k 0 cx_k; 0 fy_k cy_k; 0 0 1]
distCoeffs1
Type: System..::..IntPtr
The vectors of distortion coefficients for first camera, 4x1, 1x4, 5x1 or 1x5
distCoeffs2
Type: System..::..IntPtr
The vectors of distortion coefficients for second camera, 4x1, 1x4, 5x1 or 1x5
imageSize
Type: System.Drawing..::..Size
Size of the image used for stereo calibration
R
Type: System..::..IntPtr
The rotation matrix between the 1st and the 2nd cameras' coordinate systems
T
Type: System..::..IntPtr
The translation vector between the cameras' coordinate systems
R1
Type: System..::..IntPtr
3x3 Rectification transforms (rotation matrices) for the first camera
R2
Type: System..::..IntPtr
3x3 Rectification transforms (rotation matrices) for the second camera
P1
Type: System..::..IntPtr
3x4 Projection matrices in the new (rectified) coordinate systems
P2
Type: System..::..IntPtr
3x4 Projection matrices in the new (rectified) coordinate systems
Q
Type: System..::..IntPtr
The optional output disparity-to-depth mapping matrix, 4x4, see cvReprojectImageTo3D.
flags
Type: Emgu.CV.CvEnum..::..STEREO_RECTIFY_TYPE
The operation flags, use CALIB_ZERO_DISPARITY for default
alpha
Type: System..::..Double
Use -1 for default
newImageSize
Type: System.Drawing..::..Size
Use Size.Empty for default
validPixROI1
Type: System.Drawing..::..Rectangle%
The valid pixel ROI for image1
validPixROI2
Type: System.Drawing..::..Rectangle%
The valid pixel ROI for image2

See Also