我试图用Python打开一系列图像,如下面的示例:https://drive.google.com/file/d/1ue2VfK-I5uQjt0PcQ9ZgZY3dHrSPi7eM/view?usp=sharing
我可以用MatLab打开它们,但我想用python打开它们
试图用ImageJ打开它们,我知道它们是CMYK格式的JPEG
我在Phython(3.8.5)中使用了这段代码,使用的是matplotlib(3.3.4):
import matplotlib.pyplot as plt
mi_img='1.jpg';
I=plt.imread(mi_img)
我得到了这个错误:
File "C:\Users\bbarbes\Anaconda3\lib\site-packages\matplotlib\pyplot.py", line 2246, in imread
return matplotlib.image.imread(fname, format)
File "C:\Users\bbarbes\Anaconda3\lib\site-packages\matplotlib\image.py", line 1496, in imread
with img_open(fname) as image:
File "C:\Users\bbarbes\Anaconda3\lib\site-packages\PIL\Image.py", line 2967, in open
raise UnidentifiedImageError(
UnidentifiedImageError: cannot identify image file 'C:/Users/bbarbes/OneDrive - unav.es/0_programas/cine/raw/1.jpg'
我尝试使用opencv(4.0.1):此代码:
import cv2
I = cv2.imread(mi_img,cv2.IMREAD_UNCHANGED)
cv2.imshow('image',I)
我得到了一个错误:
OpenCV(4.0.1) C:\ci\opencv-suite_1573470242804\work\modules\highgui\src\window.cpp:352: error: (-215:Assertion failed) size.width>0 && size.height>0 in function 'cv::imshow'
而且,我还发现I
是NoneType object
如果有帮助,请使用imghdr检查图像,包括:
import imghdr
imghdr.what(mi_img)
答案是
'jpeg'
有人知道如何在Python中加载此图像吗
提前谢谢你的帮助
目前没有回答
相关问题 更多 >
编程相关推荐