0

as i mention in title, i can't detect corner of these images using findChessboardCorners function.my image capture from an IR-camera with resolution 640x480? Is my picture enough contrast? Due to limited condition so I can't capture the chessboard at a larger scale? Someone can fingure out to me what's wrong?

this is my code: import cv2

CHECKERBOARD = (4, 4)
criteria = (cv2.TERM_CRITERIA_EPS + cv2.TERM_CRITERIA_MAX_ITER, 30, 0.001)

objpoints = []

imgpoints = []


objp = np.zeros((1, CHECKERBOARD[0] * CHECKERBOARD[1], 3), np.float32)
objp[0, :, :2] = np.mgrid[0 : CHECKERBOARD[0], 0 : CHECKERBOARD[1]].T.reshape(-1, 2)
prev_img_shape = None

images = glob.glob("./images2/*.jpg")
for fname in images:
    img = cv2.imread(fname)

    gray = cv2.cvtColor(img, cv2.COLOR_BGR2GRAY)
    # Find the chess board corners
    # If desired number of corners are found in the image then ret = true

    ret, corners = cv2.findChessboardCorners(
        gray,
        CHECKERBOARD,
        cv2.CALIB_CB_ADAPTIVE_THRESH
        + cv2.CALIB_CB_FAST_CHECK
        + cv2.CALIB_CB_NORMALIZE_IMAGE,
    )
    print(ret)
    if ret == True:
        objpoints.append(objp)
        # refining pixel coordinates for given 2d points.
        corners2 = cv2.cornerSubPix(gray, corners, (11, 11), (-1, -1), criteria)
        imgpoints.append(corners2)

        # Draw and display the corners
        img = cv2.drawChessboardCorners(img, CHECKERBOARD, corners2, ret)

    cv2.imshow("img", gray)
    cv2.waitKey(0)

and one of my images like that:

2
  • may or may not be the reason but the intensity difference between white and black is so low. you may need to figure it out firstly Sep 24 at 20:06
  • @YunusTemurlenk thanks for your advice, but It isn't the problem Sep 28 at 7:58

1 Answer 1

0

Have you tried findChessboardCornersSB? Maybe a different result

2
  • you mean 3x3...
    – D.L
    Sep 22 at 7:14
  • size for chessboard must be larger than (2,2) Sep 22 at 8:25

Your Answer

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.