-
-
Notifications
You must be signed in to change notification settings - Fork 56.5k
Description
System Information
OpenCV python version: both 3.4.18.65 and 4.7.0.72
Operating System / Platform: Ubuntu 18.04 and macOS 13.2.1
Python version: 3.7
Detailed description
I’m using OpenCV to find chessboard corners on an image using cv2.findChessboardCorners(). It can happen that an image is passed into the function that is of bad quality or almost completely black. When this happens, the function just endlessly runs, trying to find the corners.
I initially opened a topic on the OpenCV forum, but there it was confirmed that it's a bug, hence why I'm also opening a bug report here.
This issue is a problem to me because it completely blocks my application when this happens.
Steps to reproduce
This issue can easily be reproduced.
You can use the code snippet below:
import cv2
test = cv2.imread("/path/to/the/image/27-04-2023_14-13-21_494.png")
found, corners = cv2.findChessboardCorners(image=test,
patternSize=(26, 16),
flags=(cv2.CALIB_CB_FAST_CHECK +
cv2.CALIB_CB_ADAPTIVE_THRESH +
cv2.CALIB_CB_NORMALIZE_IMAGE))
print(found)
in combination with the image below:

You will notice that the function just endlessly keeps running and consuming resources (I’ve let it run for +15 minutes already).
Issue submission checklist
- I report the issue, it's not a question
- I checked the problem with documentation, FAQ, open issues, forum.opencv.org, Stack Overflow, etc and have not found any solution
- I updated to the latest OpenCV version and the issue is still there
- There is reproducer code and related data files (videos, images, onnx, etc)