Я получаю (ValueError: не удалось найти формат для чтения указанного файла в режиме 'i') при обработке моего изображения:
import matplotlib.pyplot as plt
from skimage.color import rgb2gray
from skimage.transform import resize
from skimage.io import imread, imshow
import pandas as pd
import numpy as np
import os
import warnings
warnings.simplefilter('ignore')
%matplotlib inline
p1 = os.listdir("C:/Users/IMA/Documents/ML/image/p1")
p2 = os.listdir("C:/Users/IMA/Documents/ML/image/p2")
limit = 20
p1_image = [None]*limit
j = 0
for i in p1:
if(j < limit):
p1_image[j] = imread("C:/Users/IMA/Documents/ML/image/p1/"+i)
j += 1
else:
break
ValueError Traceback (most recent call last)
<ipython-input-7-1854baa31099> in <module>
4 for i in p1:
5 if(j<limit):
----> 6 p1_image[j]=imread("C:/Users/IMA/Documents/ML/image/p1/"+i)
7 j+=1
8 else:
~\anaconda3\lib\site-packages\skimage\io\_io.py in imread(fname, as_gray, plugin, **plugin_args)
46
47 with file_or_url_context(fname) as fname:
---> 48 img = call_plugin('imread', fname, plugin=plugin, **plugin_args)
49
50 if not hasattr(img, 'ndim'):
~\anaconda3\lib\site-packages\skimage\io\manage_plugins.py in call_plugin(kind, *args, **kwargs)
208 (plugin, kind))
209
--> 210 return func(*args, **kwargs)
211
212
~\anaconda3\lib\site-packages\skimage\io\_plugins\imageio_plugin.py in imread(*args, **kwargs)
8 @wraps(imageio_imread)
9 def imread(*args, **kwargs):
---> 10 return np.asarray(imageio_imread(*args, **kwargs))
~\anaconda3\lib\site-packages\imageio\core\functions.py in imread(uri, format, **kwargs)
262
263 # Get reader and read first
--> 264 reader = read(uri, format, "i", **kwargs)
265 with reader:
266 return reader.get_data(0)
~\anaconda3\lib\site-packages\imageio\core\functions.py in get_reader(uri, format, mode, **kwargs)
180 if format is None:
181 raise ValueError(
--> 182 "Could not find a format to read the specified file " "in mode %r" % mode
183 )
184
ValueError: Could not find a format to read the specified file in mode 'i'