Back to Aurora Vision Studio website

You are here: Start » Filter Reference » OpenCV » Camera Calibration And 3D Reconstruction » cvStereoRectify

cvStereoRectify


Module: OpenCV

Computes rectification transforms for each head of a calibrated stereo camera.

Name Type Range Description
Input value inCameraMatrix1 Matrix First camera matrix.
Input value inDistCoeffs1 Matrix First camera distortion parameters.
Input value inCameraMatrix2 Matrix Second camera matrix.
Input value inDistCoeffs2 Matrix Second camera distortion parameters.
Input value inImageWidth Integer Width of images used for stereo calibration.
Input value inImageHeight Integer Height of images used for stereo calibration.
Input value inR Matrix Rotation matrix between the coordinate systems of the first and the second cameras.
Input value inT Matrix Translation vector between coordinate systems of the cameras.
Input value inZeroDisparity Bool If the flag is set, the function makes the principal points of each camera have the same pixel coordinates in the rectified views. And if the flag is not set, the function may still shift the images in the horizontal or vertical direction to maximize the useful image area.
Input value inAlpha Real -1.0 - 1.0 Free scaling parameter. If it is -1 or absent, the function performs the default scaling. Otherwise, the parameter should be between 0 and 1. inAlpha=0 means that the rectified images are zoomed and shifted so that only valid pixels are visible. inAlpha=1 means that the rectified image is decimated and shifted so that all the pixels from the original images from the cameras are retained in the rectified images. Obviously, any intermediate value yields an intermediate result between those two extreme cases.
Input value inNewImageWidth Integer New image width after rectification. If both inNewImageWidth and inNewImageHeight equal 0, new size is set to original image size.
Input value inNewImageHeight Integer New image height after rectification. If both inNewImageWidth and inNewImageHeight equal 0, new size is set to original image size.
Output value outR1 Matrix Output 3x3 rectification transform, rotation matrix, for the first camera.
Output value outR2 Matrix Output 3x3 rectification transform, rotation matrix, for the second camera.
Output value outP1 Matrix Output 3x4 projection matrix in the new, rectified, coordinate systems for the first camera.
Output value outP2 Matrix Output 3x4 projection matrix in the new, rectified, coordinate systems for the second camera.
Output value outQ Matrix Output disparity-to-depth mapping matrix.
Output value outRoi1 Region Output region inside first rectified image where all the pixels are valid.
Output value outRoi2 Region Output region inside second rectified image where all the pixels are valid.

Errors

This filter can throw an exception to report error. Read how to deal with errors in Error Handling.

List of possible exceptions:

Error type Description
DomainError inAlpha must be -1 or between 0 and 1 in cvStereoRectify.
DomainError inCameraMatrix1 must be 3x3 matrix in cvStereoRectify.
DomainError inCameraMatrix2 must be 3x3 matrix in cvStereoRectify.
DomainError inR must be 3x3 or 1x3 matrix in cvStereoRectify
DomainError inT must be 1x3 matrix in cvStereoRectify
DomainError Supported matrix sizes for inDistCoeffs1 are: 1x4, 4x1, 1x5, 5x1, 1x8, 8x1, 1x12, 12x1 in cvStereoRectify.
DomainError Supported matrix sizes for inDistCoeffs2 are: 1x4, 4x1, 1x5, 5x1, 1x8, 8x1, 1x12, 12x1 in cvStereoRectify.

Complexity Level

This filter is available on Basic Complexity Level.