This calibration code is based on pnp algorithm.
Our algorithm support calibration between (fisheye/pinhole)camera and lidar.
Solid_state lidar is highly recommened,and do not move the devices until all data is recored. (enough sample has been collected.The num of sample better >=5)
We give two way to calibrate lidar and camera:
You can manually selet pointcloud feature and image corner feature
Change the number of feature point at code :for i in range(4):
Image should be save as:
your_path/img/
Pcd should be save as:
your_path/pcd/
Set cropped_flag = True
if your pointcloud haven't been processed,and then you can crop chessboard in pointcloud.
Set cropped_flag = False
to skip the pointcloud isolation and directly calibrate.(PS:make sure chessboard pointcloud is ready)
Isolated the chessboard pointcloud as perfect as you can,a perfect pointcloud means a perfect calibration.
After crop chessboard,save pcd as cropped_1.pcd,cropped_2.pcd,cropped_3.pcd... (PS:Start from 1)
The rotation vetor and translation vetor and rotation matrix between cam and lidar would be print in terminal:
cv2.solvePnP
support 4、5、8 distort coefficient : {[(k1,k2,p1,p2),k3],k4,k5,k6} ,fisheye use k1、k2、k3、k4,pinhole use k1,k2,p1,p2,k3
For different camera model, just change distortion vector
lidar-camera-fisheye-calibration/calib.py
Line 68 in 86dcca3
np.array([[k1],[k2],[0],[0],[k3],[k4],[0],[0]])
for KB4
np.array([[k1],[k2],[p1],[p2][k3],[0],[0].[0]])
for PINHOLE
You can verify that this repository runs sucessfully by running this package on our provided quick-start data.
Folder calib
for calib.py
Folder calib_multi
for calib_multi.py
The image below shows the reprojection result:
This algorithm is not robust enough, but it can provide a relatively reliable extrinsic. Future work will focus on improving accuracy