Camera intrinsic calibration

2.1、Program Function Description

Due to some reasons inside and outside the camera, the image will be greatly distorted, mainly radial deformation and tangential deformation, which will cause the straight line to become curved. The farther the pixel is from the center of the image, the more serious the distortion. In order to avoid the error caused by the data source, the camera parameters need to be calibrated. Calibration is essentially to reversely deduce the inherent and real parameters (internal parameters) of the camera by analyzing the pixels of the taken picture with the help of a known and determined spatial relationship (calibration board).

Wiki: http://wiki.ros.org/camera_calibration

2.2、Preparation before calibration

Chessboard (calibration board)

1684900748657

2.3, Program startup

2.3.1, Start the camera

Take the Astraproplus camera as an example, after SSH connects to the car, enter in the terminal,

Start the camera before calibration, and turn it off after all calibration is completed.

Obi Zhongguang camera models and corresponding launch files:

launch filecamera model
ros2 launch astra_camera astra_pro.launch.xmlAstrapro
ros2 launch astra_camera astro_pro_plus.launch.xmlAstraproplus
ros2 launch astra_camera astra.launch.xmlAstramini

Since the car has no graphical interface, the following calibration program needs to be run in a virtual machine.

Enter in the virtual machine terminal,

image-20241114121617058

The topic we need to use to calibrate RGB color images is /camera/color/image_raw, and the topic used to calibrate IR infrared images is /camera/ir/image_raw.

2.3.2, Color Image Calibration

Enter in the virtual machine terminal,

image-20241114121819573

Collect images by moving up and down, front and back, left and right, and flipping, so that [X], [Y], [Size], and [Skew] on the right turn green, as shown in the figure below, and then click [CALIBRATE] to start calculating the camera internal parameters. The more pictures, the longer it takes, just wait. (Sixty or seventy pictures are enough, too many will easily get stuck).

image-20241114122019215

After calibration, click [SAVE], as shown in the figure below.

image-20241114122323484

The calibration results are saved to [/tmp/calibrationdata.tar.gz]. You can move the file out to view the content.

After exiting the program, enter in the virtual machine terminal,

image-20241114122442157

You will get the calibrated png file, ost.yaml and ost.txt files in the calibrationdata_rgb folder under this directory.

Since the Astra driver loads the built-in parameters calibrated in the code when it is started, there is no need to load this calibrated parameter. The camera internal parameters will be used in the [AR Vision] case in the [OpenCV Series Courses].

2.3.3, IR infrared calibration

Since the RGBD camera uses structured light as the depth imaging principle, the infrared light it projects is a special disordered light spot, which makes the infrared receiving device unable to receive clear and complete picture content.

At this time, we can have several special processing methods:

Choose a processing method according to your needs.

Enter in the virtual machine terminal,

image-20241114122629346

Similarly, the following operations are similar to the color camera calibration, changing different poses and filling the lines under [X], [Y], [Size], and [Skew] as much as possible.

image-20241114122806554

Click [CALIBRATE] to calculate the camera internal parameters, and click [SAVE], as shown in the figure below.

image-20241114122841664

The calibration results are saved to [/tmp/calibrationdata.tar.gz]. You can move the file out to view the content.

After exiting the program, enter in the virtual machine terminal,

image-20241114122926132

You will get the calibrated png file, ost.yaml and ost.txt files in the calibrationdata_depth folder under this directory.