1
$\begingroup$

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 -

enter image description here

Some of the incorrectly identified images - enter image description here

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
$\endgroup$

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Browse other questions tagged or ask your own question.