-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmakeMat.m
More file actions
47 lines (33 loc) · 766 Bytes
/
makeMat.m
File metadata and controls
47 lines (33 loc) · 766 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
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
clc;clear all
randn('state',1); rand('state',1);
true_pwd = pwd;
crpy = 'CroppedYale/';
dir_path = strcat(pwd, '/', crpy, crpy);
cd(dir_path)
% sz1 = 480; sz2 = 640;
tic
dirs = dir;
progressbar('progress')
a = zeros(192, 0, 168);
b = zeros(192, 30, 168);
ii = 1;
for j = 3:size(dirs,1)
progressbar(j / size(dirs,1))
fold = dirs(j).name;
cd(strcat(dir_path, fold))
lst = dir('*.pgm');
for i = 1:min(size(lst,1), 30)
q1 = getpgmraw(lst(i).name) / 255; % faster
% a(:,ii,:) = q1;
% ii = ii + 1;
b(:,i,:) = q1;
% q1 = imread(lst(i).name); % slower
end
a(:,ii:ii+30-1,:) = b;
ii = ii + 30;
cd(dir_path)
end
progressbar(1)
toc
cd(true_pwd)
save('yaleB.mat', 'a');