-
Notifications
You must be signed in to change notification settings - Fork 0
Graphical User Interface
This page describes the C++ components of the GUI and the important use cases. The GUI were made with the Qt Creator application with the Design sub component.
In the software there are three windows which will pop up in different situations.
The GUI components for the application can be described in an *.ui file. The syntax of this file is XML. Ui files should not be edited with a text editor, instead with Qt Creator or Qt Design. The latter can be found both as a standalone application or in the Qt Creator -> Design tab.
During the build process all of the *.ui files are compiled to C++ code, which can be reached via a header file. The name of the header file is the same as the *.ui file, but with a ui_ prefix and .h extension.
A MainWindow class object is instantiated in the main.cpp, so if the user starts the application it immediately shows this window. The constructor of the class builds up the GUI elements with the generated C++ code.
The MainWindow class is responsible for handling the attached camera. In every second the MainWindow::UpdateCameraImage() method is called 33 times. This procedure captures the image of the camera, and then executes the preprocessing step on it (Preprocessing of the images). If the preprocessing was successful then the processed image is shown on the window by setting the pixmap attribute of a QLabel.
Also on the MainWindow layout there are some buttons and a File menu. With the help of these GUI elements the user can create and load databases, and can identify the currently captured face. Also on the layout there is a button named Freeze image, which stops the capturing of the images of the camera, so all of the instructions are performed on this image.
There is support for creating database from previously captured images saved as JPEG files, or from the image of the camera. In both cases first a face recognizer has to be applied. This can be achieved via File -> Select face recognizer which pops up a FaceRecognizerSelectorWidget window.
Clicking on the Add to database plan button, the image is stored in the database with the given name, which can be set with a QLineEdit component next to the previously mentioned button. Multiple images can be assigned to the same name. After the user added all of the required names and images to the database plan, clicking on the Create database button a file selector window will pop up, where the user can choose the name and the location of the files, which will be created. Any existing files with the same names will be overwritten.
Clicking on the File -> Create database button an other window (DatabaseCreator) will pop up. This window was implemented similarly as the MainWindow, so it consists of a databasecreator.h, databasecreator.cpp and a databasecreator.ui file. An object from the class is instantiated in the MainWindow class, but is hidden until the user activates the previously mentioned File -> Create database menu item.
On the DatabaseCreator window, the user can choose a folder by clicking on the Browse button in the row of the Database directory: label. The user can manually type the location of the directory, but it is more convenient to use the former solution. The location of the directory can be given by relative or absolute path. The saved file name and location can be given similarly with the Browse button next to the Save file: label.
Clicking on the Create button the application will find all of the files from the selected directory, which are in the format firstname-lastname-number.jpg. This format can be described with the Qt regular expression: (\w+_\w+_\d+.jpg), so the file names contain the first and last name and a number of the person. After loading the images the software will train the selected face recognizer and save the created database.
To load a previously saved database the correct face recognizer (the same method with the same settings which were used during training) has to be selected.
Clicking on the File -> Load database menu item a file selector window will pop up. With this the DatabaseName.facedb file has to be selected. It is assumed that a DatabaseName.facedb.nlabels file also exists according to File format. If both files exist then the application trains the currently selected face recognizer and load the names and IDs.
For identification a database have to be created or loaded. This assumes that a face recognizer is selected as well.
The user can identify a person by using an image file or the image of the camera. The former can be achieved by clicking on the Identify from image and the latter by clicking on the Identify from camera button. For the first one a browser window will pop up, and the user can select an existing JPEG file. For the second one the software uses the last captured image of the camera.
In both cases the best match found is written under the image of the camera. Along the name also the confidence level is printed. The latter is a number which describes how sure the software is about the chosen person. A lower number means more confidence.
By clicking on the File -> Select face recognizer menu item a FaceRecognizerSelectorWidget window will pop up. This class is similar to the DatabaseCreator, it is instantiated in the MainWindow and also uses .h, .cpp and .ui files.
On this widget the OpenCV face recognizer can be selected then applied. Selecting a face recognizer changes the layout of the widget through a QStackedWidget. This is necessary, because the different face recognizers have different parameters which have to be set. In our application only one face recognizer is applied, which is stored in the FaceRecognizerContainer singleton class.
- Eigen Face Recognizer
- Fisher Face Recognizer
- LBPH (Circular Local Binary Pattern Histogram) Face Recognizer
- In the DatabaseCreator widget the progress bar next to the Feedback label is not used. It could be an improvement to provide some feedback to the user during the process of the training.
- The DatabaseName.facedb.nlabels file should contain the settings of the face recognizer which were used during the training of the database. This information could be used during the database loading process.