Method StereoRectify
- Namespace
- OpenCvSharp
- Assembly
- OpenCvSharp.dll
StereoRectify(InputArray, InputArray, InputArray, InputArray, Size, InputArray, InputArray, OutputArray, OutputArray, OutputArray, OutputArray, OutputArray, FishEyeCalibrationFlags, Size, double, double)
Stereo rectification for fisheye camera model
public static void StereoRectify(InputArray k1, InputArray d1, InputArray k2, InputArray d2, Size imageSize, InputArray r, InputArray tvec, OutputArray r1, OutputArray r2, OutputArray p1, OutputArray p2, OutputArray q, FishEyeCalibrationFlags flags, Size newImageSize = default, double balance = 0, double fovScale = 1)
Parameters
k1InputArrayFirst camera matrix.
d1InputArrayFirst camera distortion parameters.
k2InputArraySecond camera matrix.
d2InputArraySecond camera distortion parameters.
imageSizeSizeSize of the image used for stereo calibration.
rInputArrayRotation matrix between the coordinate systems of the first and the second cameras.
tvecInputArrayTranslation vector between coordinate systems of the cameras.
r1OutputArrayOutput 3x3 rectification transform (rotation matrix) for the first camera.
r2OutputArrayOutput 3x3 rectification transform (rotation matrix) for the second camera.
p1OutputArrayOutput 3x4 projection matrix in the new (rectified) coordinate systems for the first camera.
p2OutputArrayOutput 3x4 projection matrix in the new (rectified) coordinate systems for the second camera.
qOutputArrayOutput 4x4 disparity-to-depth mapping matrix (see reprojectImageTo3D ).
flagsFishEyeCalibrationFlagsOperation flags that may be zero or CALIB_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.
newImageSizeSizeNew 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 larger value can help you preserve details in the original image, especially when there is a big radial distortion.
balancedoubleSets the new focal length in range between the min focal length and the max focal length.Balance is in range of[0, 1].
fovScaledoubleDivisor for new focal length.