I am trying to calibrate a 200 deg FOV fisheye camera, using cv2.fisheye image is too much cropped while undistortion. When I am trying to calibrate using cv2.omnidir I got the following error.
cv2.error: OpenCV(4.5.1) /tmp/pip-req-build-n_alixql/opencv/modules/core/src/matrix_wrap.cpp:1146: error: (-215:Assertion failed) !fixedSize() || ((Mat*)obj)->size.operator()() == _sz in function 'create'
Here is how I am using this command
k = np.zeros((3, 3), dtype=np.float32)
d = np.zeros((4, 1), dtype=np.float32)
dims = gray.shape[::-1]
rvecs = [np.zeros((1, 1, 3), dtype=np.float32) for _ in range(len(obj_points))]
tvecs = [np.zeros((1, 1, 3), dtype=np.float32) for _ in range(len(obj_points))]
rms, _, _, _, _ = cv2.omnidir.calibrate(
objectPoints=np.array(obj_points, dtype=np.float32),
imagePoints=np.array(img_points, dtype=np.float32),
size=dims,
K=k,
xi=np.array([], dtype=np.float32),
D=d,
rvecs=rvecs,
tvecs=tvecs,
flags=cv2.omnidir.CALIB_FIX_SKEW + cv2.omnidir.CALIB_USE_GUESS,#cv2.omnidir.CALIB_USE_GUESS+ cv2.omnidir.CALIB_FIX_SKEW,
criteria=(cv2.TERM_CRITERIA_EPS + cv2.TERM_CRITERIA_MAX_ITER, 30, 1e-6))
I will appreciate any help with this. Thanks
Solved assertion issue using this command
I was expecting that cv2.omnidir.calibrate would have the same syntax as cv2.fisheye.calibrate.