OpenCv StereoRectify中矩阵的确切定义 [英] Exact definition of the matrices in OpenCv StereoRectify

查看:836
本文介绍了OpenCv StereoRectify中矩阵的确切定义的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

通常,投影矩阵 P 的定义是将点从世界坐标投影到图像/像素坐标的3x4矩阵.投影矩阵可以分为:

Normally the definition of a projection matrix P is the 3x4 matrix which projects point from world coordinates to image/pixel coordinates. The projection matrix can be split up into:

  • K :具有固有参数的3x4摄像机矩阵K
  • T :具有外部参数的4x4转换矩阵
  • K: a 3x4 camera matrix K with the intrinsic parameters
  • T: a 4x4 transformation matrix with the extrinsic parameters

投影矩阵为 P = K * T .

The projection matrix is then P = K * T.

OpenCV的stereoRectify的以下输入的明确定义是什么:

What are the clear definitions of the following input to OpenCV's stereoRectify:

  • cameraMatrix1 –第一个相机矩阵(我假设它是投影矩阵的内在K部分,对吗?).
  • R –第一和第二摄像机的坐标系之间的旋转矩阵. (之间"是什么意思?是从cam1到cam2还是从cam2到cam1的旋转?) T –摄像机坐标系之间的平移矢量. (与上面相同.是cam1-> cam2还是cam2-> cam1的翻译)
  • R1 –为第一个摄像机输出3x3整流变换(旋转矩阵). (这是整流后的旋转,因此投影矩阵的新外部部分变成T1new = R1 * T1old吗?)
  • P1 –在第一个摄影机的新(校正)坐标系中输出3x4投影矩阵. (新坐标系中的投影矩阵"是什么意思?该投影矩阵似乎依赖于旋转矩阵R1来将点从世界坐标投影到图像/像素坐标,因此根据以上定义,它是既不是投影矩阵"也不是相机矩阵",而是两者的某种混合)
  • cameraMatrix1 – First camera matrix (I assume it is the instrinsic K part of the projection matrix, correct?).
  • R – Rotation matrix between the coordinate systems of the first and the second cameras. (what does 'between' means? Is it the rotation from cam1 to cam2 or from cam2 to cam1?)
  • T – Translation vector between coordinate systems of the cameras. (Same is above. Is the translation from cam1 -> cam2 or cam2->cam1)
  • R1 – Output 3x3 rectification transform (rotation matrix) for the first camera. (Is this the rotation after rectification so the new extrinsic part of the projection matrix becomes T1new = R1*T1old?)
  • P1 – Output 3x4 projection matrix in the new (rectified) coordinate systems for the first camera. (What is meant by 'projection matrix in the new coordinate system'? It seems that this projection matrix is dependent on the rotation matrix R1 to project point from world coordinates to image/pixel coordinates, so from the above definition it is neither the 'projection matrix' or the 'camera matrix' but some kind of mixture of the two)

推荐答案

  1. CAMERAMATRIX1 -是由opencv中的立体声校准()函数计算的固有K矩阵.你说对了!
  2. R 是cam2帧相对于cam1帧的旋转矩阵.类似地, T 是cam2原点w.r.t的翻译向量 cam1的起源.
  3. 如果您浏览O'Riley的书籍"LEARNING OPENCV"第-434页,将会了解 R1 (/ Rl )和 R2 (/ Rr )是.

    Rl = [直立] [ rl ]; Rr = [ Rect ] [ rr ];

    让相机的图片平面为plane1和plane2.如果尚未完成立体声整流,则plane1和plane2根本不会平行.此外,主视线将不会与立体相机的基线平行.因此,Rl所做的是将左图像平面转换为与右图像平面平行(由Rr转换),并且两个图像上的背线现在都平行.
  4. P1 P2 是立体校正后的新投影矩阵.请记住,相机矩阵(K)将3d空间中的点变换到2d图像平面上.但是P1和P2在校正的2d图像平面上变换3d空间中的点.
    如果您之前已经校准了立体相机设备并观察了P1和K1值,那么您将发现,如果您的立体设备几乎处于整流配置(显然在人的范围内),它们将非常相似
  1. CAMERAMATRIX1 - is the intrinsic K matrix as computed by stereocalibrate() function in opencv. you got it right!!!
  2. R is the rotation matrix of cam2 frame w.r.t cam1 frame. Similarily , T is the translation vector of cam2 origin w.r.t cam1 origin.
  3. If you'll look in O'Riley book "LEARNING OPENCV" pg.-434, you'll understand what R1(/Rl) and R2(/Rr) are.

    Rl=[Rrect][rl]; Rr=[Rect][rr];

    let camera's picture planes be plane1 and plane2. When stereo rectification hasn't been done , then plane1 and plane2 will not be parallel at all. Also, the epilines willn't be parallel to the stereo camera baseline. So, what Rl does is that it transforms the left image plane to be parallel to right image plane(which is transformed by Rr) and also , epilines on both images are now parallel .
  4. P1 and P2 are the new projection matrices after stereo rectification. Remember, camera matrix(K) transforms a point in 3d space onto 2d image plane. But P1 and P2 transforms a point in 3d space on rectified 2d image planes.
    if you have calibrated a stereo camera rig before and observed the P1 and K1 values, you'll find that they are pretty much similiar if your stereo rig is almost in rectified configuration (obviously within human range)

这篇关于OpenCv StereoRectify中矩阵的确切定义的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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