OpenCV中摄像机坐标系定义

OpenCV中摄像机坐标系定义-存档用的奥

The functions in this section use the so-called pinhole camera model. That is, a scene view is formed by projecting 3D points into the image plane using a perspective transformation.

s \; m' = A [R|t] M'

or

s \vecthree {u}{v}{1} = \vecthreethree {f_ x}{0}{c_ x} {0}{f_ y}{c_ y} {0}{0}{1} \begin{bmatrix} r_{11} & r_{12} & r_{13} & t_1 \\ r_{21} & r_{22} & r_{23} & t_2 \\ r_{31} & r_{32} & r_{33} & t_3 \end{bmatrix} \begin{bmatrix} X \\ Y \\ Z \\ 1 \end{bmatrix}

Where $(X, Y, Z)$ are the coordinates of a 3D point in the world coordinate space, $(u, v)$ are the coordinates of the projection point in pixels. $A$ is called a camera matrix, or a matrix of intrinsic parameters. $(cx, cy)$ is a principal point (that is usually at the image center), and $fx, fy$ are the focal lengths expressed in pixel-related units. Thus, if an image from camera is scaled by some factor, all of these parameters should be scaled (multiplied/divided, respectively) by the same factor. The matrix of intrinsic parameters does not depend on the scene viewed and, once estimated, can be re-used (as long as the focal length is fixed (in case of zoom lens)). The joint rotation-translation matrix $[R|t]$ is called a matrix of extrinsic parameters. It is used to describe the camera motion around a static scene, or vice versa, rigid motion of an object in front of still camera. That is, $[R|t]$ translates coordinates of a point $(X, Y, Z)$ to some coordinate system, fixed with respect to the camera. The transformation above is equivalent to the following (when $z \ne 0$):

\begin{array}{l} \vecthree {x}{y}{z} = R \vecthree {X}{Y}{Z} + t\\ x' = x/z\\ y' = y/z\\ u = f_ x*x' + c_ x\\ v = f_ y*y' + c_ y \end{array}

Real lenses usually have some distortion, mostly radial distorion and slight tangential distortion. So, the above model is extended as:

\begin{array}{l} \vecthree {x}{y}{z} = R \vecthree {X}{Y}{Z} + t\\ x' = x/z\\ y' = y/z\\ x” = x' (1 + k_1 r^2 + k_2 r^4 + k_3 r^6) + 2 p_1 x' y' + p_2(r^2 + 2 x'^2) \\ y” = y' (1 + k_1 r^2 + k_2 r^4 + k_3 r^6) + p_1 (r^2 + 2 y'^2) + 2 p_2 x' y' \\ \text {where} \quad r^2 = x'^2 + y'^2 \\ u = f_ x*x” + c_ x\\ v = f_ y*y” + c_ y \end{array}

$k_1$, $k_2$, $k_3$ are radial distortion coefficients, $p_1$, $p_2$ are tangential distortion coefficients. Higher-order coefficients are not considered in OpenCV. In the functions below the coefficients are passed or returned as

(k_1, k_2, p_1, p_2[, k_3])

vector. That is, if the vector contains 4 elements, it means that $k_3=0$. The distortion coefficients do not depend on the scene viewed, thus they also belong to the intrinsic camera parameters. And they remain the same regardless of the captured image resolution. That is, if, for example, a camera has been calibrated on images of $320 \times 240$ resolution, absolutely the same distortion coefficients can be used for images of $640 \times 480$ resolution from the same camera (while $f_ x$, $f_ y$, $c_ x$ and $c_ y$ need to be scaled appropriately).

The functions below use the above model to

  • Project 3D points to the image plane given intrinsic and extrinsic parameters
  • Compute extrinsic parameters given intrinsic parameters, a few 3D points and their projections.
  • Estimate intrinsic and extrinsic camera parameters from several views of a known calibration pattern (i.e. every view is described by several 3D-2D point correspodences).
  • Estimate the relative position and orientation of the stereo camera “heads” and compute the rectification transformation that makes the camera optical axes parallel.
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值