This is a lightweight and easy-to-use LiDAR-camera calibration tool. This work is derived from lidar_camera_calibration , changed into an offline calibration tool and decoupled it from ROS.
Chinese version readme: 激光雷达-相机标定工具
Install dependencies.
#python3.8-3.10
$ pip install opencv-python opend3dClone the calibration tool to your computer.
$ git clone https://github.com/onePPF/LiDAR-Camera-Calibration-Tool.git- Solid-state LiDAR: Get an image file and a pointcloud file with the same timestamp and save them in the data folder.
- Mechanical LiDAR: Cause the sparsity of pointcloud generted by mechanical LiDAR, you can use SLAM algorithms to generate dense pointcloud before calibrate. Then save the image and pointcloud files in the data folder. (Note that the coordinate system of the dense pointcloud should be based on the timestamp when the image saved.)
- At the beginning of
calibrate.py, modify theIMG_NAMEandPCD_NAMEto your own file names, and updateCAMERA_MATRIXandDIST_COEFFSwith the camera you want to calibrate. - Run the following to select more than 5 pairs(>= 6) corresponding 2D points and 3D points for calibration. (Hold down the Shift key while clicking the left mouse button to select 3D points.)
$ cd LiDAR-Camera-Calibration-Tool/scripts
$ python calibrate.py- After close the windows, the calibration results will print in the terminal and save in the result folder.
- Run the
project.pyfile to project the pointcloud onto the image and display the calibration results. Refer to step 1 and modify the parameters inproject.pyaccordingly.
$ python project.py