Ask Your Question
-1

problem with cv2.imshow() method

asked 2020-09-21 15:54:41 -0600

delcencen gravatar image

Hello,

i try on many script,on linux and windows,but i still ave a bug on " cv2.imshow()".

the code with my image adress:

import cv2

path = r'C:\Users\me\Pictures\dell latitude\DSCF1513'

image = cv2.imread(path) window_name = 'image'

cv2.imshow(window_name, image)

cv2.waitKey(0)

cv2.destroyAllWindows()

and now the bug:

================= RESTART: C:\Users\me\Documents\opencvTest.py ================= Traceback (most recent call last): File "C:\Users\me\Documents\opencvTest.py", line 18, in <module> cv2.imshow(window_name, image) cv2.error: OpenCV(4.4.0) C:\Users\appveyor\AppData\Local\Temp\1\pip-req-build-k8sx3e60\opencv\modules\highgui\src\window.cpp:376: error: (-215:Assertion failed) size.width>0 && size.height>0 in function 'cv::imshow'

thanks for your help.

edit retag flag offensive close merge delete

1 answer

Sort by ยป oldest newest most voted
0

answered 2020-09-22 01:28:13 -0600

berak gravatar image

problem is not with imshow(), -- your image was not loaded correctly, and is invalid. you have to check the output of imread() before going on.

edit flag offensive delete link more

Question Tools

1 follower

Stats

Asked: 2020-09-21 15:54:41 -0600

Seen: 52,526 times

Last updated: Sep 22 '20