-
-
Notifications
You must be signed in to change notification settings - Fork 56.5k
imread Should Raise If Path Doesn't Exist #14095
Copy link
Copy link
Open
Labels
Description
System information (version)
- OpenCV => 4.0.1
- Operating System / Platform => MacOS 10.14 Mojave
- Compiler => Xcode 10.1
Detailed description
cv2.imread doesn't check file existence and reads nonexistent files into a NoneType object. In comparison, matplotlib.pyplot.imread and PIL both throw.
Steps to reproduce
import cv2
nonetype_thingy = cv2.imread('nonexistent_path.jpg') # this is somehow legal
cv2.imshow('lel', nonetype_thingy) # this will throw a "cv2.error: OpenCV(4.0.1) /Users/username/opencv/modules/highgui/src/window.cpp:352: error: (-215:Assertion failed) size.width>0 && size.height>0 in function 'imshow'"Reactions are currently unavailable