-
-
Notifications
You must be signed in to change notification settings - Fork 56.5k
cv2.distanceTransform() crashes on large images #23895
Copy link
Copy link
Description
System Information
OpenCV python version: 4.7.0.72
OS: Windows 10
Python version: 3.10.11
RAM: 128Go
Detailed description
cv2.distanceTransform() raises an exception cv2.error: Unknown C++ exception from OpenCV code when I try to use it with an image of size 50000*50000. And sometimes even crash without any exception with slightly bigger images.
It works for an image of size 45000*45000. I don't know the exact number of pixels where it starts to fail.
I also tried setting the environment variable:
import os
os.environ["CV_IO_MAX_IMAGE_PIXELS"] = f"{2**63}"
import cv2 as cv
Steps to reproduce
testDist = cv.distanceTransform(testImg, cv.DIST_L2, cv.DIST_MASK_3)
with testImg being a numpy ndarray of type uint8 and shape [50000, 50000]
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)
Reactions are currently unavailable