Camera Calibration [相机标定-张正友]

【计算机视觉】张正友相机标定Calibration原理过程结果 一、数学原理 1.将世界坐标转换为图像坐标: 其中R为33的旋转矩阵,t为31的平移矢量,(xc,yc,zc,1)T(xc,yc,zc,1)T为相机坐标系的齐次坐标,(xw,yw,zw,1)T(xw,yw,zw,1)T为世界坐标系的齐次坐标。 2.图像坐标转换为像素坐标系: 其中,dXdX、dYdY分别为像素在XX、YY轴方向上的物理尺寸,u0,v0 u0,v0为主点(图像原点)坐标。 3.针... 阅读详情

From:Blog

1. camera model

  • X c Y c Z c X_cY_cZ_c Xc​Yc​Zc​ : camera coordinate system
  • u v uv uv: pixel coordinate system, [dimension in pixel]
  • x y xy xy: image coordinate system, [dimension in mm]
  • X Y Z XYZ XYZ: word coordinate system, [dimension in pixel]

2. X Y Z ⇒ X c Y c Z c XYZ \Rightarrow X_cY_cZ_c XYZ⇒Xc​Yc​Zc​

the main process is to transform points in word coordinate system X Y Z XYZ XYZ into camera coordinate system X c Y c Z c X_cY_cZ_c Xc​Yc​Zc​, this process is done with a rotation and shift matrix
[ x c y c z c 1 ] = [ R T 0 1 ] [ x w y w x w 1 ] \begin{bmatrix} x_c \\ y_c \\ z_c \\ 1 \end{bmatrix} =\begin{bmatrix} R & T \\ 0 & 1 \\ \end{bmatrix} \begin{bmatrix} x_w \\ y_w \\ x_w \\ 1 \end{bmatrix} ⎣⎢⎢⎡​xc​yc​zc​1​⎦⎥⎥⎤​=[R0​T1​]⎣⎢⎢⎡​xw​yw​xw​1​⎦⎥⎥⎤​
where R R R is the rotation matrix
R = [ r 11 r 12 r 13 r 21 r 22 r 23 r 31 r 32 r 33 ] R=\begin{bmatrix} r_{11} & r_{12} & r_{13} \\ r_{21} & r_{22} & r_{23} \\ r_{31} & r_{32} & r_{33} \end{bmatrix} R=⎣⎡​r11​r21​r31​​r12​r22​r32​​r13​r23​r33​​⎦⎤​
and T T T is the shift vector
T = [ t x t y t z ] T T=\begin{bmatrix} t_x & t_y & t_z \end{bmatrix} ^T T=[tx​​ty​​tz​​]T

3. X c Y c Z c ⇒ x y X_cY_cZ_c \Rightarrow xy Xc​Yc​Zc​⇒xy

