Camera Calibration - Weber-State-UAV-Program/Documentation-2024-2025 GitHub Wiki
Calibration of the under-mounted camera is necessary in order to facilitate accurate pose estimate from the apriltag node. To calibrate the camera follow these steps.
instructions)
1. Setup Development Environment (While all steps (specifically those involving PX4) are not required for camera calibration. You must have a working installation of ROS2 Humble and have the ARG-Drone project workspace building without error.
2. Install Camera Calibration Tools
Install the tools for camera calibration in ROS2
sudo apt install ros-humble-camera-calibration
sudo apt install ros-humble-image-tools
3. Print out Camera Calibration Checkerboard
Print out a camera calibration checkerboard with known square sizes.
Example:
Checkerboards can be generated and downloaded here
4. Run the Camera Node
Ensure the USB camera is connected to one of the USB ports on your computer. Then launch the camera driver with
ros2 launch arg_drone_cam_calibration.launch.py
If your computer has multiple camera devices (such as a webcam) it may be necessary to change the video_device parameter in usb_cam_params.yaml
located here
5. Run the Camera Calibration None
Run the camera calibration node with
ros2 run camera_calibration cameracalibrator \
--size 8x6 \
--square 0.025 \
--camera_name camera \
--no-service-check \
--ros-args \
-p image_topic:=/camera/image_raw \
-p camera_info_topic:=/camera/camera_info
Ensure the topics match the output of the usb cam node, and the size and square arguments match that of your camera calibration checkerboard.
This should open up a GUI displaying the feed from the USB camera. Moved the calibration checkerboard all around the camera frame until the calibrate button lights up indicating sufficient calibration information has been captured. Click the Calibrate button in the GUI window and then Save
The resulting calibration file should look similar to this
image_width: 640
image_height: 480
camera_name: arducam
camera_matrix:
rows: 3
cols: 3
data: [771.61754, 0. , 339.36192,
0. , 770.42998, 271.0343 ,
0. , 0. , 1. ]
distortion_model: plumb_bob
distortion_coefficients:
rows: 1
cols: 5
data: [-0.698901, 0.598061, 0.001859, -0.000042, 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: [672.09618, 0. , 344.90462, 0. ,
0. , 711.65311, 276.46242, 0. ,
0. , 0. , 1. , 0. ]