一、环境准备

        1.安装环境和驱动(ROS+Livox SDK+Livox_ros_driver)

        ros已经安装过,所以我需要再安装Livox SDK和Livox_ros_driver,按照官方文档直接安装

# install Livox_SDK
git clone https://github.com/Livox-SDK/Livox-SDK.git
cd Livox-SDK
sudo ./third_party/apr/apr_build.sh
cd build && cmake ..
make
sudo make install

# install livox_ros_driver
cd ..
git clone https://github.com/Livox-SDK/livox_ros_driver.git ws_livox/src
cd ws_livox
catkin_make

        2.安装依赖(PCL+Eigen+Ceres-solver)

        ros中包含PCL库,这里直接安装Eigen和Ceres-solver:

        Eigen:

sudo apt-get install libeigen3-dev

        Ceres-solver:

        ①在源代码网址右下角的Realeases下的tags中找到1.14.0版本,下载压缩包

GitHub - ceres-solver/ceres-solver: A large scale non-linear optimization library

        ②安装Ceres-solver相关依赖

sudo apt-get install liblapack-dev libsuitesparse-dev libcxsparse3 libgflags-dev libgoogle-glog-dev libgtest-dev

        ③解压压缩包,在ceres-solver-1.14.0路径下新建build文件夹,并进入build路径

tar -zxvf ceres-solver-1.14.0.tar.gz 
cd ceres-solver-1.14.0/
mkdir build
cd build/

        ④编译并安装

cmake ..
make
sudo make install

 编译成功!

安装成功! 

         ⑤验证Ceres-solver是否安装成功

在终端运行:

bin/simple_bundle_adjuster xxx/ceres-solver-1.14.0/data/problem-16-22106-pre.txt

 将xxx改为ceres-solver-1.14.0存放的路径,路径不对可能会出现下列错误

ERROR: unable to open file ../ceres-solver-1.14.0/data/problem-16-22106-pre.txt
段错误 (核心已转储)

安装成功会出现:

二、下载相机-雷达标定源码并编译

# 进入工作空间
cd ws_livox/src
git clone https://github.com/Livox-SDK/livox_camera_lidar_calibration.git 
cd ..    # 返回上一级目录
catkin_make
source devel/setup.bash

编译成功!

三、数据准备

直接使用github上提供的data:

https://terra-1-g.djicdn.com/65c028cd298f4669a7f0e40e50ba1131/Download/update/data.zip

四、相机内参标定 

1.准备数据

在ws_livox/src/livox_camera_lidar_calibration/launch/cameraCalib.launch中配置相应的路径和参数。默认路径是将照片数据放在data/camera/photos下,并在data/camera/in.txt中写入对应的照片名称,如下图所示。(直接下载的数据photos和in.txt在data/camera下)

2.配置路径(如图)

将in.txt和photos的路径一一对应得写在camera_in_path和camera_folder_path中

这里注意photos后面有个  /  不要删掉否则会引起报错:

3.运行命令开始校准

roslaunch camera_lidar_calibration cameraCalib.launch

运行成功的结果会保存在results.txt中,包含一个一个3x3的内参矩阵(IntrinsicMatrix)和五个校正畸变的参数,k1、k2、p1、p2、k3。

五、采集标定数据

获取照片中的角点坐标:

        1.将上一步得到的内参矩阵和五个校正畸变的参数保存在data/parameters/intrinsic.txt中

         2.配置cornerPhoto.launch的路径

        3.运行:

roslaunch camera_lidar_calibration cornerPhoto.launch

 运行后程序将打开相应的照片。在此UI界面上,将鼠标移动到标定板的各个角上,从左上角的角点开始,逆时针旋转,记下四个角点的坐标,相应的坐标数据将显示在窗口的左下角。

这里我出现了UI界面左下角没有坐标数据的情况,解决方法是下载一个修改过的标定工具包并重新编译(需要把原来的livox_camera_calibration文件删除):

cd ws_livox/src 
git clone https://github.com/Shelfcol/livox_camera_lidar_calibration_modified.git
cd ..
catkin_make
source devel/setup.bash

再运行roslaunch camera_lidar_calibration cornerPhoto.launch:

在弹出的图片上从左上角开始,逆时针左键标出四个角点,右键点击完成,进行下一张图片的标定。

获取点云中的角点坐标:

        1.下载的数据中已经生成pcd文件

        2.使用PCL可视化程序打开PCD文件,按住shift+左键单击即可获取所选点坐标,请保持角点顺序与照片相同。

        运行:

pcl_viewer -use_point_picking xx.pcd

        3.将角点三维坐标以下面的格式保存在corner_lidar.txt:

六、外参计算

        1.配置getExt1.launch和getExt2.launch的路径

        2.

roslaunch camera_lidar_calibration getExt1.launch

        3.

roslaunch camera_lidar_calibration getExt2.launch

七、结果验证

roslaunch camera_lidar_calibration projectCloud.launch

参考资料:GitHub - Livox-SDK/livox_camera_lidar_calibration: Calibrate the extrinsic parameters between Livox LiDAR and camera

【Ubuntu18.04】激光雷达与相机联合标定(Livox+HIKROBOT)(一)相机内参标定_livox_camera_lidar_calibration需要的opencv版本-CSDN博客 Ubuntu18.04安装Ceres,图文详解_ceres安装-CSDN博客

OpenCV相机标定报错:Error: Assertion failed (nimages > 0) in cv::calibrateCameraRO_error: (-215:assertion failed) nimages > 0 in func-CSDN博客

Logo

旨在为数千万中国开发者提供一个无缝且高效的云端环境,以支持学习、使用和贡献开源项目。

更多推荐