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

Unity 相机观察物体

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

朝夕的博客 981

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

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

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

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

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

Geometric Camera Calibration 张正友

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

张正友相机标定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的博客 515

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

张正友标定法原代码

matlab摄像头编程observe函数

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

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

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

wangxiaokun671903的专栏 1万+

VSCode+PlatformIO新建工程卡成狗?3步提速大法实测有效(附镜像源配置)

针对VSCode+PlatformIO新建工程时因依赖下载缓慢导致的加载慢问题,本文提供了三步核心提速方案。通过配置Python环境变量、修改PlatformIO插件设置以使用国内镜像源,并优化pip配置文件,实测可大幅缩短工程创建时间,有效解决创建工程卡顿的痛点。

delta的博客 708

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

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

qq_36812406的博客 3753

QGIS效率提升神器:qgis_mcp插件+VSCode联合工作流配置全解析

本文详细解析了如何通过配置qgis_mcp插件与VSCode的联合工作流,实现语音控制和代码自动化来大幅提升QGIS操作效率。该方案将自然语言交互与现代编辑器生态结合,为地理信息专业人士构建了智能、高效的全新工作模式,彻底改变传统GIS操作方式。

weixin_29228203的博客 189

STM32F103 实例应用(10)——I2C读写24C32

一、应用简介 本文介绍24C32的读写,基于野火的软件I2C程序。 board_i2c.h /**=========================================================================== @file board_i2c.h @brief 本文件是用于I2C驱动 @author 青梅煮久 @version r0.1 @date 2021/01/13 -------------------------.

qq_34118600的博客 3447

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

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

慢慢 1045

5分钟搞定阿里云千问大模型API申请:手把手教你获取API Key

本文提供了一份高效的阿里云通义千问大模型API Key获取实战指南。通过清晰的步骤,帮助开发者在五分钟内完成从账号准备、精准导航控制台到创建并验证API Key的全过程,并强调了密钥安全管理和基础调用测试的重要性,助力快速集成AI能力。

ol789012345的博客 1340

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

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

weixin_39836751的博客 931

plotly包安装_Plotly(一)安装指南

plotly,是一个快速完善并崛起的交互式的、开源的绘图库库,Python库则是它的一个重要分支。现已支持超过40种独特的图表类型,涵盖了广泛的统计、金融、地理、科学和三维用例。Plotly 通过JavaScript构建,能基于Web显示实现交互式的可视化效果(Plotly最强大之处之一)。所以它的图形呈现可以方便的显示于Jupyter notebook(基于html)、独立的html中(直接显示...

weixin_35907189的博客 3471

2023华为OD机试真题B卷 Python 实现【最长的元音子串长度】

定义当一个字符串只有元音字母(a,e,i,o,u,A,E,I,O,U)组成,称为元音字符串,现给定一个字符串,请找出其中最长的元音字符串,并返回其长度,如果找不到请返回0, 字符串中任意一个连续字符组成的子序列称为该字符串的子串

MISAYAONE的博客 899

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

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

weixin_43988131的博客 1682

Android 10.0 SystemUI 屏蔽状态栏消息推送弹出的悬浮通知

在状态栏中,有一些通知类似 消息推送 弹出的 悬浮通知,弹出30秒之后会消失掉 要想屏蔽掉这些通知,首选知道这些通知是怎么产生的 通知类型 NotificationContentInflater.java 详细的介绍各种通知的类型 frameworks/base/packages/SystemUI/src/com/android/systemui/statusbar/notification/row/NotificationContentInflater.java /** * The defau

安卓兼职framework和app工程师的博客 1542

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

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

sony5的博客 452

自然语言处理6 -- 情感分析

1 概述 情感分析是自然语言处理中常见的场景,比如淘宝商品评价,饿了么外卖评价等,对于指导产品更新迭代具有关键性作用。通过情感分析,可以挖掘产品在各个维度的优劣,从而明确如何改进产品。比如对外卖评价,可以分析菜品口味、送达时间、送餐态度、菜品丰富度等多个维度的用户情感指数,从而从各个维度上改进外卖服务。 情感分析可以采用基于情感词典的传统方法,也可以采用基于深度学习的方法,下面详细讲解 ...

谢杨易的博客 5万+

迈瑞BS系列全自动生化分析仪LIS协议接口手册(内含HL7和ASTM)

迈瑞BS系列全自动生化分析仪LIS协议接口手册,内含HL7和ASTM)

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

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

gitblog_06744的博客 688

计算机控制技术及应用

《计算机控制技术及应用》通过总结作者的科研成果和吸收国内外的先进理论、方法和技术,以计算机控制系统的网络化、开放化、智能化和集成化发展趋势为主线索,主要介绍计算机控制系统的基本概念和计算机控制系统的典型形式,计算机控制系统的数学描述与基本分析方法,以及数字PID控制器、最少拍控制系统、达林算法、状态变量设计法等设计方法及其各种改进算法。重点突出计算机控制系统输入输出通道接口的设计方法和典型控制系统的设计案例与实现方法等。

上一篇: 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、付费专栏及课程。

余额充值