• Matlab 双目标定工具箱


    环境:

    Matlab R2016a ,只有2014a以后的版本才有stereoCalibrator这个工具箱

    参数解释:

    输入参数

    size of checkboard suqare  =83mm:

    标定板一个小格的边长。这是所有输入量中唯一一个有世界尺度信息的量,用于把以像素为单位的值转化成以mm或者m为单位的值;

    左右相机图片:

    尽量使标定板占满图片;

    estimate skew = ture:

    Camera axes skew, specified as a scalar. If the x and the y axes are exactly perpendicular, then set the skew to 0.

    相机x,y轴的倾斜,是个标量。如果x,y完全垂直,则skew=0;

    我标定后得到的结果skew值不为0~说明xy轴不完全垂直,可能也是后面求disparity不准的原因之一吧。

    camera distortion 畸变参数

    径向畸变系数的个数,2 coefficient或者3 ~; 切向畸变 estimateTangentialDistortion = true 

    解释:

    径向畸变是,坐标点距离原点的长度不正常;切向畸变是,坐标点沿着切线方向发生变化,水平夹角异常 --  高博SLAM十四讲

    1 radial distortion 径向畸变

    Radial distortion coefficients, specified as either a 2- or 3-element vector. When you specify a 2-element vector, the object sets the third element to 0. Radial distortion occurs when light rays bend more near the edges of a lens than they do at its optical center. The smaller the lens, the greater the distortion. The camera parameters object calculates the radial distorted location of a point. You can denote the distorted points as (xdistorted, ydistorted), as follows:

    径向畸变系数,2元或者3元向量。用来矫正由透镜形状引起的径向畸变(光线穿过透镜时,在透镜边缘弯曲程度大于靠近中心处的弯曲程度,造成桶形失真或者枕形失真)。

                                         

                                                          枕形失真                                                                                                       

                             

                                                         桶形失真

     所以用k1,k2,k3三个参数矫正径向畸变。

    xdistorted = x(1 + k1*r2 + k2*r4 + k3*r6)

    ydistorted= y(1 + k1*r2 + k2*r4 + k3*r6)

    xy = undistorted pixel locations
    k1, k2, and k3 = radial distortion coefficients of the lens
    r2 = x2 + y2

    高翔《视觉SLAM十四讲》中写到:对于畸变较小的图像中心区域,主要是k1起作用;对于畸变较大的边缘区域主要是k2起作用。普通相机这两个系数就够用了,

    对于鱼眼相机这种畸变特别大的才用的上第三个参数k3  

     Typically, two coefficients are sufficient. For severe distortion, you can include k3. The undistorted pixel locations appear in normalized image coordinates, with the origin at the optical center. The coordinates are expressed in world units.

    去畸变后的点位于归一化平面上(不是像素平面),原点在光心。坐标以世界单位(默认毫米)表示

    2 tangential distortion 切向畸变

    Tangential distortion coefficients, specified as a 2-element vector. Tangential distortion occurs when the lens and the image plane are not parallel. The camera parameters object calculates the tangential distorted location of a point. You can denote the distorted points as (xdistorted, ydistorted), as follows:

    切向畸变是由镜头和成像平面不完全平行引起的。由两个元素p1,p2矫正:

    xdistorted = x + [2 * p1 * y + p2 * (r2 + 2 * x2)]

    ydistorted = y + [p1 * (r2 + 2*y2) + 2 * p2 * x]

    xy = undistorted pixel locations
    p1 and p2 = tangential distortion coefficients of the lens
    r2 = x2 + y2

    The undistorted pixel locations appear in normalized image coordinates, with the origin at the optical center. The coordinates are expressed in world units.

    同上。

     worldunit  现实世界中的单位,默认毫米

    输出的translationVector是以世界坐标系为单位,而两个相机的内参则是以像素为单位

     

    输出参数             

    双目参数: 

    RotationOfCamera2: 相机2相对于相机1的旋转矩阵

    TranslationOfCamera2:相机2相对于相机1的平移矩阵 ,此处注意,以世界单位mm为单位

    FundamentalMatrix: 基础矩阵 F 

    CameraParameters1:

    径向畸变切向畸变相关参数上面已经解释过

    InstrinsicMatrix:相机内参矩阵 的转置

    Projection matrix, specified as a 3-by-3 identity matrix. The object uses the following format for the matrix format:

    3乘3的投影矩阵

    fx,fy是焦距F分别乘上x,y方向上的缩放系数sx,sy得到的。以像素为单位 。sx表示x方向上每个world unit内像素的数量

    cx,cy表示光心在图像坐标系上的投影的坐标(也就是图像坐标系与相机坐标系之间的偏移)

    The coordinates [cx cy] represent the optical center (the principal point), in pixels. When the x and y axis are exactly perpendicular, the skew parameter, s, equals 0.

    fx = F*sx
    fy = F*sy
    F, is the focal length in world units, typically expressed in millimeters.
    [sx, sy] are the number of pixels per world unit in the x and y direction respectively.
    fx and fy are expressed in pixels.

    FocalLength和PrincipalPoint,也就是内参矩阵里的fx,fy,cx,cy

  • 相关阅读:
    软工实践个人总结
    第06组 Beta版本演示
    第06组 Beta冲刺(5/5)
    第06组 Beta冲刺(4/5)
    第06组 Beta冲刺(3/5)
    第06组 Beta冲刺(2/5)
    第06组 Beta冲刺(1/5)
    第06组 Alpha事后诸葛亮
    第06组 Alpha冲刺(6/6)
    第06组 Alpha冲刺(5/6)
  • 原文地址:https://www.cnblogs.com/voyagee/p/7524946.html
Copyright © 2020-2023  润新知