from PIL import Image
import cv2 #EDIT, this line added
im = Image.open('withmed.jpg',0)
im.show('image',img)
k = cv2.waitkey(0)
if k == 27:
cv2.destroyAll windows
我正在尝试打开桌面上保存的jpg图像。但是在运行这段代码时,出现了一个错误提示。
Traceback (most recent call last):
File "/home/anusha/aswathy.py", line 5, in <module>
cv2.imshow('image',img)
error: /build/buildd/opencv-2.4.8+dfsg1/modules/highgui/src/window.cpp:269:
error: (-215) size.width>0 && size.height>0 in function imshow