Camera calibration (CSI)1. Start the camera2. Image calibration2.1. Calibration board2.2. View topics2.3, Image calibration2.3.1, Install the image calibration tool2.3.2, Start the image calibration tool2.3.3, Calibration process2.3.4, Calibration results
cd ~/yahboom_ws
xxxxxxxxxx
source install/setup.bash
xxxxxxxxxx
ros2 run camera camera_csi
xxxxxxxxxx
ros2 topic list
xxxxxxxxxx
sudo apt update
sudo apt install ros-humble-image-pipeline -y
Start the ROS2 camera calibration tool camera_calibration
and perform camera calibration: You need to start the camera before calibration
xxxxxxxxxx
ros2 run camera_calibration cameracalibrator --size 9x6 --square 0.02 --ros-args --remap /image:=/image_raw
Parameter Description
--size
: Number of inner corner points of the chessboard → 9 rows and 6 columns of inner corner points
--square
: Side length of the chessboard → 0.02 meters
--ros-args
: Pass ROS parameters
--remap
: Topic remapping → /image_raw
as image input stream
Parameter Description
X
: The chessboard moves left and right in the camera field of view
Y
: The chessboard moves up and down in the camera field of view
Size
: The chessboard moves forward and backward in the camera field of view
Skew
: The chessboard tilts and rotates in the camera field of view
When X
, Y
, Size
, and Skew
turn green, you can click CALIBRATE
to calculate the camera internal parameters: the more images you calibrate, the longer it takes, and the program may freeze
After calibration, click SAVE
to save the results!
Close the program after successful saving!
Default save location and file name of calibration results:
xxxxxxxxxx
/tmp/calibrationdata.tar.gz
Copy and decompress the calibration results:
xxxxxxxxxx
sudo mv /tmp/calibrationdata.tar.gz ~
mkdir calibrationdata
tar -xzvf calibrationdata.tar.gz -C ~/calibrationdata
The decompressed files contain the calibration *.png
, ost.yaml
and ost.txt
files. We mainly copy the data in the ost.yaml
file to the camera_usb.yaml
file.
ost.yaml
Replace the camera_usb.yaml
file data with image_width
, image_height
, data
in camera_matrix
, data
in projection_matrix
, and data
in distortion_coefficients
.
xxxxxxxxxx
image_width: 640
image_height: 480
camera_name: narrow_stereo
camera_matrix:
rows: 3
cols: 3
data: [583.32121, 0. , 290.8562 ,
0. , 783.65447, 223.15165,
0. , 0. , 1. ]
distortion_model: plumb_bob
distortion_coefficients:
rows: 1
cols: 5
data: [0.106696, -0.116255, -0.018194, -0.011949, 0.000000]
rectification_matrix:
rows: 3
cols: 3
data: [1., 0., 0.,
0., 1., 0.,
0., 0., 1.]
projection_matrix:
rows: 3
cols: 4
data: [600.07017, 0. , 284.95284, 0. ,
0. , 807.38252, 216.33741, 0. ,
0. , 0. , 1. , 0. ]
camera_csi.yaml
Modified file:
xxxxxxxxxx
%YAML:1.0
---
image_width: 1920
image_height: 1080
camera_name: camera
camera_matrix: !!opencv-matrix
rows: 3
cols: 3
dt: d
data: [583.32121, 0. , 290.8562 ,
0. , 783.65447, 223.15165,
0. , 0. , 1. ]
distortion_model: plumb_bob
distortion_coefficients: !!opencv-matrix
rows: 1
cols: 5
dt: d
data: [0.106696, -0.116255, -0.018194, -0.011949, 0.000000]
rectification_matrix:
rows: 3
cols: 3
data: [1., 0., 0.,
0., 1., 0.,
0., 0., 1.]
projection_matrix:
rows: 3
cols: 4
data: [600.07017, 0. , 284.95284, 0. ,
0. , 807.38252, 216.33741, 0. ,
0. , 0. , 1. , 0. ]