http://www.luohanjie.com/2017-04-05/the-problem-of-calibration-data-in-orb-slam2.html
ORB_SLAM2中標定數據的問題
在使用ORB_SLAM2的過程中,我使用Kinect v2作為攝像機,而在使用之前需要對Kinect進行標定的工作。幸好iai_kinect2這個驅動提供了標定的工具[1]。按照說明操作,獲得了標定的數據,如calib_color.yaml
文件中包含了攝像機的內參和畸變等參數:
%YAML:1.0 cameraMatrix: !!opencv-matrix rows: 3 cols: 3 dt: d data: [ 1.0550860028898474e+03, 0., 9.7022756868552835e+02, 0., 1.0557186689448556e+03, 5.2645231780561619e+02, 0., 0., 1. ] distortionCoefficients: !!opencv-matrix rows: 1 cols: 5 dt: d data: [ 5.0049307122037007e-02, -5.9715363588982606e-02, -1.6247803478461531e-03, -1.3650166721283822e-03, 1.2513177850839602e-02 ] rotation: !!opencv-matrix rows: 3 cols: 3 dt: d data: [ 1., 0., 0., 0., 1., 0., 0., 0., 1. ] projection: !!opencv-matrix rows: 4 cols: 4 dt: d data: [ 1.0550860028898474e+03, 0., 9.7022756868552835e+02, 0., 0., 1.0557186689448556e+03, 5.2645231780561619e+02, 0., 0., 0., 1., 0., 0., 0., 0., 1. ]

%YAML:1.0 #-------------------------------------------------------------------------------------------- # Camera Parameters. Adjust them! #-------------------------------------------------------------------------------------------- # Camera calibration and distortion parameters (OpenCV) Camera.fx: 1.0550860028898474e+03 Camera.fy: 1.0557186689448556e+03 Camera.cx: 9.7022756868552835e+02 Camera.cy: 5.2645231780561619e+02 Camera.k1: 5.0049307122037007e-02 Camera.k2: -5.9715363588982606e-02 Camera.p1: -1.6247803478461531e-03 Camera.p2: -1.3650166721283822e-03 Camera.k3: 1.2513177850839602e-02 Camera.width: 960 Camera.height: 540 # Camera frames per second Camera.fps: 30.0 # Color order of the images (0: BGR, 1: RGB. It is ignored if images are grayscale) Camera.RGB: 1 # IR projector baseline times fx (aprox.) Camera.bf: 40.0 # 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
在解決了雙重標定的問題后[3],我使用qhd質量(960x540)的圖片跑ORB_SLAM2程序,發現無論是單目模式還是RGBD模式的結果都不堪理想。經過排查后,發現還是標定數據的問題。
在iai_kinect2的標定程序中,使用的FullHD(1920x1080)分辨率圖片,所以得到的計算機內參數據是針對1920x1080這個分辨率的;而我在ORB_SLAM2中,使用的是QHD(960x540)分辨率的圖片。為了使用標定數據與使用照片對應,需要對1920x1080下的標定數據作出處理,對內參數據根據分辨率按比例進行縮減[4],在這里,需要對f
的值乘以一個0.5。
%YAML:1.0 #-------------------------------------------------------------------------------------------- # Camera Parameters. Adjust them! #-------------------------------------------------------------------------------------------- # Camera calibration and distortion parameters (OpenCV) Camera.fx: 527.54300144 Camera.fy: 527.85933447 Camera.cx: 485.11378434 Camera.cy: 263.2261589 Camera.k1: 5.0049307122037007e-02 Camera.k2: -5.9715363588982606e-02 Camera.p1: -1.6247803478461531e-03 Camera.p2: -1.3650166721283822e-03 Camera.k3: 1.2513177850839602e-02 ...