I used OpenCV's findChessboardCorners on a few checkerboard images (40~) and about 27 seemed to find the corners accurately. How does one proceed from here? Do I calculate the reprojection error over just the correctly identified images? Is this normal to expect?
Some of the correctly identified images -
Some of the incorrectly identified images -
How I'm calibrating my images -
def calibrate():
criteria = (cv.TERM_CRITERIA_EPS + cv.TERM_CRITERIA_MAX_ITER, 30, 0.001)
objp = np.zeros((6*9,3),np.float32)
objp[:,:2] = np.mgrid[0:9, 0:6].T.reshape(-1,2)
objpoints = []
imgpoints = []
images = glob.glob('*.png')
for fname in images:
img = cv.imread(fname)
gray = cv.cvtColor(img, cv.COLOR_BGR2GRAY)
ret, corners = cv.findChessboardCorners(gray, (9,6), None)
if ret == True:
print('Hello')
objpoints.append(objp)
corners2 = cv.cornerSubPix(gray, corners, (11,11), (-1,-1), criteria)
cv.drawChessboardCorners(img, (9,6), corners, ret)
imgpoints.append(corners2)
cv.imshow('img',img)
cv.waitKey(500)
cv.destroyAllWindows()
ret, mtx, dist, rvecs, tvecs = cv.calibrateCamera(objpoints, imgpoints, gray.shape[::-1],None,None)
return objpoints, imgpoints, ret, mtx, dist, rvecs, tvecs