其他分享
首页 > 其他分享> > ZED2运行ORB_SLAM3

ZED2运行ORB_SLAM3

作者:互联网

ZED2运行ORB_SLAM3

  1. 修改标定参数:
    确定zed2的标定参数,开始找了很多资料发现很多人选择采用棋盘标定的方法和kalibr,还有一部分选择zed中自定义的标定方法,但是在后来的资料查阅中发现官网明确提出对于ZED2有一个note:
    大体的意思是可以使用ZED校准工具手动重新校准相机。但是,我们不建议ZED2 摄像机使用。因此ZED2经过了严格的多步骤工厂校准(包括热测量),手动校准可能会降低其校准参数。

因此在程序中采用ZED2的原校准参数,一般可能会选择 /usr/local/zed/settings/SN29441421.conf
但是在后期的测试中发现并不完全正确,因此需要重新检测,根据zed官网提高的开发手册写了以下代码进行提取其中的fx,cx,fy,cy等参数。
import pyzed.sl as sl

def main1():
zed = sl.Camera()
init_params = sl.InitParameters()
init_params.sdk_verbose=False
err = zed.open(init_params)
if err !=sl.ERROR_CODE.SUCCESS:
exit(1)
calibration_params = zed.get_camera_information().calibration_parameters
focal_left_x = calibration_params.right_cam.fx
focal_left_y = calibration_params.right_cam.fy
focal_left_cx = calibration_params.right_cam.cx
focal_left_cy = calibration_params.right_cam.cy
k1 = calibration_params.right_cam.disto[0]
k2 = calibration_params.right_cam.disto[1]
k3 = calibration_params.right_cam.disto[4]
p1 = calibration_params.right_cam.disto[2]
p2 = calibration_params.right_cam.disto[3]
# tz = calibration_params.T.z
h_Fov = calibration_params.right_cam.h_fov

print(focal_left_x,focal_left_y,focal_left_cx,focal_left_cy,)
print("__________________")
print(k1,k2,k3,p1,p2)
zed.close()

if name == ‘main’:
main1()

然后将提取的数据重新写入到 EuRoC.yaml 中,修改后的数据如下所示:
%YAML:1.0

#--------------------------------------------------------------------------------------------

Camera Parameters. Adjust them!

#--------------------------------------------------------------------------------------------
Camera.type: “PinHole”

Camera calibration and distortion parameters (OpenCV)

Camera.fx: 526.105
Camera.fy: 526.105
Camera.cx: 621.761
Camera.cy: 362.153

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

Camera.bFishEye: 0

Camera.width: 2560
Camera.height: 720

Camera frames per second

Camera.fps: 20.0

stereo baseline times fx

Camera.bf: 63.1965

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: 35.0

#--------------------------------------------------------------------------------------------

Stereo Rectification. Only if you need to pre-rectify the images.

Camera.fx, .fy, etc must be the same as in LEFT.P

#--------------------------------------------------------------------------------------------
LEFT.height: 720
LEFT.width: 2560
LEFT.D: !!opencv-matrix
rows: 1
cols: 5
dt: d
data:[0.0, 0.0, 0.0, 0.0, 0.0]
LEFT.K: !!opencv-matrix
rows: 3
cols: 3
dt: d
data: [526.1055297851562, 0.0, 621.7615966796875, 0.0, 526.1055297851562, 362.15313720703125, 0.0, 0.0, 1.0]
LEFT.R: !!opencv-matrix
rows: 3
cols: 3
dt: d
data: [1.0,0.0,0.0,0.0,1.0,0.0,0.0,0.0,1.0]
LEFT.P: !!opencv-matrix
rows: 3
cols: 4
dt: d
data: [526.1055297851562, 0, 621.7615966796875, 0, 0, 526.1055297851562, 362.15313720703125, 0.0, 0.0, 0.0, 1.0, 0.0]

RIGHT.height: 720
RIGHT.width: 2560
RIGHT.D: !!opencv-matrix
rows: 1
cols: 5
dt: d
data:[0.0, 0.0, 0.0, 0.0, 0.0]
RIGHT.K: !!opencv-matrix
rows: 3
cols: 3
dt: d
data: [526.2108764648438, 0.0, 621.7569580078125, 0.0, 526.2108764648438, 362.1274719238281, 0.0, 0.0, 1]
RIGHT.R: !!opencv-matrix
rows: 3
cols: 3
dt: d
data: [1.0,0.0,0.0,0.0,1.0,0.0,0.0,0.0,1.0]
RIGHT.P: !!opencv-matrix
rows: 3
cols: 4
dt: d
data: [526.2108764648438, 0, 621.7569580078125, 0.0, 0.0, 526.2108764648438, 362.1274719238281, 0.0, 0.0, 0.0, 1.0, 0.0]

#--------------------------------------------------------------------------------------------

ORB Parameters

#--------------------------------------------------------------------------------------------

ORB Extractor: Number of features per image

ORBextractor.nFeatures: 1200

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

标签:Camera,calibration,Viewer,0.0,SLAM3,params,cam,ZED2,ORB
来源: https://blog.csdn.net/qq_35212636/article/details/118313177