python图像没有加载

时间:2013-11-04 09:30:07

标签: python python-imaging-library

虽然我正确地给出了路径,但图像没有加载。

import cv2
from PIL import Image
a = Image.open('me.jpg')
a.show()

我在Windows 8 64位上使用OpenCV2.4。

1 个答案:

答案 0 :(得分:0)

如果您确定图片位于项目目录,请尝试:

在您的代码中没有路径,只有文件名....

import cv2
import os
from PIL import Image

a = Image.open(os.path.join(os.path.dirname(__file__)) + '/me.jpg')
a.show()
相关问题