FindChessboardCorners cannot detect chessboard on very large images by long focal length lens
A few points.
- Down-sizing, as you noticed, helps the detector. That is because the corner-detection filters used in OpenCV to find the corners have fixed size, and that size of convolution mask may be too small to detect your corners - the full-size image may actually look "smooth" at that scale, particularly where it is slightly blurry. However, by downscaling you throw away some corner location accuracy.
- For the same reason, sharpening helps too. However, it also goes against accuracy, because it adds bias to the subpixel positions of the corners - even in the ideal case with no noise. To convince yourself that this is the case, consider the 1D analogue: the intensity of the image around a corner (in 1D, a sharp black-white transition) looks ideally like a sigmoid curve (a ramp with smooth corners), and you want to find the location of its inflection point. Sharpening makes the curve steeper, which in general will move that point's location. Things get worse when you take into account that sharpening generally amplifies noise.
- The likely correct way to proceed is to start at a lower resolution (i.e. downsizing), then scale up the positions of the corners thus found, and use them as the initial estimates for a run of cvFindCornersSubpix at full resolution.
cv2 findChessboardCorners does not detect corners
Finally I could do it. I had to set chessboard_size = (12,7)
then it worked. I had to count the internal number of horizontal and vertical corners.
findChessboardCorners is unable to find chessboard beyond 3x3
As Nullman says, you are defining the size of the chessboard inner corners as 3x3. In the sample image you provided, the inner corner size is 14x6. Therefore, the code would be:
ret, corners = cv2.findChessboardCorners(gray, (14,6),None)
Opencv cv::findchessboardCorners
I think the main problem is that you would have ambiguities since it is easily possible to find different smaller chessboards in a larger one.
If you do corner detection on an image consisting of a chessboard, you will find a regular grid of corners.
Then findChessboardCorners
needs to find a structur which is very similar to the given chessboard of size (x,y). It will rate the different possibilities to map the chessboard to the regular grid found by the corner detection and these ratings are very similar.
So it is difficult to decide which is THE CHESSBOARD, you are looking for.
Related Topics
Opencv Orb Not Finding Matches Once Rotation/Scale Invariances Are Introduced
Access Violation on Static Initialization
Specification of Source Charset Encoding in Msvc++, Like Gcc "-Finput-Charset=Charset"
Getting a Directory Name from a Filename
Opencv: How to Visualize a Depth Image
C/C++ How to Copy a Multidimensional Char Array Without Nested Loops
Concatenating Strings Doesn't Work as Expected
Calling Derived Class Function from Base Class
How to Add Wtl and Atl to Visual Studio C++ Express 2008
How to Find the Name of the Calling Function
Cannot Convert Parameter 1 from 'Char' to 'Lpcwstr'
How to Call Function After Window Is Shown
What Are Potential Dangers When Using Boost::Shared_Ptr
"Proper" Way to Store Binary Data with C++/Stl