当前位置:网站首页>Camera calibration (calibration purpose and principle)
Camera calibration (calibration purpose and principle)
2022-06-24 07:28:00 【No, libuxing】
1. The purpose of camera calibration :
(1) One is to correct the distortion of the picture caused by lens distortion , for example , Straight line in reality , When an image is taken, it will be convex or concave , This situation can be corrected after camera calibration ;
(2) The other is based on shooting Two dimensions of Image to reconstruct 3D scene , Because the calibration process is through a series of three-dimensional points and its corresponding two-dimensional image points for mathematical transformation , Find out the internal and external parameters of the camera .
Camera after calibration , Distance measurement can be carried out 、 3D scene reconstruction, etc .
2. Four coordinate systems
One of the purposes of camera calibration is to establish the corresponding relationship between the object from the three-dimensional world to the coordinate points on the imaging plane , So first we need to understand the following four coordinate systems :
World coordinate system : User defined coordinate system of three-dimensional world , It is introduced to describe the position of the object in the real world and the position of the camera .
Camera coordinate system : The coordinate system established on the camera , To describe the position of an object from the perspective of a camera , As a communication between the world coordinate system and the image / The middle part of the pixel coordinate system .
Image coordinate system : In order to describe the projection and transmission relationship between the camera coordinate system and the image coordinate system in the imaging process, this paper introduces , It is convenient to get the coordinates in the pixel coordinate system .
Pixel coordinate system : In order to describe the image point of the object after imaging on the digital image ( photo ) The coordinates of , It's the coordinate system that we actually read from the camera , The unit is ( Number of pixels ).
3. Transformation between coordinates

World coordinate system :Xw、Yw、Zw.
Camera coordinate system : Xc、Yc、Zc.
Image coordinate system :x、y.
Pixel coordinate system :u、v.
among , Camera coordinate system Z The axis coincides with the optical axis , It is perpendicular to the plane of the image coordinate system and passes through the origin of the image coordinate system , The distance between the camera coordinate system and the image coordinate system is the focal length f. Pixel coordinate system plane u-v And image coordinate system plane x-y coincidence , But the origin of the pixel coordinate system is located in the upper left corner of the figure .
3.1 World coordinate system to camera coordinate system
Hypothetical winding x Shaft rotation ( Anti-clockwise )


And so on , Rotate about other axes ( Clockwise )


From the world coordinate system to the camera coordinate system 6 A degree of freedom , In addition to rotation, translation is also required

3.2 Camera coordinate system to image coordinate system


3.3 Image coordinate system to pixel coordinate system

The origin of the image coordinate system is in the center of the image , Company mm.
The origin of the pixel coordinate system is in the upper left corner of the image , Unit is pixel Pixel( individual ).
dx,dy: Is the intrinsic parameter of the sensor , Represents the number of millimeters per pixel .
u0,v0: Represents the offset of the origin of the image coordinate system from the pixel coordinate system , Unit is pixel .


3.4 The whole process of conversion from world coordinate system to pixel coordinate system 
thus , To reconstruct a 3D scene from a captured 2D image , Then it requires internal reference M1 And external reference M2.
3.5 Zhang Zhengyou calibration method




Homography (Homography) Transformation . It can be simply understood that it is used to describe the position mapping relationship between the object in the world coordinate system and the pixel coordinate system . The corresponding transformation matrix is called homography matrix .




![]()
How to get homography matrix according to calibration diagram ?
After a series of previous introductions , We should roughly understand how to calculate the homography matrix according to the printed chessboard calibration map and the photos taken H. Let's summarize the general process .
1. Print a checkerboard calibration drawing , Stick it on the surface of a flat object .
2. Take a group of pictures of checkerboards in different directions , It can be achieved by moving the camera , You can also move the calibration picture to achieve .
3. For each chessboard picture taken , Detect the feature points of all checkerboards in the picture ( Corner point , That is, the intersection of black and white chessboard in the figure below , Inside the magenta circle in the middle is a corner , Four diagonals ( Red yellow blue green ) Is the most special corner ). We define that the printed chessboard drawing is located in the world coordinate system Zw=0 On the plane of , The origin of the world coordinate system is located at the fixed corner of the chessboard drawing on the left ( For example, the yellow dot in the figure below ). The origin of the pixel coordinate system is located in the upper left corner of the picture on the right .

