-
-
Notifications
You must be signed in to change notification settings - Fork 56.4k
Closed
Milestone
Description
System Information
Python version: 3.8.18
OpenCV python version: 4.10.0
Operating System / Platform: Windows-10-10.0.19045-SP0
Detailed description
cv2.error: OpenCV(4.10.0) D:\a\opencv-python\opencv-python\opencv\modules\imgproc\src\cornersubpix.cpp:99: error: (-215:Assertion failed) Rect(0, 0, src.cols, src.rows).contains(cT) in function 'cv::cornerSubPix'
Steps to reproduce
import cv2
import numpy as np
src = np.zeros((500, 500), dtype=np.uint8)
corners = np.array([
[63.23869, 233.98373],
[24.23986, 21.29863],
[123.34534, 499.52298],
[225.45345, 56.35624],
[32.87236, 217.28916],
[124.59836, 166.02876],
], dtype=np.float32).reshape(-1, 1, 2)
winSize = (3, 3)
zeroZone = (-1, -1)
criteria = (cv2.TERM_CRITERIA_EPS + cv2.TERM_CRITERIA_MAX_ITER, 20, 0.1)
refined_corners = cv2.cornerSubPix(src, corners, winSize, zeroZone, criteria)
In this case, in array, if there is some number more than 499.5, like 499.52298, the exception would be throw.
If the number smaller than 499.5, like 499.00001, this kind of exception would not be throw.
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)