1 | initial version |
new_K = cv2.fisheye.estimateNewCameraMatrixForUndistortRectify(K, D, (1280, 720), np.eye(3), balance=1, new_size=(3400, 1912), fov_scale=1)
map1, map2 = cv2.fisheye.initUndistortRectifyMap(K, D, np.eye(3), new_K, (3400, 1912), cv2.CV_16SC2)
undistorted_img = cv2.remap(img, map1[575:1295, 23:3119, :], map2[575:1295, 23:3119], interpolation=cv2.INTER_LINEAR, borderMode=cv2.BORDER_CONSTANT)