I have the following images of a chessboard taken from a camera:
Here is my minimal working example code:
import cv2
print(cv2.__version__)
left_gray = cv2.imread('left_raw.jpg', cv2.CV_LOAD_IMAGE_GRAYSCALE)
print(left_gray.shape)
ret, left_corners = cv2.findChessboardCorners(left_gray, (6,5))
print(left_corners)
And here is the output, indicating that no corners were found:
2.4.13.1
(1080, 1920)
None
I read several other StackOverflow questions:
- This question is about opencv2 failing in a "seemingly simple scenario" but I believe that the images I have are much more simple because this one had a completely cropped out chessboard version. In my case I have a chessboard which I put on top of some white printer paper.
- This question is about a failure on high-resolution images. I'm not sure if the camera I'm using is high-res but my image is different from that question since the chessboard here is (roughly) centered and isn't completely skewed.
- This question is about a failure on a "perfect" chessboard. However, that one was symmetric, whereas my image is not symmetric (it has 6 rows and 7 columns) and I'm using the input of (5,6) for my chessboard. I also tried (6,5) in case I got it backward but no luck.
- This question was about someone getting the dimensions wrong. The user claims that if we have a (10,7) board, the input to the function should be (9,7) where 10=number of columns, 7=number of rows in original board. However, I think we have to subtract one from both dimensions. In any case, I tried using (7,5) and a few other variants for my image but none of the cases work.
- This question is about MATLAB but the code shouldn't be too different from Python, and that user saw some success in detecting images even for a much more complicated scenario than what I have.
I'm a little lost at this point about how to find the corners. Does anyone have some advice they would like to share? The image and code are right here in case you wish to test them out. I should also point out that I tried increasing the brightness of the original camera when taking the image but no luck.
I was able to obtain a satisfactory result using
cv2.goodFeaturesToTrack()
.CODE:
I know it is not accurate, but with some pre-processing you should be able to obtain a better result.
:D
This is the best result I can get with the following environment:
5x5
C++ code:
As your OpenCV version is different, you may not get the same result. Anyway, you should use instead this OpenCV pattern (yours seems slightly different for me) and remember that the calibration pattern must be as flat as possible to get good calibration results.