为什么我们需要将(camera_matrix 1& 2)和(R和T)参数输入到stereoRectify()? [英] Why do we need to input both (camera_matrix 1 & 2) and (R and T) params to stereoRectify()?

查看:2225
本文介绍了为什么我们需要将(camera_matrix 1& 2)和(R和T)参数输入到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 for reprojectImageTo3D() 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; //焦距
双方面; // Aspect ratio
double ppx; // Principal X
double ppy; //主点Y
Mat R; // Rotation
Mat t; // Translation
};

T,我们从 calibrateCamera() 和R& T,它包含在CameraParams中,我们从 c>


<%> 20F,%20TermCriteria%20criteria,%20int%20flags) =nofollow div class =h2_lin>解决方案

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


To do stereo calibrate we need to do 3 steps (input params --> output params):

  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

Some params I missed.

And now we can use Q for reprojectImageTo3D() and P1 or P2 for triangulatePoints().

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

As known camera_matrix already contain 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
};

What's the difference between R & T which we get from calibrateCamera() and R & T that contained in CameraParams which we get from stereoCalibrate()?

解决方案

The problem here is inconsistent terminology. What OpenCV calls camera matrix is a 3x3 matrix K containing the intrinsics. What Harley and Zisserman call camera matrix is a 3x4 camera projection matrix P = K * [R|t], which includes both the intrinsics and the extrinsics.

这篇关于为什么我们需要将(camera_matrix 1&amp; 2)和(R和T)参数输入到stereoRectify()?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