-
Notifications
You must be signed in to change notification settings - Fork 8
Expand file tree
/
Copy pathImageIterator.m
More file actions
30 lines (27 loc) · 852 Bytes
/
Copy pathImageIterator.m
File metadata and controls
30 lines (27 loc) · 852 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
classdef ImageIterator < FileIterator
%ImageIterator Conveniently loop through files.
% Pass in a relative directory and a glob, and return an iterator
% that returns the relative path of all the images.
%
% Example:
%
% folder = 'my/images/are/here';
% glob = '*.tif';
% imgs = ImageIterator(folder, glob);
% while(imgs.more())
% img = imgs.next();
% end
methods
function obj = ImageIterator(folder, glob)
obj = obj@FileIterator(folder, glob);
end
function img = next(self)
if ~self.more()
img = [];
else
img = imread(self.filenames{self.current});
self.current = self.current + 1;
end
end
end
end