First of all thanks for all your contributions to OpenCV.
I’m using OpenCV to find chessboard corners on an image. 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.
This feels like a bug to me, given that it completely blocks your application. Is there any way how I can force the function safely to stop for searching after x amount of time?
Reproducing the issue
This issue can easily be reproduced. You can use this image and the following code snippet:
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)
(note: I had to upload the image to Google Drive as the forum was converting it to
.jpeg, which didn’t allow for reproducing the issue.)
You will notice that the function just endlessly keeps running and consuming resources (I’ve let it run for +15 minutes already).
This issue is confirmed both on
opencv-python-220.127.116.11 as well as on
I could not find any other topics or GitHub issues about this topic. If this is confirmed as a bug, I’m happy to create an issue in GitHub.
Thank you in advance!