posts - 112, comments - 215, trackbacks - 0, articles - 34
  IT博客 :: 首页 :: 新随笔 :: 联系 :: 聚合  :: 管理

Face Recognition Tool

Posted on 2006-12-25 10:00 济公 阅读(1078) 评论(0)  编辑 收藏 引用 所属分类: ImageProc

This face recognition tool gives the computer the ability to recognize a face from image files (BMP format) or directly from an USB camera. The system requirements for this application are a Pentium® processor-based computer and Microsoft* Windows* NT 4.0, 98, or 2000. The face recognition uses OpenCV code for embedded hidden Markov model. The approach is described in "Face recognition using an embedded HMM" paper.

1. Navigation

Main Window

At startup, application tries to locate USB camera. If succeeded the main application window will appear:

There are two panes or views - camera view on the right and face database on the left. Initially, no database is loaded.

Toolbar elements.

Most of the actions are done by pressing toolbar buttons, namely:

- create new face database. Current base will be saved to disk.

- open face database (stored in txt file) or open BMP file.

- specify current face database parameters.

- add face into face database.

- delete face from database.

- zoom face database images.

- decimate face database images.

- pause/resume camera capture.

- specify camera resolution.

- adjust video quality parameters.

- select whole image in Camera view.

- train HMM(s).

- recognize face, selected in camera view.

- delete all HMM information for face base.

- about HMMDemo.

Camera View.

Initially camera view contents picture from camera. Button pauses/resumes capture.

User can specify rectangular image region on camera view using mouse (please begin selecting region from top left corner and finish at right bottom corner to avoid crashes). Whole image can be selected by button.

Selected rectangular region can be added into database using button or recognized using button.

Camera view can also content image from BMP file. BMP file can be opened by button.

Database View.

When face database is opened 揇atabase view?contents images from this base. Base view can be stated in 2 modes: 揳ll mode?and 損erson mode?

In 揳ll mode? for every person, stored in database, only one picture is shown. This situation is shown below.

In 損erson mode?all faces of one person are shown. This is depicted below.

How to switch between 揳ll mode?and 損erson mode?

  • To switch from 揳ll mode?to 損erson mode?double click on image of person you are interested.
  • To switch from 損erson mode?to 揳ll mode?double click on free (not image) space of base view.

2. Creating face base.

At startup, application creates empty database. By default, new base is placed in untitled_base.txt file. To specify new database file press button and fill fields of following dialog

 

Type filename and some signature in specified fields.

Now you can add faces into base.

Select region with new face and press < a> button.

If 揵ase view?is in 損erson mode? face will be added to person feces list.

If 揵ase view?in 揳ll mode?you can be asked to specify person name. You can choose name from list of existing names (in this case image will join corresponding person images) or type new name (in this case new person with specified name will be created)

You can always delete any image or any person from base. For this purposes click on image or person you want to delete and press button.

When you perform add/delete operations, database saves automatically all your changes.

3. Training/Recognition.

When you've collected several persons and several photos present each one, you can train HMMs of every person. You can do it both in 揳ll mode?and 損erson mode?

To train HMMs of all persons switch to 揳ll mode?and press button. All untrained HMMs will be trained (clock-cursor will be shown during training process).

To train HMM of concrete person switch to 損erson mode?and press button. HMM of the current person will be trained and the changing segmentation of the first image of the person will be rendered.

Note, than you add/delete person images, corresponding HMM becomes untrained, and after all changes user must retrain all untrained HMMs.

If all HMMs are trained you can try to recognize somebody. To do this

  1. Select face region in 揷amera view?(from camera of BMP file)
  2. Press button.

Result of recognition will appear as message box with 3 person names. First name will correspond to most similar person etc. 揇atabase view?will be switched into 揳ll mode?and most similar person will be highlighted with magenta rectangle.

4. Batch recognition.

To demonstrate recognition rate of eHMM technique the batch recognition was implemented in HMMDemo.

For batch recognition you must have 2 face bases: one as training base and other as base for recognition. Both bases must be 損ersonally?equal, i.e. base for recognition must consist of persons, which present in training base (true matching is made by names).

Here is scenario of batch recognition.

  1. Create first face base in usual way. Save it.
  2. Create second base, which consists of people from first base (names must be equal in both bases), using another images. Save it.
  3. Load first base and train it.
  4. Go menu item 揙ptions->Recognize another base? You will be prompted to define .txt file, which is file of base you want recognize. Choose the base and recognition starts.
  5. Recognition can take much time with large base. Be patient during cursor is 揷lock? In the end of recognition massage box will appear. It will report how many images were processed and successfully recognized.

5. HMMDemo settings

There are several types of settings in HMMDemo concerning use of HMMs.
To obtain settings property sheet go to Options->Settings item of menu.

Presently we have the following types of parameters.

1) Sampling parameters

2) HMM parameters

Number of checked checkboxes = number of superstates of HMM.
Value in editbox near checkbox is number of states within corresponding superstate.
All internal states of HMM have the same number of component of Gaussian mixture (here 3)

3) Other parameters

In HMM face recognition it is important that face images must have not very different sizes. So we must scale images, when we train or recognize. Above dialog allows to specify what scaling will be used.

  • If 揥idth?box is checked and 揌eight?is not checked, then all images will be scaled to have specified width, height of every image will be scaled proportionally.
  • If 揌eight?box is checked and 揥idth?is not checked, then all images will be scaled to have specified height, width of every image will be scaled proportionally.
  • If 揥idth?box is checked and 揌eight?is checked, then all images will be scaled to have specified width and specified height.
揝uppress intensity?flag allows not considering lowest DCT coefficient. This can help in case of different illumination conditions in training images and tested image.

6. Working with settings.

  1. When you start/exit application, it loads/stores settings from/into windows registry.
  2. Every time you train base or recognize person settings, which are displayed in property pages, are used.
  3. If any person of facebase was trained and you save facebase ?configuration file, which stores all settings, are saved.
  4. If the name of facebase file is 揃ase.txt? then config file will have 揃aseCFG.txt? name.
  5. If there are no trained persons in the base ?config file will not be created.
  6. When you load facebase from file and there is corresp. Config file, then settings from this file will be loaded.
  7. If you have facebase loaded into application and you changes any parameters from property pages (HMM topology or sampling params) all (trained?) information will be removed. And you must train HMMs again.

Also you can store and load settings to/from any other config file.

只有注册用户登录后才能发表评论。