This repository was archived by the owner on Feb 20, 2020. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathmain.sce
More file actions
216 lines (189 loc) · 7.52 KB
/
Copy pathmain.sce
File metadata and controls
216 lines (189 loc) · 7.52 KB
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
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
function[] = main()
// GUI related variables.
global srcImg;
global viewportSrcImg;
global viewportResImg1;
global resImgName1;
global listboxSrcImg;
global mainWin_handle;
global is_eigenface_trained;
global progState;
global analysis_row0;
global analysis_col0;
global analysis_data;
global analysisTable_handle;
// Variables used for Eigenface training images.
global numOfPerson;
global imagesPerPerson;
global numOfFaces;
// Eigenface training images configurations
numOfPerson = 20
imagesPerPerson = 3
numOfFaces = numOfPerson * imagesPerPerson;
// General viewport configurations
img_width = 92;
img_height = 112;
is_eigenface_trained = "false";
// Main window configurations
mainWin_id = 10001;
mainWin_width = 800;
mainWin_height = 500;
mainWin_pos_x = 10;
mainWin_pos_y = 10;
colorbits = 8;
// Main window's source image viewport configurations
viewportSrcImg_width = img_width/mainWin_width;
viewportSrcImg_height = img_height/mainWin_height;
viewportSrcImg_pos_x = 10;
viewportSrcImg_pos_y = 10;
// Main window's result image viewports 1
viewportResImg1_width = img_width/mainWin_width;
viewportResImg1_height = img_height/mainWin_height;
viewportResImg1_pos_x = (mainWin_width/2)+10;
viewportResImg1_pos_y = 10;
// Create Main Window
mainWin_handle = scf(mainWin_id);
mainWin_handle.color_map = graycolormap(2^colorbits);
mainWin_handle.background = 255;
mainWin_handle.figure_position = [mainWin_pos_x mainWin_pos_y];
mainWin_handle.figure_name = gettext("Face Recogntion");
mainWin_handle.axes_size = [mainWin_width, mainWin_height];
// Create Main Window background
mainWin_background = newaxes();
mainWin_background.background = 180;
mainWin_background.margins = [0 0 0 0];
mainWin_background.axes_bounds = [0 0 1 1];
// Create Main Window's source image viewport
viewportSrcImg = newaxes();
viewportSrcImg.background = 128;
viewportSrcImg.margins = [0 0 0 0];
viewportSrcImg.axes_bounds = [...
viewportSrcImg_pos_x/mainWin_width, ...
viewportSrcImg_pos_y/mainWin_height, ...
viewportSrcImg_width, ...
viewportSrcImg_height];
// Create label for source image viewport
uicontrol( "parent", mainWin_handle, ...
"style", "text", ...
"string", "Source Image", ...
"fontsize", 12, ...
"horizontalAlignment", "center", ...
"foreground", [1.0 1.0 1.0], ...
"background", [0.0 0.0 0.0], ...
"position", [10+92 mainWin_height-30 288 20] );
// Create Main Window's result image viewport 1
viewportResImg1 = newaxes();
viewportResImg1.background = 128;
viewportResImg1.margins = [0 0 0 0];
viewportResImg1.axes_bounds = [...
viewportResImg1_pos_x/mainWin_width, ...
viewportResImg1_pos_y/mainWin_height, ...
viewportResImg1_width, ...
viewportResImg1_height];
// Create label for result image viewport 1
uicontrol( "parent", mainWin_handle, ...
"style", "text", ...
"string", "Result", ...
"fontsize", 12, ...
"horizontalAlignment", "center", ...
"foreground", [1.0 1.0 1.0], ...
"background", [0.0 0.0 0.0], ...
"position", [(mainWin_width/2)+102 mainWin_height-30 288 20] );
// Create label for result image name 1
resImgName1 = uicontrol( "parent", mainWin_handle, ...
"style", "text", ...
"string", "Name: ???", ...
"fontsize", 12, ...
"horizontalAlignment", "left", ...
"foreground", [1.0 1.0 1.0], ...
"background", [0.3 0.3 0.3], ...
"position", [(mainWin_width/2)+102 mainWin_height-50 288 20] );
// Prepare a list of src images for the list box
for i=1:1:40
for j=1:1:10
listSrcImg(((i-1)*10)+j) = ...
msprintf("att_faces/orl_faces/s%d/%d.pgm", i, j);
end
end
// Create listbox to choose src image
listboxSrcImg = uicontrol( "parent", mainWin_handle, ...
"style", "listbox", ...
"string", listSrcImg, ...
"value", 1, ...
"position", [10+92 mainWin_height-112-10 288 112-20], ...
"horizontalalignment", "left", ...
"fontsize", 12, ...
"background", [0.9 0.9 0.9], ...
"callback", "loadSrcImg" );
loadSrcImg();
// Create button search
uicontrol( "parent", mainWin_handle, ...
"style", "pushbutton", ...
"position", [290 mainWin_height-122-20 100 20], ...
"string", "Search", ...
"fontSize", 12, ...
"backgroundColor", [1.0 1.0 1.0], ...
"callback", "search_face" );
// Create program state info (Not yet trained / Busy / Idle)
progState = uicontrol( "parent", mainWin_handle, ...
"style", "text", ...
"position", [10 mainWin_height-122-20 280 20], ...
"string", "Program State: Inactive", ...
"horizontalAlignment", "left", ...
"fontsize", 12, ...
"foregroundColor", [1.0 1.0 1.0], ...
"backgroundColor", [0.5 0.5 0.5] );
// System and Eigenface Information label
uicontrol( "parent", mainWin_handle, ...
"style", "text", ...
"foregroundColor", [1.0 1.0 1.0], ...
"backgroundColor", [0.0 0.0 0.0], ...
"string", "System and Eigenface Information", ...
"fontsize", 12, ...
"position", [10 mainWin_height-162-20 mainWin_width-20 20] );
// Prepare System and Eigenface Information data table
sysinfo_row0 = [" " "Info" "Description"];
sysinfo_col0 = ["1";"2";"3";"4"];
sysinfo_data = [ ...
"Technique used" "Eigenface"; ...
"Number of persons" ...
msprintf("%d (S1 until S%d)",numOfPerson,numOfPerson); ...
"Number of face per persons" ...
msprintf("%d (1.pgm until %d.pgm)", ...
imagesPerPerson,imagesPerPerson); ...
"Total number of faces" string(numOfFaces) ...
];
// Create System and Eigenface Information table
sysinfoTable = [sysinfo_row0; [sysinfo_col0 sysinfo_data]];
sysinfoTable_handle = uicontrol( "parent", mainWin_handle, ...
"style", "table", ...
"string", sysinfoTable, ...
"fontsize", 12, ...
"foregroundColor", [1.0 1.0 1.0], ...
"backgroundColor", [0.5 0.5 0.5], ...
"position", [10 mainWin_height-182-100 mainWin_width-20 100] );
// Recognizer Analysis Information label
uicontrol( "parent", mainWin_handle, ...
"style", "text", ...
"foregroundColor", [1.0 1.0 1.0], ...
"backgroundColor", [0.0 0.0 0.0], ...
"string", "Eigenface Recognizer Analysis", ...
"fontsize", 12, ...
"position", [10 mainWin_height-192-20-100 mainWin_width-20 20] );
// Prepare Eigenface Recognizer Analysis data table
analysis_row0 = [" " " "];
analysis_col0 = [" "];
analysis_data = [" "];
// Create Eigenface Recognizer Analysis table
analysisTable = [analysis_row0; [analysis_col0 analysis_data]];
analysisTable_handle = uicontrol( "parent", mainWin_handle, ...
"style", "table", ...
"string", analysisTable, ...
"fontsize", 12, ...
"foregroundColor", [1.0 1.0 1.0], ...
"backgroundColor", [0.5 0.5 0.5], ...
"position", [10 mainWin_height-312-178 mainWin_width-20 178] );
// Set Main Window's status bar message
mainWin_handle.info_message = ...
"Select any source image and press search button";
endfunction