error: OpenCV(4.1.0) error: (-215:Assertion failed) !ssize.empty() in function 'cv::resize'
Generally this problem occurs due to resizing of the image, I just apply try and catch statement for resizing the image so that any error handling. It is working fine and not getting error related to shape.
img=cv2.imread(filename)
print(img)
try:
img = cv2.resize(img, (1400, 1000), interpolation=cv2.INTER_AREA)
print(img.shape)
except:
break
height, width , layers = img.shape
size=(width,height)
print(size)
OpenCV(4.1.2) error: (-215:Assertion failed) !ssize.empty() in function 'cv::resize'
Your img
variable is empty, you probably didn't load the image correctly. Try printing your img.shape
after you load your image. Then have a look at the path you specified, there is probably something wrong with it. (Either you misspelled something or the file doesn't exist in that directory)
How to solve error (-215:Assertion failed) !ssize.empty() in function 'resize'?
The path to you test images is broken. The error comes as a result of cv2
trying to resize on empty numpy
array. You should check the path to the test dataset (ensure the image_paths
are reachable)
Retrieving opencv error (-215:Assertion failed) !ssize.empty() in function 'cv::resize'
I solved the issue by changing the code from recv_string() to recv_pyobj() and from send() to send_pyobj() and the code works perfectly fine. Thanks
Related Topics
How to Merge Elements in List in Python With Condition
Check If Dataframe Has a Zero Element
How to Match a Newline Character in a Raw String
Read CSV from Google Cloud Storage to Pandas Dataframe
Python Not Working in the Command Line of Git Bash
Convert Image Files to a CSV File
Replace a Word in a String by Indexing Without "String Replace Function" -Python
How to Tell Python to Convert Integers into Words
Check If Key Exists in a Python Dict in Jinja2 Templates
Compare a Column Between 2 CSV Files and Write Differences Using Python
Regex to Append Some Characters in a Certain Position
How to Install Tesseract for Python on Anaconda
How to Get a Fields Particular Value of Json in Python
How to Create an Automatically Updating Gui Using Tkinter
Truth Value of a Series Is Ambiguous. Use A.Empty, A.Bool(), A.Item(), A.Any() or A.All()
How to Disable Pylint Unused Import Error Messages in VS Code
How to Write 2 Lists of Items in 2 Columns Instead of 2 Arrays