Ask Your Question
-1

error: OpenCV(3.4.1) C:\Miniconda3\conda-bld\opencv-suite_1533128839831\work\modules\highgui\src\window.cpp:356: error: (-215) size.width>0 && size.height>0 in function cv::imshow

asked 2019-04-12 21:15:25 -0600

ravikanth076@gmail.com gravatar image

updated 2019-04-13 09:25:30 -0600

supra56 gravatar image

i got the above error for this code so please help me to find out the reason.

 import cv2
#import numpy as np
img=cv2.imread("C:/Users/ravik_000/Desktop/photo",1)
cv2.imshow('image',img)
cv2.waitKey(0)
cv2.destroyAllWindows()
edit retag flag offensive close merge delete

2 answers

Sort by ยป oldest newest most voted
0

answered 2019-04-13 09:29:15 -0600

supra56 gravatar image

updated 2019-04-13 10:05:16 -0600

You need to add filename.

img=cv2.imread("C:/Users/ravik_000/Desktop/photo/filename+extension",1)
edit flag offensive delete link more
0

answered 2019-04-13 01:37:58 -0600

berak gravatar image

updated 2019-04-13 09:32:07 -0600

your image was never read (imread() returns None silently on failure, and you will get errors in the next lines, trying to process an invalid image).

please make it a habit to check EVERY imread() call like:

im = cv2.imread(somepath)
if not im:
       # fail, you can't go on ! check the path, and try again
edit flag offensive delete link more

Question Tools

1 follower

Stats

Asked: 2019-04-12 21:15:25 -0600

Seen: 6,268 times

Last updated: Apr 13 '19