双目测距项目
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

39 lines
1.2KB

  1. import numpy as np
  2. # 双目相机参数
  3. class stereoCamera(object):
  4. def __init__(self):
  5. # 左相机内参
  6. self.cam_matrix_left = np.load("Camera matrix left.npy")
  7. # 右相机内参
  8. self.cam_matrix_right = np.load('CameraMatrix right.npy')
  9. # 左右相机畸变系数:[k1, k2, p1, p2, k3]
  10. self.distortion_l = np.load('distCoeffs left.npy')
  11. self.distortion_r = np.load('distCoeffs right.npy')
  12. # 旋转矩阵
  13. self.R = np.load('R.npy')
  14. # 平移矩阵
  15. self.T = np.load('T.npy')
  16. # 主点列坐标的差
  17. self.doffs = 0.0
  18. # 指示上述内外参是否为经过立体校正后的结果
  19. self.isRectified = False
  20. def setMiddleBurryParams(self):
  21. self.cam_matrix_left = np.load("Camera matrix left.npy")
  22. self.cam_matrix_right = np.load('CameraMatrix right.npy')
  23. self.distortion_l = np.load('distCoeffs left.npy') # 以下6行代码是添加的
  24. self.distortion_r = np.load('distCoeffs right.npy')
  25. self.R = np.load('R.npy')
  26. self.T = np.load('T.npy')
  27. self.doffs = 21.83546358
  28. self.isRectified = True