I'm trying to find the corners of a chessboard using OpenCV.
The image I'm using contains two chessboards, but I'm interested only in a sub-region of one of those. The following image shows the original image.
Using GIMP, I've then selected the area of interest and I've set all the other pixel to a default value.
I haven't actually cropped the image because I've already calibrated the camera using this image size and I didn't want to change it. The operation should be equivalent to change the values in the image matrix, but I preferred to do it with GIMP. It is a one time experiment and it is faster to do that operation with a graphic tool instead of using the code.
The resulting image contains a chessboard with 24x5 corners, but the function findChessboardCorners is not able to find anything.
Here is the Python code I'm using:
>>> img = cv2.imread('C:\\Path\\To\\C4-Cropped.png', 0)
>>> cv2.findChessboardCorners(img, (24, 5))
(False, None)
>>> cv2.findChessboardCorners(img, (5, 24))
(False, None)
I also tried to set the adaptive threshold, but it is still not working
>>> cv2.findChessboardCorners(img, (24, 5), flags=cv2.cv.CV_CALIB_CB_ADAPTIVE_THRESH)
(False, None)
That seems really strange. I used this function of OpenCV many times in the past and it always worked, even with images that looked much more complicated than this one. The illumination of the area is not homogeneous but the function should be robust enough to handle that.
Is there any problem with the artificial image created ad hoc with GIMP? How can I find the corners?
Any suggestion would be greatly appreciated.
findChessboardCorners
in your question... else there is really nothing anyone can do to help... :) – Inbar Rose