获得相机内参矩阵

    roscore
    roslaunch realsense2_camera rs_rgbd.launch
    rostopic echo /camera/color/camera_info

    运行之后显示如图

 

 

 K就是我们得到的内参矩阵写成了向量模式。
K = [fx 0 cx 0 fy cy 0 0 1 ]
然后就是baseline,根据官方datasheet

 

 

 D435 的baseline为50mm,bf的值为bf = baseline (in meters) * fx。
给出根据相机参数得到的新的yaml文件

%YAML:1.0

#--------------------------------------------------------------------------------------------
# Camera Parameters. Adjust them!
#--------------------------------------------------------------------------------------------

# Camera calibration and distortion parameters (OpenCV) 
Camera.fx: 613.5963134765625
Camera.fy: 613.9188232421875
Camera.cx: 334.3258361816406
Camera.cy: 237.67372131347656

Camera.k1: 0.0
Camera.k2: 0.0
Camera.p1: 0.0
Camera.p2: 0.0

Camera.width: 640
Camera.height: 480

# Camera frames per second 
Camera.fps: 30.0

# IR projector baseline times fx (aprox.)
Camera.bf: 30.6798156738

# Color order of the images (0: BGR, 1: RGB. It is ignored if images are grayscale)
Camera.RGB: 1

# Close/Far threshold. Baseline times.
ThDepth: 50.0

# Deptmap values factor
DepthMapFactor: 1000.0

#--------------------------------------------------------------------------------------------
# ORB Parameters
#--------------------------------------------------------------------------------------------

# ORB Extractor: Number of features per image
ORBextractor.nFeatures: 1000

# ORB Extractor: Scale factor between levels in the scale pyramid     
ORBextractor.scaleFactor: 1.2

# ORB Extractor: Number of levels in the scale pyramid    
ORBextractor.nLevels: 8

# ORB Extractor: Fast threshold
# Image is divided in a grid. At each cell FAST are extracted imposing a minimum response.
# Firstly we impose iniThFAST. If no corners are detected we impose a lower value minThFAST
# You can lower these values if your images have low contrast            
ORBextractor.iniThFAST: 20
ORBextractor.minThFAST: 7

#--------------------------------------------------------------------------------------------
# Viewer Parameters
#--------------------------------------------------------------------------------------------
Viewer.KeyFrameSize: 0.05
Viewer.KeyFrameLineWidth: 1
Viewer.GraphLineWidth: 0.9
Viewer.PointSize: 2
Viewer.CameraSize: 0.08
Viewer.CameraLineWidth: 3
Viewer.ViewpointX: 0
Viewer.ViewpointY: -0.7
Viewer.ViewpointZ: -1.8
Viewer.ViewpointF: 500

realsense发布(publish)的camera data 在/camera/color/image_raw 和 depth data 在 /camera/depth/image_rect_raw ,所以我们要更改 ~/ORB_SLAM2/Examples/ROS/ORB_SLAM2/src/ros_rgbd.cc下接收的位置

之后要再运行./build_ros.sh

最后运行

roscore
rosrun ORB_SLAM2 RGBD ./ORB_SLAM2/Vocabulary/ORBvoc.txt ./ORB_SLAM2/Examples/ROS/ORB_SLAM2/my_rs_D435i.yaml
roslaunch realsense2_camera rs_rgbd.launch

 

posted on 2020-04-09 17:42  一抹烟霞  阅读(1974)  评论(0编辑  收藏  举报

Live2D