stereoRectify
import { stereoRectify } from '@banou/opencv-wasm'Use after await initOpenCV(). See the initialization and named imports guide.
Computes rectification transforms for each head of a calibrated stereo camera.
stereoRectify(cameraMatrix1: Mat, distCoeffs1: Mat, cameraMatrix2: Mat, distCoeffs2: Mat, imageSize: Size, R: Mat, T: Mat, R1: Mat, R2: Mat, P1: Mat, P2: Mat, Q: Mat, flags: number, alpha: number, newImageSize: Size): stereoRectifyResult;4 available overloads
stereoRectify(cameraMatrix1: Mat, distCoeffs1: Mat, cameraMatrix2: Mat, distCoeffs2: Mat, imageSize: Size, R: Mat, T: Mat, R1: Mat, R2: Mat, P1: Mat, P2: Mat, Q: Mat): stereoRectifyResult;stereoRectify(cameraMatrix1: Mat, distCoeffs1: Mat, cameraMatrix2: Mat, distCoeffs2: Mat, imageSize: Size, R: Mat, T: Mat, R1: Mat, R2: Mat, P1: Mat, P2: Mat, Q: Mat, flags: number): stereoRectifyResult;stereoRectify(cameraMatrix1: Mat, distCoeffs1: Mat, cameraMatrix2: Mat, distCoeffs2: Mat, imageSize: Size, R: Mat, T: Mat, R1: Mat, R2: Mat, P1: Mat, P2: Mat, Q: Mat, flags: number, alpha: number): stereoRectifyResult;stereoRectify(cameraMatrix1: Mat, distCoeffs1: Mat, cameraMatrix2: Mat, distCoeffs2: Mat, imageSize: Size, R: Mat, T: Mat, R1: Mat, R2: Mat, P1: Mat, P2: Mat, Q: Mat, flags: number, alpha: number, newImageSize: Size): stereoRectifyResult;cameraMatrix1First camera intrinsic matrix.
distCoeffs1First camera distortion parameters.
cameraMatrix2Second camera intrinsic matrix.
distCoeffs2Second camera distortion parameters.
imageSizeSize of the image used for stereo calibration.
RRotation matrix from the coordinate system of the first camera to the second camera, see
stereoCalibrate.TTranslation vector from the coordinate system of the first camera to the second camera, see
stereoCalibrate.R1Output destination, filled by the native operation. Output 3x3 rectification transform (rotation matrix) for the first camera. This matrix brings points given in the unrectified first camera's coordinate system to points in the rectified first camera's coordinate system. In more technical terms, it performs a change of basis from the unrectified first camera's coordinate system to the rectified first camera's coordinate system.
R2Output destination, filled by the native operation. Output 3x3 rectification transform (rotation matrix) for the second camera. This matrix brings points given in the unrectified second camera's coordinate system to points in the rectified second camera's coordinate system. In more technical terms, it performs a change of basis from the unrectified second camera's coordinate system to the rectified second camera's coordinate system.
P1Output destination, filled by the native operation. Output 3x4 projection matrix in the new (rectified) coordinate systems for the first camera, i.e. it projects points given in the rectified first camera coordinate system into the rectified first camera's image.
P2Output destination, filled by the native operation. Output 3x4 projection matrix in the new (rectified) coordinate systems for the second camera, i.e. it projects points given in the rectified first camera coordinate system into the rectified second camera's image.
QOutput destination, filled by the native operation. Output
4 \times 4disparity-to-depth mapping matrix (seereprojectImageTo3D).flagsOperation flags that may be zero or
STEREO_ZERO_DISPARITY. 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 (depending on the orientation of epipolar lines) to maximize the useful image area.alphaFree scaling parameter. If it is -1 or absent, the function performs the default scaling. Otherwise, the parameter should be between 0 and 1. alpha=0 means that the rectified images are zoomed and shifted so that only valid pixels are visible (no black areas after rectification). alpha=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 (no source image pixels are lost). Any intermediate value yields an intermediate result between those two extreme cases.
newImageSizeNew image resolution after rectification. The same size should be passed to #initUndistortRectifyMap (see the stereo_calib.cpp sample in OpenCV samples directory). When (0,0) is passed (default), it is set to the original imageSize . Setting it to a larger value can help you preserve details in the original image, especially when there is a big radial distortion.
The stereoRectifyResult result. Scalar output parameters are returned as named fields in this object. Release returned native handles with using or delete(), including handles nested in results.
These signatures describe this package. Upstream documentation can mention optional backends that are absent from this build. Check runtime compatibility before choosing a backend or file format.