Because the chessboard calibration drawing all The spatial coordinates of the corners are known , The pixel coordinates of these corners corresponding to the corners in the captured calibration picture are also known , If we get this N>=4 Matching point pairs ( The more calculations, the more robust the results are ), It can be based on LM And so on Homography matrix in this view H. Of course, the calculation of homography matrix generally does not need to write its own function ,OpenCV There are ready-made functions that can call .
however , The above theory is just , In a real application scenario , The point pairs we calculate will contain noise . For example, the position deviation of a point is several pixels , Even the phenomenon of feature point pairing and mismatching , If only 4 A pair of points to calculate the homography matrix , There will be a big error . therefore , In order to make the calculation more accurate , Generally, it is much larger than 4 A pair of points to calculate the homography matrix . In addition, it is usually difficult to obtain the optimal solution by using the direct linear solution of the above equations , Therefore, other optimization methods are generally used in practical use , Such as singular value decomposition 、Levenberg-Marquarat(LM) Algorithm
The homography matrix obtained by the above method H after , The following is through H Push back the internal and external parameters of the camera



Pass above 2.28 And 2.29 have to :

It can be calculated by itself B It's a diagonal matrix , therefore B Only 6 An unknown number , So the vector b Set up 6 Just one parameter



Some of the pictures are from B Station video screenshot , Welcome to exchange and study .
It is strongly recommended to read this article : Detailed explanation of the mathematical principle of Zhang Zhengyou calibration method for camera calibration ( contain python Source code ) - You know
边栏推荐
- [DDCTF2018](╯°□°)╯︵ ┻━┻
- [GUET-CTF2019]zips
- 【MySQL 使用秘籍】克隆数据表、保存查询数据至数据表以及创建临时表
- How to distinguish PAAS, IAAs and SaaS?
- 取模软件 模拟显示验证取模数据正确性 逆向 把点阵数组bin文件转显示
- Analog display of the module taking software verifies the correctness of the module taking data, and reversely converts the bin file of the lattice array to display
- Win11怎么设置让CPU性能全开?Win11CPU怎么设置高性能模式?
- In JS, the regular expression verifies the hour and minute, and converts the input string to the corresponding hour and minute
- 【图像融合】基于方向离散余弦变换和主成分分析的图像融合附matlab代码
- Implementation and usage analysis of static pod
猜你喜欢

取模软件 模拟显示验证取模数据正确性 逆向 把点阵数组bin文件转显示

JVM debugging tool -jmap

Software performance test analysis and tuning practice path - JMeter's performance pressure test analysis and tuning of RPC Services - manuscript excerpts

Win11 points how to divide disks? How to divide disks in win11 system?

(CVE-2020-11978)Airflow dag中的命令注入漏洞复现【vulhub靶场】
![[MRCTF2020]千层套路](/img/8e/d7b6e7025b87ea0f43a6123760a113.png)
[MRCTF2020]千层套路

How to open the soft keyboard in the computer, and how to open the soft keyboard in win10
![[image fusion] image fusion based on NSST and PCNN with matlab code](/img/b4/61a5adde0d0bfc5a339ef8ab948d43.png)
[image fusion] image fusion based on NSST and PCNN with matlab code
![[WUSTCTF2020]alison_ likes_ jojo](/img/a9/dcc6f524772cd0b8781289cbaef63f.png)
[WUSTCTF2020]alison_ likes_ jojo

【pointNet】基于pointNet的三维点云目标分类识别matlab仿真
随机推荐
2、 What is the principle of layer 3 and 4 switching technology? Recommended collection!
Stop looking! The most complete data analysis strategy of the whole network is here
A case study of apiserver avalanche caused by serviceaccount
MySQL enable binlog
[OGeek2019]babyrop
【图像融合】基于像素显着性结合小波变换实现多焦点和多光谱图像融合附matlab代码
在产业互联网时代不再有真正意义上的中心,这些中心仅仅只是化有形为无形而已
伦敦金的资金管理比其他都重要
Huawei Cloud Database Advanced Learning
20个不容错过的ES6技巧
两个链表的第一个公共节点_链表中环的入口(剑指offer)
How to delete / select an input method on your computer
Accessing user interface settings using systemparametersinfo
I failed to delete the database and run away
在终端pip install xxx但在pycharm却no module named xxx
Canal installation configuration
【图像融合】基于方向离散余弦变换和主成分分析的图像融合附matlab代码
MFC多线程 信号量CSemaphore 临界区与互斥 事件
Huawei experimental topology set, learning methods are attached at the end of the article!
内网学习笔记(4)