当前位置:网站首页>4. Talk about the famous Zhang Zhengyou calibration method
4. Talk about the famous Zhang Zhengyou calibration method
2022-07-27 00:10:00 【Like a new life】
Catalog
0、 Zhang Zhengyou calibration method paper
This blog article refers to two papers of Dr. zhangzhengyou :Flexible camera calibration by viewing a plane from unknown orientation and A Flexible New Technique for Camera Calibration
1、 Zhang Zhengyou calibration method
First , We learned Camera imaging model , Through that model , It is easy to understand the following formula .
hinder r i r_i ri and t t t Is the column vector representation of the external parameter matrix , The advantage of this writing is that some constraints can be constructed by using the properties of the rotation matrix .
1.0 The properties of rotation matrix
① Modules of each row and column , All for 1;
② Any two column vectors or any two row vectors are orthogonal ;
③ The inverse of an orthogonal matrix is equal to the transpose of an orthogonal matrix .
Later, we will use the properties of the above rotation matrix .
1.1 Solve homography matrix
We use a plane calibration plate for calibration ( Take checkerboard as an example ), We will X O Y XOY XOY The plane is set on the plane of the calibration plate , The axis is vertically outward , In this way, all feature points detected have
Z w = 0 Z_w=0 Zw=0 The relationship between .
Bring in the above formula , There will be :
because Z w = 0 Z_w=0 Zw=0, So we eliminated r 3 r_3 r3.
Make A [ r 1 , r 2 , r 3 ] = H A[r_1,r_2,r_3]=H A[r1,r2,r3]=H, Then there are ,
s [ u , v , 1 ] T = H [ X w , Y w , 1 ] T s[u,v,1]^T=H[X_w,Y_w,1]^T s[u,v,1]T=H[Xw,Yw,1]T
This H H H Is homography matrix , We expand it to ,
In this way, we know the number of points on the chessboard 3D coordinate ( We know the size of the chessboard ), And the pixel coordinates of each corresponding corner on the image plane , You can put the h i j h_{ij} hij It's solved .
And then s s s The first two equations are ,
in other words , H H H Yes 8 A degree of freedom . About the degree of freedom of several matrices, we can see My blog .
Definition h ′ = [ h 11 , h 12 , h 13 , h 21 , h 22 , h 23 , h 31 , h 32 , 1 ] h' = [h_{11}, h_{12}, h_{13}, h_{21}, h_{22}, h_{23}, h_{31}, h_{32}, 1] h′=[h11,h12,h13,h21,h22,h23,h31,h32,1],
above X , Y , u , v X,Y,u,v X,Y,u,v All known quantities . Because homography matrix has 8 A degree of freedom , A pair of matching points can build the above 2 A constraint , therefore 4 The homography matrix can be solved by matching points , Due to noise , In reality, nonlinear optimization method is often used to solve , Like singular value decomposition +LM etc. .
We write the above formula as S h ′ = 0 Sh'=0 Sh′=0 , coefficient matrix S T S S^TS STS The eigenvector corresponding to the minimum eigenvalue is the overdetermined equations S h ′ = 0 S h'= 0 Sh′=0 The least square solution of .
1.2 Solve the internal parameter matrix
The homography matrix we obtained above may have a scaling factor with the real value , We add a scale factor , Yes 
from 1.0 Two constraints can be obtained from the properties of the rotation matrix mentioned in section :
So there is ,

It can be seen from the red letter derivation above , The formula in the picture is actually like this λ = λ 2 \lambda=\lambda^2 λ=λ2, We think it is a constant scaling factor . Just write him down as λ \lambda λ that will do .
because A A A Is an internal parameter matrix , We can calculate his inverse matrix .
A = [ α γ u 0 0 β v 0 0 0 1 ] A=\left[ \begin{matrix} \alpha & \gamma & u_0 \\ 0 & \beta & v_0 \\ 0 & 0 & 1 \\ \end{matrix} \right] A=⎣⎡α00γβ0u0v01⎦⎤
among , α , β \alpha,\beta α,β Indicates the focal length in both directions , u 0 , v 0 u_0,v_0 u0,v0 Represents the primary point . Early cameras may have the problem that the pixels themselves are parallelograms rather than rectangles , So add a parameter γ \gamma γ To describe , This parameter can also be considered as an approximation of the deformation caused by the lax placement of the sensor perpendicular to the main optical axis of the camera , Facts and pixel coordinates X,Y The tangent of the included angle between the axes is inversely proportional , So when γ \gamma γ=0 when , Pixels are rectangular .
Make B = A − T A − 1 B=A^{-T}A^{-1} B=A−TA−1, Then there are :