After transformed in camera coordinate system, we can project the points into the image plane using pinhole model. suppose the point p c = ( x c , y c , z c ) T p_c=(x_c, y_c, z_c)^T pc​=(xc​,yc​,zc​)T in camera coordinate system, then it’s coordinate in image plane can be obtained as the follow:
x x w = y y w = f z w \frac{x}{x_w} = \frac{y}{y_w} = \frac{f}{z_w} xw​x​=yw​y​=zw​f​
so
{ x = f x c z c y = f y c z c \left\{ \begin{aligned} x & = \frac{fx_c}{z_c} \\ y & = \frac{fy_c}{z_c} \end{aligned} \right. ⎩⎪⎪⎨⎪⎪⎧​xy​=zc​fxc​​=zc​fyc​​​

thus
z c [ x y 1 ] = [ f 0 0 0 0 f 0 0 0 0 1 0 ] [ x c y c z c 1 ] z_c\begin{bmatrix} x \\ y \\ 1 \end{bmatrix} =\begin{bmatrix} f & 0 & 0 & 0\\ 0 & f & 0 & 0\\ 0 & 0 & 1 & 0\\ \end{bmatrix} \begin{bmatrix} x_c \\ y_c \\ z_c \\ 1 \end{bmatrix} zc​⎣⎡​xy1​⎦⎤​=⎣⎡​f00​0f0​001​000​⎦⎤​⎣⎢⎢⎡​xc​yc​zc​1​⎦⎥⎥⎤​

4. x y ⇒ u v xy \Rightarrow uv xy⇒uv

4.1 condition: u ⊥ v u \perp v u⊥v

usually, the origin point of pixel coordinate system is located in the top left corner while the origin of image coordinate system is located in the center of the image plane, causing a shift vector ( u 0 , v 0 ) (u_0,v_0) (u0​,v0​) between this two coordinate system.

Denoted the size of each pixel in u , v u,v u,v direction as d x , d y dx,dy dx,dy (dimension in mm). then we can get the relationship between them.
[ u v 1 ] = [ 1 d x 0 u 0 0 1 d y v 0 0 0 1 ] [ x y 1 ] \begin{bmatrix} u \\ v \\ 1 \end{bmatrix} =\begin{bmatrix} \frac{1}{dx} & 0 & u_0 \\ 0 & \frac{1}{dy} & v_0 \\ 0 & 0 & 1 \\ \end{bmatrix} \begin{bmatrix} x \\ y \\ 1 \end{bmatrix} ⎣⎡​uv1​⎦⎤​=⎣⎡​dx1​00​0dy1​0​u0​v0​1​⎦⎤​⎣⎡​xy1​⎦⎤​

4.2 condition: u ⊥̸ v u \not{\perp} v u​⊥v

In this condition, the matrix is a little complex but still easy to understand
{ u = x − y c o t θ d x + u 0 v = y d y s i n θ + v 0 \left\{ \begin{aligned} u & = \frac{x-ycot\theta}{dx}+u_0 \\ v & = \frac{y}{dysin\theta}+v_0 \end{aligned} \right. ⎩⎪⎨⎪⎧​uv​=dxx−ycotθ​+u0​=dysinθy​+v0​​
thus
[ u v 1 ] = [ 1 d x − 1 d x t a n θ u 0 0 1 d y s i n θ v 0 0 0 1 ] [ x y 1 ] = [ α x c u 0 0 α y v 0 0 0 1 ] [ x y 1 ] \begin{aligned} \begin{bmatrix} u \\ v \\ 1 \end{bmatrix} & =\begin{bmatrix} \frac{1}{dx} & -\frac{1}{d_xtan\theta} & u_0 \\ 0 & \frac{1}{dysin\theta} & v_0 \\ 0 & 0 & 1 \\ \end{bmatrix} \begin{bmatrix} x \\ y \\ 1 \end{bmatrix} \\ & =\begin{bmatrix} \alpha_x & c & u_0 \\ 0 & \alpha_y & v_0 \\ 0 & 0 & 1 \\ \end{bmatrix} \begin{bmatrix} x \\ y \\ 1 \end{bmatrix} \end{aligned} ⎣⎡​uv1​⎦⎤​​=⎣⎡​dx1​00​−dx​tanθ1​dysinθ1​0​u0​v0​1​⎦⎤​⎣⎡​xy1​⎦⎤​=⎣⎡​αx​00​cαy​0​u0​v0​1​⎦⎤​⎣⎡​xy1​⎦⎤​​

5. relation

Through the analysis of above, the relationship between world and pixel coordinate system can be written as follows:
z c [ u v 1 ] = [ α x c u 0 0 0 α y v 0 0 0 0 1 ] [ f 0 0 0 0 f 0 0 0 0 1 0 ] [ R T 0 1 ] [ x w y w x w 1 ] = [ α x c u 0 0 0 α y v 0 0 0 0 1 0 ] [ R T 0 1 ] [ x w y w x w 1 ] = M 1 M 2 X w = M X w \begin{aligned} z_c\begin{bmatrix} u \\ v \\ 1 \end{bmatrix} & =\begin{bmatrix} \alpha_x & c & u_0 & 0 \\ 0 & \alpha_y & v_0 & 0 \\ 0 & 0 & 1 \\ \end{bmatrix} \begin{bmatrix} f & 0 & 0 & 0\\ 0 & f & 0 & 0\\ 0 & 0 & 1 & 0\\ \end{bmatrix} \begin{bmatrix} R & T \\ 0 & 1 \\ \end{bmatrix} \begin{bmatrix} x_w \\ y_w \\ x_w \\ 1 \end{bmatrix} \\ & =\begin{bmatrix} \alpha_x & c & u_0 & 0 \\ 0 & \alpha_y & v_0 & 0 \\ 0 & 0 & 1 & 0 \end{bmatrix} \begin{bmatrix} R & T \\ 0 & 1 \\ \end{bmatrix} \begin{bmatrix} x_w \\ y_w \\ x_w \\ 1 \end{bmatrix} \\ & =M_1M_2X_w \\ & = MX_w \end{aligned} zc​⎣⎡​uv1​⎦⎤​​=⎣⎡​αx​00​cαy​0​u0​v0​1​00​⎦⎤​⎣⎡​f00​0f0​001​000​⎦⎤​[R0​T1​]⎣⎢⎢⎡​xw​yw​xw​1​⎦⎥⎥⎤​=⎣⎡​αx​00​cαy​0​u0​v0​1​000​⎦⎤​[R0​T1​]⎣⎢⎢⎡​xw​yw​xw​1​⎦⎥⎥⎤​=M1​M2​Xw​=MXw​​
where α x = f / d x \alpha_x=f/dx αx​=f/dx and α y = f / d y \alpha_y=f/dy αy​=f/dy is called scale factors in image u u u and v v v axes, M 1 M_1 M1​ is called camera intrinsic matrix, M 2 M_2 M2​ is called camera extrinsic parameters,c is the parameter describing the skewness of the two image axes.

6. Camera Calibration

6.1. general conception

The method is proposed by Zhengyou Zhang which only require a camera to observe a planar patttern at a few (at least two) different orientations.

In order to keep equations consistent with the paper written by Zhengyou Zhang, here the transformation matrix is rewritten as the follow.
s m ~ = A [ R t ] M ~ s\widetilde{m}=A\begin{bmatrix}R & t\end{bmatrix}\widetilde{M} sm =A[R​t​]M
where m ~ = [ u , v , 1 ] T \widetilde{m}=\begin{bmatrix}u,v,1\end{bmatrix}^T m =[u,v,1​]T represent the 2D point and M ~ = [ X , Y , Z , 1 ] T \widetilde{M}=\begin{bmatrix}X,Y, Z,1\end{bmatrix}^T M =[X,Y,Z,1​]T represent the corresponding 3D point and
A = [ α c u 0 0 β v 0 0 0 1 ] A=\begin{bmatrix} \alpha & c & u_0 \\ 0 & \beta &v_0 \\ 0 & 0 & 1 \end{bmatrix} A=⎣⎡​α00​cβ0​u0​v0​1​⎦⎤​
To calibrate the camera, the model plane was assumed to be Z = 0 Z=0 Z=0, then
s [ u v 1 ] = A [ r 1 r 2 r 3 t ] [ X Y 0 1 ] = A [ r 1 r 2 t ] [ X Y 1 ] s \begin{bmatrix} u \\ v \\ 1 \end{bmatrix} =A\begin{bmatrix} r_1 & r_2 & r_3 & t \end{bmatrix} \begin{bmatrix} X \\ Y \\ 0 \\ 1 \end{bmatrix} =A\begin{bmatrix} r_1 & r_2 & t \end{bmatrix} \begin{bmatrix} X \\ Y \\ 1 \end{bmatrix} s⎣⎡​uv1​⎦⎤​=A[r1​​r2​​r3​​t​]⎣⎢⎢⎡​XY01​⎦⎥⎥⎤​=A[r1​​r2​​t​]⎣⎡​XY1​⎦⎤​
according to the above equation, M ~ = [ X , Y , 1 ] T \widetilde{M}=\begin{bmatrix}X,Y,1\end{bmatrix}^T M =[X,Y,1​]T is defined in the following part. therefore, the homography matrix H H H is induced.
s m ~ = H M ~ s\widetilde{m}=H\widetilde{M} sm =HM
where
H = A [ r 1 r 2 t ] H=A\begin{bmatrix}r_1 & r_2 & t\end{bmatrix} H=A[r1​​r2​​t​]

6.2. Estimation of the homography matrix H H H

M i M_i Mi​ and m i m_i mi​ respectively represent the model and image points. According to maximum likelihood method, the object function should be minimized.
∑ i ( m i − m i ^ ) T Λ − 1 ( m i − m i ^ ) \sum_i(m_i-\hat{m_i})^T\Lambda^{-1}(m_i-\hat{m_i}) i∑​(mi​−mi​^​)TΛ−1(mi​−mi​^​)
where
m i ^ = 1 h 3 ˉ M i [ h 1 ˉ M i h 2 ˉ M i ] \hat{m_i}=\frac{1}{\bar{h_3}M_i}\begin{bmatrix} \bar{h_1}M_i \\ \bar{h_2}M_i \end{bmatrix} mi​^​=h3​ˉ​Mi​1​[h1​ˉ​Mi​h2​ˉ​Mi​​]
h i ˉ \bar{h_i} hi​ˉ​ is the i t h i^{th} ith row of H, assuming Λ m i = σ 2 I \Lambda_{m_i}=\sigma^2I Λmi​​=σ2I for all i i i, thus, ∑ i ∣ ∣ m i − m i ^ ∣ ∣ 2 \sum\limits_i||m_i-\hat{m_i}||^2 i∑​∣∣mi​−mi​^​∣∣2 should be minimized. The Levenberg-Marquardt algorithm was implemented and initial guess can be obtained as follows:

Let x = [ h 1 T ˉ , h 2 T ˉ , h 3 T ˉ ] T x=[\bar{h_1^T},\bar{h_2^T},\bar{h_3^T}]^T x=[h1T​ˉ​,h2T​ˉ​,h3T​ˉ​]T. then s m ~ = H M ~ s\widetilde{m}=H\widetilde{M} sm =HM can be rewritten as
[ M ~ T 0 T − u M ~ T 0 T M ~ T − v M ~ T ] x = 0 \begin{bmatrix} \widetilde{M}^T & 0^T & -u\widetilde{M}^T \\ 0^T & \widetilde{M}^T & -v\widetilde{M}^T \end{bmatrix} x=0 [M T0T​0TM T​−uM T−vM T​]x=0
for example
s [ u i v i 1 ] = [ h 11 h 12 h 13 h 21 h 22 h 23 h 31 h 32 h 33 ] [ x w i y w i 1 ] s \begin{bmatrix} u_i \\ v_i \\ 1 \end{bmatrix} =\begin{bmatrix} h_{11} & h_{12} & h_{13} \\ h_{21} & h_{22} & h_{23} \\ h_{31} & h_{32} & h_{33} \end{bmatrix} \begin{bmatrix} x_{wi} \\ y_{wi} \\ 1 \end{bmatrix} s⎣⎡​ui​vi​1​⎦⎤​=⎣⎡​h11​h21​h31​​h12​h22​h32​​h13​h23​h33​​⎦⎤​⎣⎡​xwi​ywi​1​⎦⎤​
that is
{ h 11 x w i + h 12 y w i + h 13 − h 31 x w i u i − h 32 y w i u i − h 33 u i = 0 h 21 x w i + h 22 y w i + h 23 − h 31 x w i v i − h 32 y w i v i − h 33 v i = 0 \begin{cases} h_{11}x_{wi}+h_{12}y_{wi}+h_{13}-h_{31}x_{wi}u_i-h_{32}y_{wi}u_i-h_{33}u_i & = 0 \\ h_{21}x_{wi}+h_{22}y_{wi}+h_{23}-h_{31}x_{wi}v_i-h_{32}y_{wi}v_i-h_{33}v_i & = 0 \end{cases} {h11​xwi​+h12​ywi​+h13​−h31​xwi​ui​−h32​ywi​ui​−h33​ui​h21​xwi​+h22​ywi​+h23​−h31​xwi​vi​−h32​ywi​vi​−h33​vi​​=0=0​
assuming h 33 = 1 h_{33}=1 h33​=1, because there is no impact on the matrix H H H, this assumes just scale the matrix H H H. so we have
[ x w i y w i 1 0 0 0 − u i x w i − u i y w i − u i 0 0 0 x w i y w i 1 − v i x w i − v i y w i − v i ] [ h 11 h 12 h 13 h 21 h 22 h 23 h 31 h 32 1 ] = 0 \begin{bmatrix} x_{wi} & y_{wi} & 1 & 0 & 0 & 0 & -u_ix_{wi} & -u_iy_{wi} & -u_i \\ 0 & 0 & 0 & x_{wi} & y_{wi} & 1 & -v_ix_{wi} & -v_iy_{wi} & -v_i \end{bmatrix} \begin{bmatrix} h_{11} \\ h_{12} \\ h_{13} \\ h_{21} \\ h_{22} \\ h_{23} \\ h_{31} \\ h_{32} \\ 1 \\ \end{bmatrix}=0 [xwi​0​ywi​0​10​0xwi​​0ywi​​01​−ui​xwi​−vi​xwi​​−ui​ywi​−vi​ywi​​−ui​−vi​​]⎣⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎡​h11​h12​h13​h21​h22​h23​h31​h32​1​⎦⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎤​=0
simply, we have L x = 0 Lx=0 Lx=0, where L L L is a 2 n × 9 2n\times9 2n×9 matrix. for this equation, SVD method can be used or the eigenvector of L T L L^TL LTL can be estimated for this equation. Note that there is one homography matrix for each image and they are different from each other. Since there are 8 unknown parameters, in each image, 4 corresponding points are needed to estimate matrix H H H.

6.3. constraints of intrinsic parameters

denote H as H = [ h 1 h 2 h 3 ] H=\begin{bmatrix}h1 & h_2 & h_3\end{bmatrix} H=[h1​h2​​h3​​], then
[ h 1 h 2 h 3 ] = λ A [ r 1 r 2 r 3 ] \begin{bmatrix}h1 & h_2 & h_3\end{bmatrix}=\lambda A\begin{bmatrix}r1 & r_2 & r_3\end{bmatrix} [h1​h2​​h3​​]=λA[r1​r2​​r3​​]
because r 1 r_1 r1​ and r 2 r_2 r2​ are orthonormal, we have
h 1 T A − T A − 1 h 2 = 0 h 1 T A − T A − 1 h 1 = h 2 T A − T A − 1 h 2 \begin{aligned} h_1^TA^{-T}A^{-1}h_2 & = 0 \\ h_1^TA^{-T}A^{-1}h_1 & = h_2^TA^{-T}A^{-1}h_2 \end{aligned} h1T​A−TA−1h2​h1T​A−TA−1h1​​=0=h2T​A−TA−1h2​​
note that there are 8 parameters (3 for rotation, 3 for translation and 2 for intrinsic parameters)

Let
B = A − T A − 1 = [ B 11 B 12 B 13 B 21 B 22 B 23 B 31 B 32 B 33 ] = [ 1 α x 2 − c α x 2 α y c v 0 − u 0 α y α x 2 α y − c α x 2 α y c 2 α x 2 α y 2 + 1 α y 2 − c ( c v 0 − u 0 α y ) α x 2 α y 2 − v 0 α y 2 c v 0 − u 0 α y α x 2 α y − c ( c v 0 − u 0 α y ) α x 2 α y 2 − v 0 α y 2 ( c v 0 − u 0 α y ) 2 α x 2 α y 2 + v 0 2 α y 2 + 1 ] \begin{aligned} B & =A^{-T}A^{-1}=\begin{bmatrix} B_{11} & B_{12} & B_{13} \\ B_{21} & B_{22} & B_{23} \\ B_{31} & B_{32} & B_{33} \\ \end{bmatrix} \\ & = \begin{bmatrix} \frac{1}{\alpha_x^2} & -\frac{c}{\alpha_x^2\alpha_y} & \frac{cv_0-u_0\alpha_y}{\alpha_x^2\alpha_y} \\ -\frac{c}{\alpha_x^2\alpha_y} & \frac{c^2}{\alpha_x^2\alpha_y^2}+\frac{1}{\alpha_y^2} & -\frac{c(cv_0-u_0\alpha_y)}{\alpha_x^2\alpha_y^2}-\frac{v_0}{\alpha_y^2} \\ \frac{cv_0-u_0\alpha_y}{\alpha_x^2\alpha_y} & -\frac{c(cv_0-u_0\alpha_y)}{\alpha_x^2\alpha_y^2}-\frac{v_0}{\alpha_y^2} & \frac{(cv_0-u_0\alpha_y)^2}{\alpha_x^2\alpha_y^2}+\frac{v_0^2}{\alpha_y^2}+1 \\ \end{bmatrix} \end{aligned} B​=A−TA−1=⎣⎡​B11​B21​B31​​B12​B22​B32​​B13​B23​B33​​⎦⎤​=⎣⎢⎢⎡​αx2​1​−αx2​αy​c​αx2​αy​cv0​−u0​αy​​​−αx2​αy​c​αx2​αy2​c2​+αy2​1​−αx2​αy2​c(cv0​−u0​αy​)​−αy2​v0​​​αx2​αy​cv0​−u0​αy​​−αx2​αy2​c(cv0​−u0​αy​)​−αy2​v0​​αx2​αy2​(cv0​−u0​αy​)2​+αy2​v02​​+1​⎦⎥⎥⎤​​
now, define
b = [ B 11 B 12 B 22 B 13 B 23 B 33 ] b=\begin{bmatrix} B_{11} & B_{12} & B_{22} & B_{13} & B_{23} & B_{33}\\ \end{bmatrix} b=[B11​​B12​​B22​​B13​​B23​​B33​​]
and let the i t h i^{th} ith column vector of H H H be h i = [ h i 1 , h i 2 , h i 3 ] T h_i=\begin{bmatrix}h_{i1},h_{i2},h_{i3}\end{bmatrix}^T hi​=[hi1​,hi2​,hi3​​]T, then
h i T B h j = v i j T b h_i^TBh_j=v_{ij}^Tb hiT​Bhj​=vijT​b
where
v i j = [ h i 1 h j 1 , h i 1 h j 2 + h i 2 h j 1 , h i 2 h j 2 , h i 3 h j 1 + h i 1 h j 3 , h i 3 h j 2 + h i 2 h j 3 , h i 3 h j 3 ] v_{ij}=\begin{bmatrix} h_{i1}h_{j1},h_{i1}h_{j2}+h_{i2}h_{j1},h_{i2}h_{j2},h_{i3}h_{j1}+h_{i1}h_{j3},h_{i3}h_{j2}+h_{i2}h_{j3},h_{i3}h_{j3} \end{bmatrix} vij​=[hi1​hj1​,hi1​hj2​+hi2​hj1​,hi2​hj2​,hi3​hj1​+hi1​hj3​,hi3​hj2​+hi2​hj3​,hi3​hj3​​]
therefore
[ v 12 T ( v 11 − v 22 ) T ] b = 0 \begin{bmatrix} v_{12}^T \\ (v_{11}-v_{22})^T \end{bmatrix} b=0 [v12T​(v11​−v22​)T​]b=0
if n images of the model plane are observed, we have
V b = 0 Vb=0 Vb=0
where V V V is a 2 n × 6 2n \times 6 2n×6 matrix.

if n ≥ 3 n \geq 3 n≥3, unique value of b will be obtained, if n = 3 n = 3 n=3, additional constraint c = 0 c=0 c=0 can be added to solve the equations. once b b b is estimated, we can compute the camera intrinsic matrix A A A as follows
v 0 = ( B 12 B 13 − B 11 B 23 ) / ( B 11 B 22 − B 12 2 ) λ = B 33 − [ B 13 2 + v 0 ( B 12 B 13 − B 11 B 23 ) ] / B 11 α = λ / B 11 β = λ B 11 / ( B 11 B 22 − B 12 2 ) c = − B 12 α 2 β / λ u 0 = c v 0 / α − B 13 α 2 / λ \begin{aligned} v_0 & = (B_{12}B_{13}-B_{11}B_{23})/(B_{11}B_{22}-B_{12}^2) \\ \lambda & = B_{33}-[B_{13}^2+v_0(B_{12}B_{13}-B_{11}B_{23})]/B_{11} \\ \alpha & = \sqrt{\lambda/B_{11}} \\ \beta & = \sqrt{\lambda B_{11}/(B_{11}B_{22}-B_{12}^2)} \\ c & = -B_{12}\alpha^2\beta/\lambda \\ u_0 & = cv_0/\alpha-B_{13}\alpha^2/\lambda \end{aligned} v0​λαβcu0​​=(B12​B13​−B11​B23​)/(B11​B22​−B122​)=B33​−[B132​+v0​(B12​B13​−B11​B23​)]/B11​=λ/B11​ ​=λB11​/(B11​B22​−B122​) ​=−B12​α2β/λ=cv0​/α−B13​α2/λ​

6.4 Distortion model

Only the first two terms of radial distortion are considered. Let ( u , v ) (u,v) (u,v) be the ideal (no distorted) pixel image coordinates, and ( u ˘ , v ˘ ) (\breve{u},\breve{v}) (u˘,v˘) the corresponding real observed image coordinates. similarly, ( x , y ) (x,y) (x,y) and ( x ˘ , y ˘ ) (\breve{x},\breve{y}) (x˘,y˘​) are the same meaning. So
x ˘ = x + x [ k 1 ( x 2 + y 2 ) + k 2 ( x 2 + y 2 ) 2 ] y ˘ = y + y [ k 1 ( x 2 + y 2 ) + k 2 ( x 2 + y 2 ) 2 ] \begin{aligned} \breve{x} & = x + x[k_1(x^2+y^2)+k_2(x^2+y^2)^2] \\ \breve{y} & = y + y[k_1(x^2+y^2)+k_2(x^2+y^2)^2] \end{aligned} x˘y˘​​=x+x[k1​(x2+y2)+k2​(x2+y2)2]=y+y[k1​(x2+y2)+k2​(x2+y2)2]​
where k 1 k_1 k1​ and k 2 k_2 k2​ are the coefficients of the radial distortion. thus we have
u ˘ = u + ( u − u 0 ) [ k 1 ( x 2 + y 2 ) + k 2 ( x 2 + y 2 ) 2 ] v ˘ = v + ( v − v 0 ) [ k 1 ( x 2 + y 2 ) + k 2 ( x 2 + y 2 ) 2 ] \begin{aligned} \breve{u} & = u + (u-u_0)[k_1(x^2+y^2)+k_2(x^2+y^2)^2] \\ \breve{v} & = v + (v-v_0)[k_1(x^2+y^2)+k_2(x^2+y^2)^2] \end{aligned} u˘v˘​=u+(u−u0​)[k1​(x2+y2)+k2​(x2+y2)2]=v+(v−v0​)[k1​(x2+y2)+k2​(x2+y2)2]​
because the distortion is small, we would like to estimate the other parameters followed by estimating k 1 k_1 k1​ and k 2 k_2 k2​
[ ( u − u 0 ) ( x 2 + y 2 ) ( u − u 0 ) ( x 2 + y 2 ) 2 ( v − v 0 ) ( x 2 + y 2 ) ( v − v 0 ) ( x 2 + y 2 ) 2 ] [ k 1 k 2 ] = [ u ˘ − u v ˘ − v ] \begin{bmatrix} (u-u_0)(x^2+y^2) & (u-u_0)(x^2+y^2)^2 \\ (v-v_0)(x^2+y^2) & (v-v_0)(x^2+y^2)^2 \end{bmatrix} \begin{bmatrix} k_1 \\ k_2 \end{bmatrix} =\begin{bmatrix} \breve{u}-u \\ \breve{v}-v \end{bmatrix} [(u−u0​)(x2+y2)(v−v0​)(x2+y2)​(u−u0​)(x2+y2)2(v−v0​)(x2+y2)2​][k1​k2​​]=[u˘−uv˘−v​]
Given m m m points in n n n images, we have 2 m n 2mn 2mn equations and the matrix D k = d Dk=d Dk=d, where k = [ k 1 , k 2 ] T k=[k_1,k_2]^T k=[k1​,k2​]T, and the solution is given by
k = ( D T D ) − 1 D T d k=(D^TD)^{-1}D^Td k=(DTD)−1DTd

6.5 Complete Maximum Likelihood Estimation

∑ i = 1 n ∑ j = 1 m ∣ ∣ m i , j − m ˘ ( A , k 1 , k 2 , R i , t i , M j ) ∣ ∣ 2 \sum\limits_{i=1}^n\sum\limits_{j=1}^m||m_{i,j}-\breve{m}(A,k_1,k_2,R_i,t_i,M_j)||^2 i=1∑n​j=1∑m​∣∣mi,j​−m˘(A,k1​,k2​,Ri​,ti​,Mj​)∣∣2

the initial guess of A A A and { R i , t i ∣ i = 1 , . . n } \{R_i,t_i|i=1,..n\} {Ri​,ti​∣i=1,..n} can be estimated in Sec 6.2 and Sec 6.3. An initial guess of { k i ∣ i = 1 , 2 } \{k_i|i=1,2\} {ki​∣i=1,2} can be obtained in Sec 6.4 or simply set them to zero. the Levevberg-Marquartdt Algorithm is implemented here to solve the nonlinear problem.


Reference

[1] Zhang Z . Flexible camera calibration by viewing a plane from unknown orientation[C]// Computer Vision, 1999. The Proceedings of the Seventh IEEE International Conference on. IEEE Computer Society, 1999.

[2] blog: https://www.cnblogs.com/zyly/p/9366080.html

[3] blog: https://blog.youkuaiyun.com/lql0716/article/details/71973318?locationNum=8&fps=1

【三维重建】相机标定:张正友标定法 上文介绍了相机成像原理和各个坐标系之间的转换关系,并建立了三维到二维的理想化模型,表示出了相机的内、外参数矩阵。并且对于现实情况,介绍了相机透镜可能会存在畸变相机的畸变参数。本文主要就是解决相机标定的问题,用到的方法为:张友正标定法。下面是文章原文与翻译文献。张氏标定法使用二维方格组成的标定板进行标定,采集标定板不同位姿图片,提取图片中角点像素坐标,通过单应矩阵计算出相机的内外参数初始值,利用非线性最小二乘法估计畸变系数,最后使用极大似然估计法优化参数。该方法操作简单,而且精度较高,可以满足大部分场合。 阅读详情

相关推荐

机器人抓取(四)—— 相机参数与标定 camera_calibration

1. 原理篇 参考:Step1:模型 16个相机参数(内参、外参、畸变参数) 摄像机标定(Camera calibration)是从空间点及其对应的像素点,获得相机的位置信息和内部参数信息的过程。 相机外参:从世界坐标坐标系到相机坐标系 相机内参:从相机坐标系到图像坐标系 补充知识:齐次坐标 参考:相机标定详细讲解 齐次坐标系:能够明显的区分点与向量,并且便于计算机做图形处理时进行仿射变换的坐标系。例如,在欧式空间,表示一个三维的点和一个三维的向量可以采用如下的方法: 由于向量只有方向和大小,如何只给

zxxRobot的博客 6615

OpenCV+Python 相机标定及矫正+张正友相机标定法+代码+教程

OpenCV+Python 相机标定及矫正+张正友相机标定法+代码+教程

QQ_1309399183的博客 1432

摄像头标定GML Camera Calibration

摄像头标定GML Camera Calibration GML Camera Calibration官方版是一款十分优秀出色的相机标定软件,GML Camera Calibration官方版界面友好,功能实用,可以帮助用户轻松快捷的计算相机的内外参数,不仅如此,GML Camera Calibration最新版还对张正友标定方式进行包含,支持直接打印的功能。 GML Camera Calibration软件功能   GML Camera Calibration官方版在标定之后计算固有摄像机参数和畸变系数。

吴建明wujianming_110117 1506

JetBot-Jetcam的使用

1. 下载安装JetCam git clone https://github.com/NVIDIA-AI-IOT/jetcam cd jetcam sudo python3 setup.py install 2. 测试摄像头 2.1 查看摄像头设备 ls -ltrh /dev/video* 2.2 创建相机对象 # csi摄像头 from jetcam.csi_camera import CS...

AI新手程序员 3348

基于OpenCV实现张正友相机标定(完整程序+棋盘图)

基于OpenCV实现张正友相机标定(完整程序+棋盘图),代码可直接打开运行,附有棋盘图。如有问题可直接联系博主。

OpenCV张正友相机标定程序,附实验数据

使用OpenCV中的函数,进行张正友相机标定的程序 ,包含样例数据

Unity 相机观察物体

分享一份摄像机观察物体的脚本,改脚本包含,环绕目标旋转,缩放,平移功能,做个记录 using UnityEngine; public class CameraObserve : MonoBehaviour { public static CameraObserve Instance; /// <summary> /// 是否可以旋转 /// </summary> public bool CanMove = false; ///

朝夕的博客 981

张正友标定法原代码 Camera_Calibration-master.zip

张正友标定法原代码

张正友相机标定matlab,张正友标定、Camera Calibration Toolbox for Matlab

0.引言张正友标定的原理我虽然已经看了N遍了,但这并不是本文的重点。本文只是讲述如何通过棋盘进行标定获得相机内外参数,以便用于后续的工作中。1.标定标定过程走了不少弯路,最后选择了Camera Calibration Toolbox for Matlab,方便适用。1.1下载1.2标定(1)将棋盘图复制到Toolbox文件夹内(.m和棋盘图在同一文件夹),(2)在命令行中输入calib_gui (...

weixin_39907596的博客 516

Geometric Camera Calibration 张正友

Geometric Camera Calibration 张正友, Geometric Camera Calibration 张正友

matlab摄像头编程observe函数

该程序能连续地读取本地图像文件、internet上的图像文件,或者捕获摄像头视频,或者捕获屏幕视频,并生成一个avi文件。

A Flexible New Technique for Camera Calibration----张正友相机标定经典原文中文翻译

做相机校正用到了张正友相机标定的方法。

wangxiaokun671903的专栏 1万+

android+音乐节拍检测,科学网—音乐节拍跟踪或音乐节拍检测软件,LilyBeats alpha - 石自强的博文...

我们设计并实现了一种用于实时跟踪音乐节拍的软件。该软件可以用于智能灯方案提供商,为其提供灯光随音乐变化的核心解决方案。首先给出软件的下载链接:或者音乐节拍是乐曲中表示固定单位时值和强弱规律的组织形式,亦称拍子。它有两个特性:周期性和连续性。节拍周期性表现为节拍结构,是乐曲中周期性出现的节奏序列。节拍连续性表现为音乐的平均速度,其单位为bpm(beat per minute每分钟音乐节拍的个数)。音...

weixin_39571403的博客 1400

张正友相机标定算法(Zhang’s camera calibration method)原理和过程推导(附OpenCV代码示例)

张正友方法通过平面靶标图像(如棋盘格)的多个视角图像,提取角点特征,求解从平面到图像的单应性矩阵,再从中估计相机内参、外参及畸变参数。

qq_36812406的博客 3754

海思Hi3519AV100 sensor移植实战:IMX586驱动调试与硬件验证全流程

本文详细解析了在海思Hi3519AV100平台上移植索尼IMX586传感器的全流程实战。内容涵盖从硬件I2C通信验证、驱动代码移植与修改,到内核配置、时钟设定,以及使用示波器进行硬件信号深度验证和ISP图像调优等关键步骤,为开发者提供了一套清晰、可复现的sensor移植与调试方法。

weixin_29168393的博客 395

射频收发机(RF Transceiver)

2,既然原来外差的思路是把声音频率的信号,通过混频搬移到高频电磁波频率,那对高频率信号放大的时候,是不是也可以先在比较低的射频频率进行放大,然后再通过频率搬移的方式,将放大后的信号搬移到高频率呢?频率搬移过程中,中间预先设定的固定射频频率被称为“中频”(中间频率,IF,Intermediate Frequency),由于这个频率超出了声音可听的范围,是“超声波”(supersonic),所以被命名为“超外差”(Super-Heterodyne)。混频后的信号在0频率附近,可能会发生DC偏移。

2301_77317229的博客 1122

张正友相机标定文章:A Flexible New Technique for Camera Calibration

http://research.microsoft.com/en-us/um/people/zhang/Papers/TR98-71.pdf

慢慢 1045

Windows 11 24H2 外接显卡坞兼容性实测:3步解决USB设备失效

本文详细解析了Windows 11 24H2系统下外接显卡坞导致USB设备失效的问题,并提供了三步终极解决方案:驱动预解压与手动更新、电源管理设置调整、优化的设备连接顺序。通过雷电3接口的兼容性优化,帮助用户解决键盘鼠标卡死等常见问题,提升外接显卡坞的稳定性与性能。

weixin_31714129的博客 579

python双目标定_ROS下单目和双目相机的标定

参考:http://wiki.ros.org/camera_calibrationROS下相机标定标定方法:可以通过matlab,OpenCV,ROS三种方式进行相机标定。ROS提供了camera_calibration Package:image_pipeline,通过这个Package可以使用棋盘标定板对单目和双目相机进行标定。另外推荐一个标定工具Kalibr:Kalibr,可以实现Multi...

weixin_39836751的博客 931

树莓派4B玩转ROS2 Humble:Ubuntu Desktop一键安装与配置教程

本文详细介绍了在树莓派4B上安装和配置ROS2 Humble的完整教程,包括硬件准备、Ubuntu Desktop系统安装、一键部署ROS2、网络配置优化以及常见问题解决方案。通过简化安装流程和性能调优技巧,帮助开发者快速搭建机器人开发环境,充分发挥树莓派4B在ROS2应用中的潜力。

w8x9y0z1的博客 963

软硬件协同设计的大小端问题

缘起 最近需要在soc系统内做协处理器,加速AES加密运算,寄存器一次读取32bit,AES一次处理128bit,因此在数据拼接的时候,需要考虑大小端的问题,特来记录一番。 一、什么是大小端 大小端的问题发生在寄存器和内存间传递数据,这点非常重要,很多地方简单地说是数据存储方式,其实不准确。追根溯源,大小端问题是在设计load,store指令的时候考虑的,因此本质是寄存器和内存交互的问题,其他地方不会发生。 比如c语言里定义一个变量int a=ox1234,那么查看在线汇编平台的对应汇编代码: # 给2号寄

http://www.icfgblog.com/ 612

【计算机视觉】基于Python的相机标定项目Camera-Calibration深度解析

基于Python的相机标定项目Camera-Calibration深度解析

weixin_43988131的博客 1683

30天Python入门(第一天:Python入门)

30天带你入门Python,这是第一天

Science prince的博客 582

ROS新手必看:5分钟搞定usb_cam相机标定(附棋盘格下载链接)

本文为ROS新手提供了详细的USB摄像头标定指南。通过安装usb_cam驱动、准备棋盘格并使用ROS的camera_calibration工具,可在5分钟内完成相机标定流程,获取关键的内参和畸变系数,为后续的机器人视觉应用(如物体识别、SLAM)奠定精准测量基础。

sony5的博客 452

EDEM-FLUENT耦合报错几大原因总结(持续更新)

EDEM-FLUENT耦合报错几大原因总结(持续更新)

zheaa的博客 2760

jdk-8u144-linux-x64.tar.gz.

该资源为搭建Linux系统Java环境用,资源的后缀为tar.gz格式的压缩包

camera_calibration_tool:OpenCV-Python 相机标定及矫正工具

camera_calibration_tool:OpenCV-Python 相机标定及矫正工具 【下载地址】camera_calibration_toolOpenCV-Python相机标定及矫正工具 camera_calibration_tool 是一款基于 OpenCV-Python 的相机标定及矫正工具,采用张正友相...

gitblog_06744的博客 688

jre9下载 jdk9

(Java SE Runtime Environment 9.0) 9.0u175 官方最新版 【x86|x64】

上一篇: Point Cloud
下一篇: Delaunay三角网 alpha shape 2D点集边缘线提取
SubChange
博客等级 码龄9年 104粉丝 9原创
评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

个

红包个数最小为10个

元

红包金额最低5元

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

抵扣说明:

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

余额充值