This repository is a set of toolbox and utilities to calibrate the extrinsic parameters between a LiDAR and a camera.
- Install gnupg in Python3 for rosbag compatibility. Use the following commandline input.
$ sudo pip3 install python-gnupg
- Install MATLAB.
- Get a checker board. Tested with the one in Mavlab with square size of 119mm*119mm. If you are calibrating a thermal camera, leave the calibration board under sunlight or heat source for 5 minutes, then the thermal camera should be able to detect the checkerboard pattern.
- Record the data into bag files. Make sure the checkerboard is within the FOV of the camera. Stand 3 to 6 meters away from the sensors. Each bag file should contain one static checkerboard pose. Record each pose bag for 10 seconds. Record 10-15 poses for each camera/LiDAR pair.
- Setup a working directory with the following sub-folders:
bag
,images
,pcd
,xyz
. - Put bag files to the
bag
sub-directory. - Extract images to
images
sub-directory withutil/save_one_image_from_bag.py
. - Extract
.xyz
point clouds toxyz
sub-directory withutil/bag_to_xyz.sh
(You will need to change the path in this script). - Examine the extracted image data. Delete any (image, pointcloud) pair if the calibration target is invalid (out of FOV, large angle, etc).
Use /tool_box/intrinsic_calibration
to calibrate intrinsic paramters for each camera. Here is the link to the tutorial of the toolbox.
Save the Calib_Result.mat
file in the image folder.
Note1: This toolbox is relatively difficult to use, however the result format is necessary for LiDAR/camera extrinsics calibration.
Note2: The toolbox cannot properly save the result if there already exists files with name Calib_Result.mat
in the matlab path.
Use /tool_box/extrinsic_calibration
to calibrate extrinsic paramters between one camera and VLP-16. Here is the link to the original toolbox and here is the link to the modified toolbox to improve LiDAR plane selection.
I also made some modifications to support sparse point cloud for VLP-16, but the procedure is basically the same. I suggest to read up both links above for more details.
Save the calibration result in the xyz folder.
In xyz folder, run matlab script project_to_cam_main.m
from /util
to show the projected lidar points on the image.
See if the discontinuities of the lidar points are reasonable in the image (e.g. edge of the checker board).