为什么我们需要将 (camera_matrix 1 & 2) 和 (R and T) 参数都输入到 stereoRectify()?

Why do we need to input both (camera_matrix 1 & 2) and (R and T) params to stereoRectify()?

要进行立体声校准,我们需要执行 3 个步骤(输入参数 --> 输出参数):

  1. calibrateCamera(): obj_corners, img_corners --> camera_matrix, distortion_coeffs

  2. stereoCalibrate(): obj_corners, img_corners1/2, camera_matrix1/2, distortion_coeffs1/2 --> R, T, E, F

  3. stereoRectify(): camera_matrix1/2, distortion_coeffs1/2, R, T --> R1/2, P1/2, Q

我错过了一些参数。

现在我们可以将 Q 用于 reprojectImageTo3D() and P1 or P2 for triangulatePoints()

但为什么我们需要同时输入 (camera_matrix 1 & 2) 和 (R & T) 参数到 stereoRectify()?

众所周知camera_matrix已经包含R & T:

struct CV_EXPORTS CameraParams
{
    CameraParams();
    CameraParams(const CameraParams& other);
    const CameraParams& operator =(const CameraParams& other);
    Mat K() const;

    double focal; // Focal length
    double aspect; // Aspect ratio
    double ppx; // Principal point X
    double ppy; // Principal point Y
    Mat R; // Rotation
    Mat t; // Translation
};

我们从calibrateCamera()得到的R&T和我们从stereoCalibrate()得到的CameraParams中包含的R&T有什么区别?

这里的问题是术语不一致。 OpenCV 调用的 相机矩阵 是一个包含内在函数的 3x3 矩阵 K。 Harley 和 Zisserman 所说的 相机矩阵 是一个 3x4 相机投影矩阵 P = K * [R|t],它包括内部和外部。