因此在程序中采用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.type: “PinHole”
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.fps: 20.0
Camera.bf: 63.1965
Camera.RGB: 1
ThDepth: 35.0
#--------------------------------------------------------------------------------------------
#--------------------------------------------------------------------------------------------
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]
#--------------------------------------------------------------------------------------------
#--------------------------------------------------------------------------------------------
ORBextractor.nFeatures: 1200
ORBextractor.scaleFactor: 1.2
ORBextractor.nLevels: 8
ORBextractor.iniThFAST: 20
ORBextractor.minThFAST: 7
#--------------------------------------------------------------------------------------------
#--------------------------------------------------------------------------------------------
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