because h 1 h_1 h1 There are three elements , So there is this expression .
As for why we put B B B When the matrix is spread into a vector , Leaving only 6 Elements , Actually, calculate this B B B You know the .
thus , The previous constraint equation is simplified to :
among , v v v Are known quantities , This constitutes another S h = 0 Sh=0 Sh=0 The equation of . We know , Each calibration chart can provide one of the above constraints ( Corresponding to one H H H), And each equation will provide two constraint equations . B B B It has 6 Location elements , So theoretically , Three calibration pictures can solve the above equation . When the calibration chart exceeds 3 Zhang Shi , The least square method can also be used to solve the corresponding overdetermined equation . Singular value decomposition and LM Method to get B B B.
obtain B B B after , It can be based on B B B The relationship with the elements of the internal parameter matrix is solved α , β , γ , u 0 , v 0 \alpha,\beta,\gamma,u_0,v_0 α,β,γ,u0,v0 Come on .
1.3 Solve the external parameter matrix
We know ( Including the scale factor )
[ h 1 , h 2 , h 3 ] = A [ r 1 , r 2 , t ] [h_1,h_2,h_3] = A[r_1,r_2,t] [h1,h2,h3]=A[r1,r2,t]
Here we have solved H and A H and A H and A, And according to the front 1.0 Properties of nodal rotation matrix , So there is ,
At this time, there is a difference r 3 r_3 r3, It's simple ,
r 3 = r 1 X r 2 r_3=r_1Xr_2 r3=r1Xr2( Cross riding ).
Only this and nothing more , Internal and external parameters are calculated .
Because there is noise in the image , So what we got R R R In fact, it does not necessarily satisfy the property of orthogonality , Therefore, use the optimization method to get the best R R R ,
It is said in the author's original text :

If you are interested, you can explore by yourself .
1.4 Solve distortion coefficient

In the paper :
1.5 Nonlinear optimization
Be careful : The above series of operations are to get the initial value of each parameter , With the initial value , We can use the camera model + Distortion model on the chessboard 3d Point projection , Establish the re projection error equation , Then the accurate values of each parameter are obtained by using the nonlinear optimization method .
Nonlinear optimization methods can be referred to This article I collated .
2、 What is the use of homography matrix
On homography matrix , I recommend reading Liuge's official account article Magic homography matrix .
3、 Thank you very much for reading !
边栏推荐
- 第3章 跨域问题
- Tensorflow2.0 深度学习运行代码简单教程
- Typesript generic constraint
- Familiarize you with the "phone book" of cloud network: DNS
- PTA 7-4 small generation (DFS)
- Design of alcohol detector based on 51 single chip microcomputer
- Anaconda => PyCharm => CUDA => cudnn => PyTorch 环境配置
- Abstract classes and interfaces (sorting out some knowledge points)
- [literature reading] an investigation on hardware aware vision transformer scaling
- Hcip day 2_ HCIA review comprehensive experiment
猜你喜欢

4-4 object lifecycle

Skiasharp's WPF self drawn bouncing ball (case version)

Iptables prevent nmap scanning and binlog
![[Gorm] model relationship -hasone](/img/90/3069059ddd09dc538c10f76d659b08.png)
[Gorm] model relationship -hasone

百度网址收录

Re understand the life world and ourselves

Analysis of encoding and decoding of encode() and decode(), common encoding and why encode and decode are needed

Dajiang Zhitu and CC have produced multiple copies of data. How to combine them into one and load them in the new earth map

Method of realizing program startup and self startup through registry

Azure Synapse Analytics 性能优化指南(3)——使用具体化视图优化性能(下)
随机推荐
Chapter 1 develop the first restful application
股票开户佣金是否可以调整?手机上开户安不安全
C language array
Complete backpack and 01 Backpack
【C语言】数组
[literature reading] an investigation on hardware aware vision transformer scaling
Simple SQL optimization
Modulo (remainder) operation in the range of real numbers: how to find the remainder of negative numbers
13_ conditional rendering
会议OA项目排座功能以及送审功能
Search engine hijacking of black hat SEO
Qunar travel massive indicator data collection and storage
MySQL数据库复杂操作:数据库约束,查询/连接表操作
2022.7.18-----leetcode.749
Several search terms
[C language] array
[step by step, even thousands of miles] key words in the specified time period of the statistical log
查看 Anaconda 创建环境的位置
4-4 object lifecycle
08_ Event modifier