Move the sources to trunk
[opencv] / docs / appPage / FaceRecognition / FaceRecognition.htm
1 <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN">\r
2 <html><head>\r
3 <link rel="STYLESHEET" href="opencvref.css" charset="ISO-8859-1" type="text/css">\r
4 <title>HMM Face Recognition Tool</title>\r
5 </head><body>\r
6 \r
7 <CENTER><TABLE CELLSPACING=0 CELLPADDING=5 WIDTH="90%" BGCOLOR="#6A9BED" NOSAVE >\r
8 <TR NOSAVE>\r
9   <TD NOSAVE>\r
10     <CENTER><I><FONT COLOR="#000000"><FONT SIZE=+4>Face Recognition Tool</FONT></FONT></I></CENTER>\r
11   </TD>\r
12 </TR>\r
13   </TABLE></CENTER>\r
14 \r
15 \r
16 <P>This face recognition tool gives the computer the ability to\r
17   recognize a face from image files (BMP format) or directly from an USB\r
18 camera. The system requirements for this application are a Pentium&reg\r
19   processor-based computer and Microsoft* Windows* NT 4.0, 98, or 2000.  The face\r
20   recognition uses <a href="../../ref/OpenCVRef_ObjectRecognition.htm#ch5_hmm">OpenCV code</a>\r
21   for embedded hidden Markov model. The approach is described\r
22   in <a href="../../papers/avbpa99.ps">"Face recognition using an embedded HMM"</A> paper.\r
23 \r
24 <h1>1. Navigation</h1>\r
25 \r
26 <h2>Main Window</h2>\r
27 \r
28 <p>At startup, application tries to locate USB camera.\r
29 If succeeded the main application window will appear:</p>\r
30 <p><img src="image003.jpg"></a></p>\r
31 <p>There are two panes or views - camera view on the right and\r
32 face database on the left. Initially, no database is loaded.</p>\r
33 \r
34 <h2>Toolbar elements.</h2>\r
35 \r
36 Most of the actions are done by pressing toolbar buttons, namely:\r
37 \r
38 <p><img src = "image005.png" align = "left"> - create new face database. Current base will be saved to disk.</a></p>\r
39 <p><img src = "image007.png" align = "left"> - open face database (stored in txt file) or open BMP file.</a></p>\r
40 <p><img src = "image009.png" align = "left"> - specify current face database parameters.</a></p>\r
41 <p><img src = "image011.png" align = "left"> - add face into face database.</a></p>\r
42 <p><img src = "image013.png" align = "left"> - delete face from database.</a></p>\r
43 <p><img src = "image015.png" align = "left"> - zoom face database images.</a></p>\r
44 <p><img src = "image017.png" align = "left"> - decimate face database images.</a></p>\r
45 <p><img src = "image019.png" align = "left"> - pause/resume camera capture.</a></p>\r
46 <p><img src = "image021.png" align = "left"> - specify camera resolution.</a></p>\r
47 <p><img src = "image023.png" align = "left"> - adjust video quality parameters.</a></p>\r
48 <p><img src = "image025.png" align = "left"> - select whole image in Camera view.</a></p>\r
49 <p><img src = "image027.png" align = "left"> - train HMM(s).</a></p>\r
50 <p><img src = "image029.png" align = "left"> - recognize face, selected in camera view.</a></p>\r
51 <p><img src = "image031.png" align = "left"> - delete all HMM information for face base.</a></p>\r
52 <p><img src = "image033.png" align = "left"> - about HMMDemo.</a></p>\r
53 \r
54 <h2>Camera View.</h2>\r
55 \r
56 <p>Initially camera view contents picture from camera.\r
57 Button <img src="image019.png"></a> pauses/resumes capture.</p>\r
58 <p>User can specify rectangular image region on camera view\r
59 using mouse (please begin selecting region from top left corner and finish at\r
60 right bottom corner to avoid crashes).\r
61 Whole image can be selected by <img src="image025.png"></a> button.</a></p>\r
62 <p>Selected rectangular region can be added into database using\r
63 <img src="image011.png"></a> button or recognized using\r
64 <img src="image029.png"></a> button.</p>\r
65 <p>Camera view can also content image from BMP file. BMP file\r
66 can be opened by <img src="image007.png"> button.</p>\r
67 \r
68 <h2>Database View.</h2>\r
69 \r
70 <p>When face database is opened \93Database view\94 contents images from this base.\r
71 Base view can be stated in 2 modes: \93all mode\94 and \93person mode\94.</p>\r
72 <p>In \93all mode\94, for every person, stored in database, only one picture is shown.\r
73 This situation is shown below.</p>\r
74 <p><img src="image040.jpg"></a></p>\r
75 <p>\r
76 <p>In \93person mode\94 all faces of one person are shown.\r
77 This is depicted below.</p>\r
78 <p><img src="image042.jpg"></a></p>\r
79 \r
80 <p>\r
81 <em>How to switch between \93all mode\94 and \93person mode?</em>\r
82 <ul>\r
83 <li>To switch from \93all mode\94 to \93person mode\94 double click on image of person you are interested.\r
84 <li>To switch from \93person mode\94 to \93all mode\94 double click on free (not image) space of base view.\r
85 </ul>\r
86 </p>\r
87 \r
88 <h1>2. Creating face base.</h1>\r
89 At startup, application creates empty database.\r
90 By default, new base is placed in <em>untitled_base.txt</em> file.\r
91 To specify new database file press <img src="image009.png"></a> button\r
92 and fill fields of following dialog</p>\r
93 <p align="center"><img src="image046.png"></a></p>\r
94 \r
95 <p>Type filename and some signature in specified fields.</p>\r
96 <p>Now you can add faces into base.</p>\r
97 <p>Select region with new face and press <img src = "image011.png"</a> button.</p>\r
98 \r
99 <p>If \93base view\94 is in \93person mode\94, face will be added to person feces list.</p>\r
100 \r
101 <p>If \93base view\94 in \93all mode\94 you can be asked to specify person name.\r
102 You can choose name from list of existing names\r
103 (in this case image will join corresponding person images)\r
104 or type new name (in this case new person with specified name will be created)</p>\r
105 \r
106 <p>You can always delete any image or any person from base.\r
107 For this purposes click on image or person you want to delete and press\r
108 <img src = "image013.png"></a> button.</p>\r
109 \r
110 <p>When you perform add/delete operations, database saves automatically all your changes.</p>\r
111 \r
112 <h1>3. Training/Recognition.</h2>\r
113 \r
114 <p>When you've collected several persons and several photos present each one,\r
115 you can train HMMs of every person. You can do it both in \93all mode\94 and \93person mode\94.</p>\r
116 \r
117 <p>To train HMMs of all persons switch to \93all mode\94 and press\r
118 <img src = "image027.png"></a> button.\r
119 All untrained HMMs will be trained (clock-cursor will be shown during training process).</p>\r
120 \r
121 <p>To train HMM of concrete person switch to \93person mode\94 and  press\r
122 <img src = "image027.png"></a> button.\r
123 HMM of the current person will be trained and the changing segmentation of the first image\r
124 of the person will be rendered.</p>\r
125 \r
126 <p>Note, than you add/delete person images, corresponding HMM becomes untrained,\r
127 and after all changes user must retrain all untrained HMMs.</p>\r
128 \r
129 <p>If all HMMs are trained you can try to recognize somebody. To do this\r
130 <ol>\r
131 <li>Select face region in \93camera view\94 (from camera of BMP file)\r
132 <li>Press  <img src = "image029.png"></a> button.\r
133 </ol>\r
134 \r
135 <p>Result of recognition will appear as message box with 3 person names.\r
136 First name will correspond to most similar person etc. \93Database view\94 will be switched into\r
137 \93all mode\94 and most similar person will be highlighted with magenta rectangle.</p>\r
138 <p><img src="image053.jpg"></a></p>\r
139 \r
140 \r
141 <h1>4. Batch recognition.</h1>\r
142 \r
143 <p>To demonstrate recognition rate of eHMM technique the batch recognition was implemented in HMMDemo.</p>\r
144 <p>For batch recognition you must have 2 face bases: one as training base and other\r
145 as base for recognition. Both bases must be \93personally\94 equal,\r
146 i.e. base for recognition must consist of persons,\r
147 which present in training base (true matching is made by names).</p>\r
148 <p>\r
149 Here is scenario of batch recognition.\r
150 <ol>\r
151 <li>Create first face base in usual way. Save it.\r
152 <li>Create second base, which consists of people from first base (names must be equal in both bases), using another images. Save it.\r
153 <li>Load first base and train it.\r
154 <li>Go menu item \93Options->Recognize another base\94. You will be prompted to define .txt file, which is file of base you want recognize. Choose the base and recognition starts.\r
155 <li>Recognition can take much time with large base. Be patient during cursor is \93clock\94. In the end of recognition massage box will appear. It will report how many images were processed and successfully recognized.\r
156 </ol>\r
157 \r
158 \r
159 <h1>5. HMMDemo settings</h1>\r
160 \r
161 <p>There are several types of settings in HMMDemo concerning use of HMMs.<br>\r
162 To obtain settings property sheet go to Options->Settings item of menu.</p>\r
163 \r
164 <p>Presently we have the following types of parameters.</p>\r
165 \r
166 <p>1) Sampling parameters</p>\r
167 <p><img src="image055.png"></a></p>\r
168 \r
169 <p>2) HMM parameters</p>\r
170 <p><img src="image057.png"></a></p>\r
171 <p>Number of checked checkboxes = number of superstates of HMM.<br>\r
172 Value in editbox near checkbox is number of states within corresponding superstate.<br>\r
173 All internal states of HMM have the same number of component of Gaussian mixture (here 3)</p>\r
174 \r
175 <p>3) Other parameters</o>\r
176 <p><img src="image059.png"></a></p>\r
177 <p>In HMM face recognition it is important that face images must have not very different sizes.\r
178 So we must scale images, when we train or recognize.\r
179 Above dialog allows to specify what scaling will be used.\r
180 <ul>\r
181 <li>If \93Width\94 box is checked and \93Height\94 is not checked, then all images will be scaled to have specified width, height of every image will be scaled proportionally.\r
182 <li>If \93Height\94 box is checked and \93Width\94 is not checked, then all images will be scaled to have specified height, width of every image will be scaled proportionally.\r
183 <li>If \93Width\94 box is checked and \93Height\94 is checked, then all images will be scaled to have specified width and specified height.\r
184 </ul>\r
185 \93Suppress intensity\94 flag allows not considering lowest DCT coefficient. This can help in case of different illumination conditions in training images and tested image.\r
186 \r
187 \r
188 <h1>6. Working with settings.</h1>\r
189 <ol>\r
190 <li>When you start/exit application, it loads/stores settings from/into windows registry.\r
191 <li>Every time you train base or recognize person settings,\r
192     which are displayed in property pages, are used.\r
193 <li>If any person of facebase was trained and you save facebase \96 configuration file,\r
194     which stores all settings, are saved.\r
195 <li>If the name of facebase file is \93Base.txt\94, then config file will have \93BaseCFG.txt\94   name.\r
196 <li>If there are no trained persons in the base \96 config file will not be created.\r
197 <li>When you load facebase from file and there is corresp.\r
198     Config file, then settings from this file will be loaded.\r
199 <li>If you have facebase loaded into application and you changes any parameters from property pages\r
200     (HMM topology or sampling params) all (trained?) information will be removed.\r
201     And you must train HMMs again.\r
202 </ol>\r
203 <p>Also you can store and load settings to/from any other config file.</p>\r
204 <p>Use \93File->Save config file\94 and \93File->Load config file\94 for these purposes.</p>\r
205 <p>Every time you change settings via property pages or loading config file\r
206    and these new settings differs from you had before \96 all training information (hmms) are cleared.</p>\r
207 \r
208 </body>\r
209 </html>\r
210 \r