D455 camera calibration binocular + imu (2)

2. Binocular camera calibration

2.1 Install Kalibr

//安装依赖
sudo apt-get install python-setuptools python-rosinstall ipython libeigen3-dev  doxygen libopencv-dev ros-melodic-vision-opencv ros-melodic-image-transport-plugins ros-melodic-cmake-modules  software-properties-common libpoco-dev python-matplotlib python-scipy python-git python-pip ipython libtbb-dev libblas-dev liblapack-dev python-catkin-tools libv4l-dev python-pyx
sudo apt-get install -y libigraph0-dev
sudo pip install python-igraph==0.7.0

//创建工作空间
mkdir -p ~/kalibr_ws/src
cd ~/kalibr_ws/src

//安装编译kalibr
git clone https://github.com/ethz-asl/Kalibr.git
cd ..
catkin_make -DCMAKE_BUILD_TYPE=Release

2.2 Preparation before calibration

Print the calibration board, print it out on A4 paper, and stick it on the fixed white wall.

Create a calibration file

touch checkerboard.yaml

Fill in the content as follows:

target_type: 'checkerboard' #gridtype
targetCols: 8               #number of internal chessboard corners
targetRows: 5               #number of internal chessboard corners
rowSpacingMeters: 0.030      #size of one chessboard square [m]
colSpacingMeters: 0.030      #size of one chessboard square [m]

I use the checkerboard in the above picture, the number is 9 columns and 6 rows, and the corresponding Cols and Rows in checkerboard.yaml need to write 8 and 5! ! ! Otherwise, [FATAL] [1612519163.722674]: No corners could be extracted for camera /left! ***

Note that the length of the grid side is subject to the actual measured length after printing! ! !

2.3 Turn on the camera to record the topic

Copy and paste rs_camera.launch and rename it to stereo.launch. Then modify the relevant topics in it, the changes that need to be made are as follows:

  <arg name="infra_width"         default="640"/>
  <arg name="infra_height"        default="480"/>
  <arg name="enable_infra"        default="true"/>
  <arg name="enable_infra1"       default="true"/>
  <arg name="enable_infra2"       default="true"/>

  <arg name="infra_fps"           default="30"/>

start camera

roslaunch realsense2_camera stereo.launch

Then you need to turn off the structured light

rosrun rqt_reconfigure rqt_reconfigure

Set emitter_enable to off

 Open rviz, subscribe the left and right topics /camera/infra1/image_rect_raw and /camera/infra2/image_rect_raw:

Then first reduce the image publishing frequency to 4Hz

rosrun topic_tools throttle messages /camera/infra1/image_rect_raw 4.0 /infra_left & rosrun topic_tools throttle messages /camera/infra2/image_rect_raw 4.0 /infra_right

start recording

rosbag record -O mult_cam_d455  /infra_left /infra_right 

Then the camera moves as follows: First, back and forth, left and right, and up and down respectively, and then back and forth in three directions of pitch, roll, and yaw. Be careful not to move too fast, and ensure that the calibration plate always appears in the image

2.4 Start Calibration

Put the bag and checkerboard.yaml under the kalibr_ws path

cd kalibr_ws
source devel/setup.bash
rosrun kalibr kalibr_calibrate_cameras --target checkerboard.yaml --bag mult_cam_d455.bag --models pinhole-radtan pinhole-radtan  --topics /infra_left /infra_right

2.5 Results

 Among them, if the reprojection error is below 1 pixel, it is reasonable. Here, my calibration result is more than 0.03, which means it is more accurate.

Guess you like

Origin blog.csdn.net/weixin_62952541/article/details/131650703
Recommended