Ask Your Question
0

imshow misunderstanding ?

asked 2015-09-03 10:23:31 -0600

NeilR gravatar image

updated 2015-09-03 10:39:03 -0600

LorenaGdL gravatar image

"2.bmp" is a valid bitmap file located in the correct folder. So what's wrong with the following code to make it produce the error ...

error: ........\opencv\modules\highgui\src\window.cpp:261: error: (-215) size.width>0 && size.height>0 in function cv::imshow


import cv2

ifile = cv2.imread("C:\Users\ericnei\My Work\2.bmp")  
cv2.imshow("Demo",ifile)
cv2.waitKey(0)
cv2.destroyAllWindows()
edit retag flag offensive close merge delete

Comments

1

your image is None / empty / was not loaded.

berak gravatar imageberak ( 2015-09-03 10:43:09 -0600 )edit

1 answer

Sort by ยป oldest newest most voted
3

answered 2015-09-03 10:47:04 -0600

LorenaGdL gravatar image

The problem is not in imshow but in imread as @berak said: use frontslashes or double backslashes when entering the path to image: cv2.imread("C:/Users/ericnei/My Work/2.bmp") or cv2.imread("C:\\Users\\ericnei\\My Work\\2.bmp").

edit flag offensive delete link more

Question Tools

1 follower

Stats

Asked: 2015-09-03 10:23:31 -0600

Seen: 376 times

Last updated: Sep 03 '15