In this tutorial, an introduction to the scientific field of computer vision will be presented, as well as a brief summary of the camera calibration process.
This post has as main objective to present one of the subfields of artificial intelligence. Computer vision is an attempt to achieve autonomous systems that realize some of the capabilities of “human vision”, where the camera is considered one of the sensors (equivalent to the human eye).
Understanding the content of the captured images is a challenging task, there are several applications/tasks common to these computer vision systems, such as classification, identification and objects tracking. One of the important things when developing a computer vision system, before starting any other task, is the camera calibration. In this tutorial we will focus on the importance of this process.
The geometric calibration of a camera (camera calibration), is based on the estimation of the parameters of the lens/sensor distribution of a camera, video and/or image.
Below you can find the main steps necessary to perform the process of removing distortion from a camera in a more theoretical way. This information is based on the documentation available by the OpenCV open-source library and the Matlab R2021a software.
The “ideal” camera does not have a lens, so the camera matrix does not contain distortion in the captured images. A “real” camera contains a lens, so the camera matrix contains an associated distortion, that can be radial and/or tangential.
The radial distortion (Figure 1) occurs when the light rays bend more near the edges of the lens than from its optical centre and can be of two types: negative (pincushion) or positive (barrel).
Tangential distortion (Figure 2) occurs when the lens and the image plane are not parallel.
Ideally, there should be no radial or tangential distortion.
Estimate Distortion Parameters
In order to estimate the distortion parameters, it is necessary to obtain a set of standard calibration images (usually called chess pattern). With this set of images, the so-called “matrix of the camera” is calculated using the extrinsic and intrinsic parameters of the camera.
The extrinsic parameter is the rotated transformation from the world coordinate system (3D) to the camera coordinate system (3D). This parameter includes the focal length (fx, fy) and the optical centres (cx, cy), that we can observe in the Figure 3 matrix.
The intrinsic parameters are the projection of the transformation of camera coordinates (3D) into image coordinates (2D).
Undistortion (removing distortion)
By obtaining the distortion parameters, we are able to carry out the rectification of the camera matrix, i.e. each pixel in the image will be rectified, removing the distortion.
As a consequence, in this undistortion (Figure 4), some pixels can be removed from the corners of the image, or extra black pixels may appear in the corners.
In order to understand how good the calibration is for use, it is possible to estimate the reprojection error and the error of each estimated parameter.
The reprojection error is the distance between a point detected by the camera in the world and the point in the corresponding world. This provides the average reprojection error in each set of standard calibration images. With this error analysis, we can choose which images are best for calibration.
The error of each estimated parameter (in a grotesque way) is the probability that the real value is within a certain confidence interval.