readAllImages

版本 1.1.0.0 (5.0 KB) 作者: Phil
Reads all the images in a given directory
128.0 次下载
更新时间 2015/3/9

查看许可证

A simple class that iterates through a given directory and loads all the images. You can either iterate through the images with the getNext() function or load all the images into a cell array with the getAll() function.
obj=readAllImages(DIRNAME) constructs an object to read all images in
the directory DIRNAME. Use it with the getNext method or the
getAll methods to either iterate through the directory and return a
single image at a time, or return all the images within the directory
into a cell array. Multiple directories can be read if DIRNAME is a
cell array of directory names.

The list of extensions used to search for images is contained in the
extName property. This can be overridden either by directly modifying
the property or via the class constructor options.
Setting property returnTypeDouble to true forces all images to be of
type double and over the range 0 to 1.

An example use

%finds the Matlab directory with the the demo images
pth = fileparts(which('cameraman.tif'));
%use the default constructor
ra=readAllImages(pth);
%cycle through all images
while 1
img=ra.getNext();
if isempty(img)
%getNext returns [] when there are no more images.
break;
end
imshow(img)
pause(1)
end

引用格式

Phil (2024). readAllImages (https://www.mathworks.com/matlabcentral/fileexchange/49891-readallimages), MATLAB Central File Exchange. 检索来源 .

MATLAB 版本兼容性
创建方式 R2014b
兼容任何版本
平台兼容性
Windows macOS Linux
类别
Help CenterMATLAB Answers 中查找有关 Search Path 的更多信息

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!
版本 已发布 发行说明
1.1.0.0

Updated documentation, added support for multiple directories.

1.0.0.0