-
Notifications
You must be signed in to change notification settings - Fork 1
/
read_images.m
41 lines (34 loc) · 992 Bytes
/
read_images.m
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
31
32
33
34
35
36
37
38
39
40
41
%function [X width height] = read_images(path_fn)
function X = read_images(path_fn)
% get files for a given path
folder = list_files(path_fn);
% initialize the empty return values
X=[];
%width=0;
%height=0;
% for each file...
for i=1:length(folder)
subject = folder{i};
% ... get files in this subdir
images = list_files([path_fn, filesep, subject]);
% ... ignore a file or empty folder
if(length(images) == 0)
continue;
end
% ... for each image
for j=1:length(images)
% ... get the absolute path
filename = [path_fn, filesep, subject, filesep, images{j}];
% ... read the image
%T = double(imread(filename));
T = imread(filename);
% ... get the image information
%[height width] = size(T);
X(:,:,10*(i-1)+j) = T;
% ... append the corresponding class to the class vector
end
end % ... for-each folder.
end
%a = X(:,:,1);
%a = uint8(a);
%imshow(a)