Facial Recognition

This page contains both the download for the presentation and the code used within our facial recognition program, along with some images of the code. Along with a statement about the program from the person who coded the program himself, Kyle Vickman

The program for our project was written by me (Kyle Vickman) in C#, and it uses the Haar Cascades object recognition algorithm to recognize faces. The program then uses its own mini “database” in the form of a file folder, to take pictures of, and assign names to faces allowing it to not only recognize a face, but also pair a name to it. In order to accomplish all of this, our program utilizes libraries from OpenCV, which is used for real time computer-vision that was made by Intel. These libraries are used to detect and recognize faces in my program using Haar Cascades. Seeing as OpenCV functions were made for C++, I used a wrapper program known as EmguCV, which can port the libraries and functions of OpenCV into .NET compatible languages like C#. I also used a baseline program from Sergio Andrés Gutiérrez Rojas from CodeProject, along with a commonly used grayscale algorithm from the savior of programmers itself, StackOverflow. As for the program’s functionality, I created a Windows Forms application using Visual Studio to act as the GUI for the program. This application is able to scan faces into the database directly by using the camera, or it can upload images right into it from your computer by modifying them to fit the program’s standards. Uploaded or scanned images will always be 100x100 pixels, and will be in grayscale (done using the aforementioned algorithm). When images are scanned in or uploaded in, they are sent to a specific folder and given a numerical name starting with “face” followed by some integer numFacesDec + 1, which represents the total number of faces in the database upon the time of the upload plus the new face we are uploading. The names assigned to each face, along with the total number of faces, is stored in a text file called TrainedLabels.txt. The program is able to obtain and update the information in this file using File I/O functions along with hexadecimal to decimal conversion for integers. When you combine it all together, you get a sweet program able to recognize and detect faces! Some things to keep in mind regarding the program, is that uploaded images tend not to fare as well as though scanned directly by the program, as those images are a face, and only a face, while uploaded images may contain background content that interferes with recognition. Trimming a face out of an image, was unfortunately beyond my capabilities being a C# novice. The program also may misrecognize faces and label it with the wrong name at times. This is normal however, and is how the algorithm works. The more copies and images of a face it has to compare, the higher the accuracy the program will have.

Upload Button Code

Browse Button Code

Add Button Code