-
Notifications
You must be signed in to change notification settings - Fork 1
/
load_fl.m
79 lines (53 loc) · 1.55 KB
/
load_fl.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
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
%function [F_Dir, F_Num, F_Name_Data] = load_fl(FL_Path, FL_Fn)
function [FL_DATA] = load_fl(FL_Path, FL_Fn)
% Load the facial image file name
%
%
FL_DATA.F_Dir = '';
FL_DATA.Operator = '';
FL_DATA.Ver = 0;
FL_DATA.F_Num = 0;
FL_DATA.F_Name_Data = {};
if (strcmp(FL_Path,'.'))
disp(FL_Path);
end
%fprintf('Open file : %s\n', FL_Fn);
FileName = fullfile(FL_Path, FL_Fn);
if exist(FileName, 'file')
fid = fopen(FileName,'rt');
end
i = 0;
while (feof(fid) == 0)
tline = fgetl(fid);
d = size(tline);
if (tline(1) == '#')
p = findstr(tline, '=');
if (strcmp(tline(2:p-1),'name'))
%disp(tline(p-1:d(2)));
elseif (strcmp(tline(2:p-1),'dir'))
%disp(tline(p-1:d(2)));
FL_DATA.F_Dir = tline(p+1:d(2));
%FL_DATA.F_Dir = FL_Path;
elseif (strcmp(tline(2:p-1),'operator'))
%disp(tline(p-1:d(2)));
FL_DATA.Operator = tline(p+1:d(2));
elseif (strcmp(tline(2:p-1),'num'))
%disp(tline(p-1:d(2)));
FL_DATA.F_Num = str2num(tline(p+1:d(2)));
elseif (strcmp(tline(2:p-1),'ver'))
%disp(tline(p-1:d(2)));
FL_DATA.Ver = str2num(tline(p+1:d(2)));
end
elseif (tline(1) == '@')
%disp(tline(2:d(2)));
i = i + 1;
FL_DATA.F_Name_Data{i} = tline(2:d(2));
end
end
fclose(fid);
if (i ~= FL_DATA.F_Num)
disp('Error : the num is incorrect!');
end
%disp(F_Dir);
%disp(F_Num);
%disp(F_Name_Data);