- #1
daanvancamp
- 2
- 0
Post
I am trying to recognize a chessboardpattern using opencv(cv2) and python.
I use the built-in findchessboardcorners feature which returns nothing if it doesn’t find the hole board.
Right now, I use this code.
Most of the time, the function only sets the value of ret to False, which means that it didn’t find anything. The board is only recognized in about a sixth of the cases.
Does anyone know how to improve the recognition? I suppose that I need to reduce noise, but that’s what medianBlur does already. Is it an issue with the function itself?
Here are a few images I used:
https://ibb.co/n7vVLtj
https://ibb.co/8cF18c1
https://ibb.co/rpDph1S
https://ibb.co/RQc3jmR
I am trying to recognize a chessboardpattern using opencv(cv2) and python.
I use the built-in findchessboardcorners feature which returns nothing if it doesn’t find the hole board.
Right now, I use this code.
Python:
img=cv2.imread(path_board)
gray = cv2.cvtColor(img, cv2.COLOR_BGR2GRAY)
gray = cv2.medianBlur(gray, 5)
ret, corners = cv2.findChessboardCorners(gray, number_of_corners,
flags=cv2.CALIB_CB_ADAPTIVE_THRESH +
cv2.CALIB_CB_FAST_CHECK +
cv2.CALIB_CB_NORMALIZE_IMAGE + cv2.CALIB_CB_EXHAUSTIVE)
if ret == True:
print("Chessboard detected")
img_with_corners = cv2.drawChessboardCorners(img_with_corners, (BOARD_SIZE + 1,BOARD_SIZE + 1), all_corners.reshape(-1, 1, 2), ret)
else:
print("No chessboard detected")
Most of the time, the function only sets the value of ret to False, which means that it didn’t find anything. The board is only recognized in about a sixth of the cases.
Does anyone know how to improve the recognition? I suppose that I need to reduce noise, but that’s what medianBlur does already. Is it an issue with the function itself?
Here are a few images I used:
https://ibb.co/n7vVLtj
https://ibb.co/8cF18c1
https://ibb.co/rpDph1S
https://ibb.co/RQc3jmR
Last edited by a moderator: