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 릴리스 호환 정보
플랫폼 호환성
Windows macOS Linux카테고리
태그
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!