用法:
class skimage.io.ImageCollection(load_pattern, conserve_memory=True, load_func=None, **load_func_kwargs)
基礎:
object
加載和管理圖像文件的集合。
- load_pattern:str 或 str 列表
要加載的模式字符串或字符串列表。文件名路徑可以是絕對的或相對的。
- conserve_memory:布爾型,可選
如果為 True,
ImageCollection
- load_func:可調用的
imread
默認情況下。請參閱下麵的注釋。
參數:
其他參數:
注意:
請注意,文件始終按字母數字順序返回。另請注意,切片返回一個新的ImageCollection不是對數據的看法。
ImageCollection 可以修改為通過指定以下組合從任意來源加載圖像load_pattern和load_func.對於ImageCollection
ic
,ic[5]
使用load_func(load_pattern[5])
加載圖像。例如,想象一個 ImageCollection 從視頻文件中每隔三幀加載一次:
video_file = 'no_time_for_that_tiny.gif' def vidread_step(f, step): vid = imageio.get_reader(f) seq = [v for v in vid.iter_data()] return seq[::step] ic = ImageCollection(video_file, load_func=vidread_step, step=3) ic # is an ImageCollection object of length 1 because there is 1 file x = ic[0] # calls vidread_step(video_file, step=3) x[5] # is the sixth element of a list of length 8 (24 / 3)
load_func
的另一個用途是將所有圖像轉換為uint8
:def imread_convert(f): return imread(f).astype(np.uint8) ic = ImageCollection('/tmp/*.png', load_func=imread_convert)
例子:
>>> import skimage.io as io >>> from skimage import data_dir
>>> coll = io.ImageCollection(data_dir + '/chess*.png') >>> len(coll) 2 >>> coll[0].shape (200, 200)
>>> ic = io.ImageCollection(['/tmp/work/*.png', '/tmp/other/*.jpg'])
- files:str 列表
如果為load_pattern 給出了模式字符串,則此屬性存儲擴展的文件列表。否則,這等於load_pattern。
屬性:
相關用法
- Python skimage.io.MultiImage用法及代碼示例
- Python skimage.io.use_plugin用法及代碼示例
- Python skimage.io.show用法及代碼示例
- Python skimage.feature.graycomatrix用法及代碼示例
- Python skimage.color.lab2lch用法及代碼示例
- Python skimage.draw.random_shapes用法及代碼示例
- Python skimage.feature.blob_doh用法及代碼示例
- Python skimage.feature.blob_dog用法及代碼示例
- Python skimage.filters.unsharp_mask用法及代碼示例
- Python skimage.registration.optical_flow_tvl1用法及代碼示例
- Python skimage.filters.rank.noise_filter用法及代碼示例
- Python skimage.exposure.histogram用法及代碼示例
- Python skimage.filters.gaussian用法及代碼示例
- Python skimage.feature.graycoprops用法及代碼示例
- Python skimage.segmentation.active_contour用法及代碼示例
- Python skimage.feature.corner_orientations用法及代碼示例
- Python skimage.exposure.adjust_gamma用法及代碼示例
- Python skimage.morphology.h_minima用法及代碼示例
- Python skimage.filters.threshold_otsu用法及代碼示例
- Python skimage.feature.structure_tensor用法及代碼示例
注:本文由純淨天空篩選整理自scikit-image.org大神的英文原創作品 skimage.io.ImageCollection。非經特殊聲明,原始代碼版權歸原作者所有,本譯文未經允許或授權,請勿轉載或複製。