Android Application for Face Recognition (Computer Project)

Get this Project:

Fields with * are mandatory


This report presents all the processes I use to program an android application of face recognition. At the beginning, I used the android API, after a long study of the android litterature, to make this application. Because of devices problem, I had to forsake this option, and I used the OpenCV librairy, a librairy create for image processing.

Use this librairy was really hard, because it is a complex one, but the OpenCV litterature on internet permit me to master its utilization. After that, I thought with my tutors that it could be more interesting to make my own face detection librairy. Now, I arrive to had six specific features on each face. Those six parameters permit us to make the difference between two faces. I will describe all my work in this report.


Introduction to the Programming Languages

Figure 1.1: The Java logo.

Figure 1.1: The Java logo.

The Java language was created in 1995 by James Gosling and Patrick Naughton, Sun Microsystems employees. This is the language we have used on this project. Java can work on all the operating system. Its motto : “write once, run anywhere”. That is why Java became one of the most popular programming language during the ten last years.

Figure 1.2: The PHP logo.

Figure 1.2: The PHP logo.

PHP:Hypertext Preprocessor, or PHP, is a web programming language using to create web dynamic pages. It only works on server side. Indeed, a HTTP server is needed to interpret PHP synthax for after creating a full web page understandable by any web browser.

Introduction to the Work Environment

Figure 2.1: Bugdroid, the green Android logo.

Figure 2.1: Bugdroid, the green Android logo.

For this project, we had to create an application for mobile phone. In- deed, mobile can be easily put anywhere. It was one of our goals : install as easily as possible our application in a hospital. We have chosen to use the android platform. Nowadays, 56.1% of mobile phones work on android operating system.

Mathematical Theories

Figure 3.2: the cosinus law on a face.

Figure 3.2: the cosinus law on a face.

This two equations will be useful for us to compute three distances on the face : the distance between the two eyes, the distance from mouth to left eye and the distance from mouth to right eye. After we will compute also the value of the three angles of the triangle formed by the three lenghts.

The Methodology

During my project, I always realised my tasks in 5 steps. First, I had to make research on the internet to know how the technologies and how the programming languages work. The targets of my research were tutorials explaining the rules about the librairies I used. I used only internet because all the informations for computer sicence can be find on the net. However, I had to take care about the informations I found. Many tutorials were useless and unsuitable for my problems.


Creation of a Basic Camera Application

At the beginning I had to create a basic application using the front Cam- era of a mobile phone. To create this application, there are two important classes that I needed to use : Camera and CameraPreview. Camera is a class of the android API. It permit us to set all the parameters of the cam- era device, and make action like take pictures.

Face Recognition with the Google API

With my two supervisors we decided first to use classes of the android API to make our application of Face Recognition. Indeed, Google decided to add to his API two important classes for our project :

  • FaceDetectionListener, that permits to compute the position of the two eyes and of the mouth together with a rectangle that represents the bound of the face. This class works with the API level 14.
  • FaceDetector, who permits to compute the distance between the two eyes and the mid-point between the eyes. This class works with the API level 1.

All the code I will show you in this chapter is simplified. I made it in order to have a chapter easily understandable. The real code is available in the appendix.

Face Recognition with the OpenCV Librairy.

The OpenCV librairy contains an android API. So it was possible for me to create an new application of face recognition using this librairy, entirely in Java.

I created an application that detected faces with OpenCV. But results of that application are only rectangles who contain the face. No important features, like the eyes or the mouth is detected with this method. So it was useless to use this librairy. However, you can see the code of this application in the appendix.

The Aarhus Face Recognition Algorithm.

Figure 8.1: Sample of our face detection algorithm.

Figure 8.1: Sample of our face detection algorithm.

When the picture is taken by the camera, we automatically transform it in a greyscale picture. After that, our idea is to run through the picture, pixel by pixel, to see if a pixel has a di erent grey then the pixel before. If it is, we detected the face, or one of the features of the face, like eyes or mouth.

The Database

Figure 9.1: The table faceRecognition.

Figure 9.1: The table faceRecognition.

To compare two faces, I had to store all the important informations about the detected faces in a database. My supervisors and me created a database that containt one table (faceRecognition) on the Aarhus university network in order to store 7 informations : the id of the face, three ratios and three angle values.

Debate About the Results.

My librairy permit to obtain six important features of a face. Six is a good numbers, because that allow the database to have an in nit of di erent faces. In more, the three distances we have after the recognition, are nor- maly unique for each faces, so the angles also.


The aim of my project for the Aarhus university was to create an application for face recognition. At the beginning we decided to work on existing classes or librairies, in particular the android classes and the OpenCV librairy. The devices we have can’t support programs using the android classes. As for OpenCV, use that librairy, even if it is really optimized, was not possible, because we have no ideas about the extremely complex algorithms behind the used funtions.

So we decided to create an new algorithm for the face recognition. After a big work on the way the colors are representing in computer science (especially the grey), I created my algorithm. The goal of this algorithm is to run throught a picture to test each pixels. If a pixel is different than the pixel before, that means the algorithm detected a new feature on the face. That permit to obtain six different distances and the three angles of the triangle formed by that three distances. Those distances are stored in a database to compare two faces in a second time.

However, some factors can give random results : the luminosity and the “pixels noise”. Futur improvements on this project have to be done in order to x the two problems. Maybe it could be interesting to study the HSV color encoding format, because this format permit to have an influence on the lightness of each pixels. It could be great to find a way to remove all the “pixels noise”.

Source: Aarhus Universitet
Authors: Kévin Letupe

Download Project

Get this Project:

Fields with * are mandatory

Leave a Comment

Your email address will not be published. Required fields are marked *