I am trying to calibrate a fisheye lens following these instructions https://medium.com/@kennethjiang/calibrate-fisheye-lens-using-opencv-333b05afa0b0 where you can find the full code I'm using for the calibration part.
I arrive at this point where:
N_OK = len(objpoints)
K = np.zeros((3, 3))
D = np.zeros((4, 1))
rvecs = [np.zeros((1, 1, 3), dtype=np.float64) for i in range(N_OK)]
tvecs = [np.zeros((1, 1, 3), dtype=np.float64) for i in range(N_OK)]
rms, _, _, _, _ = \
cv2.fisheye.calibrate(
objpoints,
imgpoints,
gray.shape[::-1],
K,
D,
rvecs,
tvecs,
calibration_flags,
(cv2.TERM_CRITERIA_EPS+cv2.TERM_CRITERIA_MAX_ITER, 30, 1e-3)
)
print("Found " + str(N_OK) + " valid images for calibration")
print("DIM=" + str(_img_shape[::-1]))
print("K=np.array(" + str(K.tolist()) + ")")
print("D=np.array(" + str(D.tolist()) + ")")
I get this error:
Traceback (most recent call last)
<ipython-input-10-deaca9981fe4> in <module>()
13 tvecs,
14 calibration_flags,
---> 15 (cv2.TERM_CRITERIA_EPS+cv2.TERM_CRITERIA_MAX_ITER, 30, 1e-3)
16 )
17 print("Found " + str(N_OK) + " valid images for calibration")
error: C:\ci\opencv_1512688052760\work\modules\calib3d\src\fisheye.cpp:1414:
error: (-3) CALIB_CHECK_COND - Ill-conditioned matrix for input array 0 in
function cv::internal::CalibrateExtrinsics
I don't understand what's going on and I could only find so little information around the internet, does anyone have experienced something similar and know how to solve this?
Thanks
These are the images of the checkerboard I'm using:
- https://i.stack.imgur.com/goHIg.jpg
- https://i.stack.imgur.com/kja3O.jpg
- https://i.stack.imgur.com/XbIzh.jpg
- https://i.stack.imgur.com/uQ9Gr.jpg
- https://i.stack.imgur.com/N8aLJ.jpg
- https://i.stack.imgur.com/JMmmZ.jpg
- https://i.stack.imgur.com/QJ8wn.jpg
- https://i.stack.imgur.com/NmiFQ.jpg
- https://i.stack.imgur.com/sQHdd.jpg
- https://i.stack.imgur.com/DNBuD.jpg
- https://i.stack.imgur.com/vFtOo.jpg
- https://i.stack.imgur.com/lhkF5.jpg