13 lines
609 B
Python
13 lines
609 B
Python
import cv2
|
|
import numpy as np
|
|
flags = 0
|
|
flags |= cv2.CALIB_FIX_INTRINSIC
|
|
# Here we fix the intrinsic camara matrixes so that only Rot, Trns, Emat and Fmat are calculated.
|
|
# Hence intrinsic parameters are the same
|
|
|
|
criteria_stereo= (cv2.TERM_CRITERIA_EPS + cv2.TERM_CRITERIA_MAX_ITER, 30, 0.001)
|
|
|
|
|
|
# This step is performed to transformation between the two cameras and calculate Essential and Fundamenatl matrix
|
|
retS, new_mtxL, distL, new_mtxR, distR, Rot, Trns, Emat, Fmat = cv2.stereoCalibrate(obj_pts, img_ptsL, img_ptsR, new_mtxL, distL, new_mtxR, distR, imgL_gray.shape[::-1], criteria_stereo, flags)
|