Camera calibration

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

Ordinary camera:https://github.com/bosch-ros-pkg/usb_cam.git

Monocular teaching:http://wiki.ros.org/camera_calibration/Tutorials/MonocularCalibration

Due to some internal and external reasons of the camera, the image will be greatly distorted, mainly radial deformation and tangential deformation, causing the straight line to become curved. The farther the pixel is from the center of the image, the more serious the distortion will be. In order to avoid errors caused by data sources, the parameters of the camera need to be calibrated. Calibration essentially uses a known and determined spatial relationship (calibration plate) to reversely deduce the inherent and real parameters of the camera (internal parameters) by analyzing the pixels of the photographed pictures.

1、Preparation before calibration

2、Start calibration

Install the calibrated function package camera_calibration and enter it in the docker terminal (the factory docker is already installed and does not need to be reinstalled)

Start the camera before calibration, and then turn off the camera until all calibrations are completed. Start the camera and enter it in the Docker terminal.

Use the following command to view the topic, enter in the Docker terminal.

image-20240123181535694

The topic we need to use to calibrate RGB color images is /image_raw.

Run the calibrated program and enter in the Docker terminal.

size:Calibrate the number of internal corner points of the checkerboard, for example, 9X6, with a total of six rows and nine columns of corner points.

square:The side length of the checkerboard, in meters.

Topic name: /image_raw

1706005168211_35AB1EAE-8F46-435c-AFFE-1AC1CE945026

X:The checkerboard moves left and right in the camera field of view

Y:The checkerboard moves up and down in the camera's field of view

Size :The checkerboard moves forward and backward in the camera's field of view

Skew:The tilt and rotation of the checkerboard in the camera's field of view

As shown in the picture above, you need to collect the image by flipping it up and down, front and back, left and right, so that the X, Y, Size and Skew on the right turn green, as shown in the picture below, then click CALIBRATE to start calibration.

1706005190581_CA35EDDB-6837-4171-806A-9BFFE29F9149

After the calibration is completed, click SAVE, as shown in the figure below.

image-20240123182058311

The calibration results are saved to [/tmp/calibrationdata.tar.gz], and the saving path is the terminal directory where the calibration program is started. After the calibration is completed, you can move out the [/tmp/calibrationdata.tar.gz] file to see the content.

docker terminal input.

You will get the calibrated png file, ost.yaml and ost.txt files in the terminal directory.

When starting the USB camera, you need to load parameters. Therefore, after calibration, you need to replace the parameters with the original built-in parameters. Rename the calibrated ost.yaml to camera_info.yaml, then replace the original camera_info.yaml, and enter it in the docker terminal.