Facial Recognition
  • Blog
  • About Me
  • Resume
  • Code

app description (with screenshots!)

5/11/2015

0 Comments

 
Picture
This is the great looking main screen that opens when the app first opens. The files that are used to operate this screen are the MainActivity.java file which can be found in the directory app > src > main > java > com.example > MainActivity.java along with the activity_main.xml layout file which can be found at app > src > main > res > layout > activity_main.xml. The app also returns to this screen after adding a person to the database or after the user is done with the photo gallery. If you click the Open camera button you are brought to the default camera screen shown below. 
Picture
Picture
The camera is called by using an Intent which means it calls the default camera app as shown on the right. After the camera takes the picture the user is asked to either save or discard. If they discard they are brought back to the camera screen, if they save they are brought to one of two screens shown below. There is no code for the camera because the code is already written in the phone. 
More often than not the user will be brought to this screen. This is the screen where the app guesses who is in the picture. In order for the computer to guess who is in a picture there needs to be data in the database, in other words there needs to be at least one picture in the photo gallery. If there is at least on picture in the database it will bring the user to this page after the new picture is saved. As you can see in the picture on the right, the user is asked if the app was correct at guessing the face. There is also a little thumbnail of the person who the app thinks the user is. In this situation the app is correct, so the user would click the "Yes" button. After the user clicks yes, the data is added to the database and is then sent to the Main screen, or MainActivity.java. However, if the app was wrong in guessing the face the user can click the "No" and are brought to the screen below to enter the name of the person in the picture. The function that is associated with this interface is found in the directory app > src > main > java > com.example > FaceGuess.java and the layout code can be found at app > src > main > res > layout > activity_face_guess.xml. 
Picture
Picture
If there is no data in the database when a picture is taken by the camera the user is immediately sent to this screen. This is the Match Name With Face screen. Another way a user can land on this interface is by clicking the "No" button on the Face Guess page (see above). In this screen the user is asked to type in a name associated with the face in the picture. If the name entered by the user already exists in the database, the user will be prompted if they would like to add to the existing file associated with that name, or if they would like to create a new instance of the person using the same name as shown on the right. The code for this page can be found in app > src > main > java > com.example > matchNameWithFace.java. The layout can be found at app > src > main > res > layout > activity_match_name_with_face.xml. Once the user selects either option on the right or clicks the "Enter" button, the data is then saved to the database and the user is brought back to the Main screen (see above). 
Picture
Picture
This is the photo gallery. It can be accessed only from the Main screen and can only return back to the Main screen using the back arrow in the top left corner of the screen. Here we can see all the data in the database. It displays the thumbnail of the person, the name of the person as entered by the user, and the eye distance of the person in the picture. To the right of this information is a small clickable box that puts a checkmark in it. This allows the user to click on the "Delete Selection" button at the top of the screen. When clicked, all selected data entries are deleted from the database. Be careful however because this action is not undoable. This code can be found in app > src > main > java > com.example > PhotoGallery.java. The photo gallery also uses two xml files, app > src > main > res > layout > activity_photo_gallery.xml as the layout for the interface as well as the app > src > main > res > layout > row_layout.xml as the layout for each row in the list. 
0 Comments

Finished

5/1/2015

0 Comments

 
The project is now finished. Overall I would say that I happy with the amount that I learned throughout the entire project. However, I am honestly a little disappointed that the app did not have a better accuracy in detecting faces. This gives next year seniors something to improve upon my project. I am excited to see if this project is something that will be passed on to future seniors and what they are capable of doing with it. The source code is now available on the page "Code" click on that page and download the source code there. 
0 Comments

a new issue

4/12/2015

0 Comments

 
This last few weeks I have made some good progress, met with Dr. Pankratz as well in to some new issues. I have successfully loaded and saved data to a file, this way the information can be saved for later uses. The data that is savable to a file is the FaceNamePair class I have created. This data contains a name, a photo and the distance between the eyes. When a new photo is taken it finds the closest match of distance between the eyes in the entire database. The problem I have run in to this week is the data I am receiving. The only data I can retrieve using the methods I am using is the distance between the eyes, but in pixels. This is terribly inaccurate because depending on how close or far away the person is from the camera when the picture is taken the distance between the eyes will always be different even for the same person. So I have decided that I need to use a different method to obtain data about the face in the picture. I have done some research this week and discovered that Android has a fairly new camera api called Camera2. There is very little documentation on this and seems to be difficult to figure out currently. However with this api I can retrieve the points of the eyes, the center of the face and the mouth center point. With these points I can create ratios which is a lot more accurate. Another function I would like to create is a way to display the pictures and data in the database, this would allow the user to delete pictures and data from the database. To know how the app will work more clearly I have attached a flowchart of the app below. 
Picture
0 Comments

Its a face!

3/25/2015

0 Comments

 
This week I have made some big progress in the application; I have finally been able to detect whether a face is in the picture. On top of being able to find the face I've been able to determine the distance between the eyes (in pixels) as well as the center point of the face and the confidence level if it's a face or not. All of this data per face is being stored in my FaceNamePair which holds all of this information. The plan from here is to use the midpoint of the face along with the eye positions to find a ratio for a distance between the eyes other than pixels. This is because depending on how close or far away the person is to the camera when the picture is taken, the distance will vary even with the same person. However, if we use a ratio, this distance will be a lot more consistent. I will then be creating a dynamic ArrayList of FaceNamePairs which will hold every face/name pair that was created for each picture taken by the app. Then whenever a new picture is taken, it will find the picture and name with the closest ratio and ask whether this is the person in the new picture. The issue that is currently holding me back is saving this list of FaceNamePairs to a file and being able to read them again. This is used for keeping data per session, otherwise currently all data is wiped as soon as the user exits the app; which obviously makes the app useless. 
0 Comments

Progress walkthrough

3/8/2015

0 Comments

 
I am currently working on getting "accounts" set up so there is a way of matching a name with a face. Here is what I have thus far...
Picture
 Currently this is the home screen, very bland, very boring. The Photo Gallery button currently brings up a blank page. The Open Camera button opens the camera and allows you to only take a picture, you are not allowed to take videos. 

Picture
After taking a photo you are brought to this screen which asks you who is in this picture. The name that is entered here is added to a "Contacts" ArrayList. So currently there is no algorithm that even detects if a face is in the picture.  
Picture
 Here is the "My Files" folder on the phone. This file stores all of the external files that are created by apps. As you can see, when I have the app startup it checks to see if there is a file here named "FaceRecognition" if there isn't (first time starting up) it creates this file. The DCIM folder is the default folder where pictures that are taken from the camera app are stored. By default pictures that are taken in my app are stored int eh DCIM folder. I also have all of the photos being saved in the phones internal memory storage which is not accessible to the users except through my app. The question that I have currently is whether I should make the photos accessible to the user outside of my app. In other words, users could go into the FaceRecognition folder and edit or delete photos and files such as accounts. Should the photos just be stored in the photo gallery? Or should all files be stored internally and accounts and photos can only be edited in the app itself?

0 Comments

quicker Testing!

3/3/2015

0 Comments

 
This week I took a trip to Hawaii with my band, which has delayed major progress on my project. However, Dr. Pankratz has supplied me with an android phone to test my application on. This has greatly improved testing times rather than running the emulator on my computer which is supplied by android studio. Since I am developing on a mac I had to download Android File Transfer in order for Android Studio to recognize that the android device was connected to my computer. I also had to go into the phone settings and enable Developer Mode in order for the phone to be used for testing and debugging. I have been able to save a photo to the phone that was taken from my app, however it is currently being saved to the photo gallery, which, as explained before, is an undesired result. I will continue to look up how to create a file system that is private for my app. 
0 Comments

Time to save

2/17/2015

0 Comments

 
I have decided to use an Intent, which in Android just means I am calling other code. This is how I have decided to call the camera app which is native to the android device. I have created a button that will open the camera. After the picture is taken the user is then asked to keep or discard the photo, if they accept the photo the user is brought to a screen where the picture is displayed. I now need to implement a button that allows the user to save the photo. There are several ways in which I can save the photo. One way to save a photo is using an external memory source such as an SD card. If I choose this path, all of this saved data becomes public information and any app can use it. In other words, the photos I save for my app will be saved to the photo gallery. However, I do not want to be filling the users photo gallery with all of the photos taken for my app. Instead, I am going to use the devices internal memory. This memory slot holds all of the data only for my app. This is great for several reasons. The saved photos will not be saved to the photo gallery which will be nice for the user. Also, when the app is deleted all of the photos and data associated with the app is also deleted, so the user doesn't have to do that themselves. This means I will have to create some kind of a photo gallery inside my app so the user can see all of the photos. I first have to figure out how the filing system works and how to even save and load one picture. This is my next task.
0 Comments

Hello world!

2/9/2015

0 Comments

 
This week I made some advancements as far as planning and design goes. I have given up on getting Eclipse to work with Android's ADT and have decided to use Android Studio as my IDE. I found it's actually fairly simple to run and understand. After an hour of playing around I got a nice button to display on the screen and when pressed a "Hello World!" textbox appears. Now that I know how and where to place the code it was time to do some researching. Dr. Pankratz supplied me with a link about facial recognition which seemed interesting. However, before I dive into that, I would like to check out Androids API for facial recognition. In their camera class they have a facial detection function. This holds information about a face: center of the left eye, center of the right eye, center of the mouth, and boarder of the face. I think with this information given to us by the android camera I can create some kind of algorithm (or find one) that can give me some type of score or percentage of accuracy. 

Moving forward here is what I am planning for this app. By accessing the contacts in the phone (asking for permission first by the user) we can simply add a name to a face. Every time a picture is taken with the app it will try and match a name with a face, even if its only 10% or less sure. The user can either choose that name or type in a new name, which either creates a new account in the database or adds the information to an existing one. 

I do have some questions that I need to figure out. In order to access the camera I can either access the native camera app that comes on all Android devices. This would be a lot easier to accomplish and require less code. However, I lose out on experience and knowledge of accessing the camera driver as well as customization for my app. If I chose to just call the camera drivers myself, this will require more code however I will understand more clearly what is happening. Also, not all of the functionalities of the camera are needed for this app, such as camera filters (ie: to make the photos black and white). I am also debating whether I should keep all of the photos of each person in a database within the app that the user can access. In other words, should the user be able to see all of the photos taken of a certain person? The alternative would be to just keep the data about the persons face in the database. By keeping the pictures in the database, this will require much more memory, however the user can then go into the database and edit it, in case a mistake was made when entering in a name. By just having face data in the database, this requires less memory but we also lose out on functionality. I am still far away from this point, but it's something to keep in mind as I'm making progress...any thoughts?
0 Comments

Getting started

2/2/2015

0 Comments

 
This is my first blog entry...nothing too special here. I am just figuring out how to post this site on to the server as well as doing some research on my project. I have been figuring out the specifics of how I am going to approach this project. I have decided to try and use Eclipse as my IDE that uses Android App Developer Toolkit plugin to run an emulated Android device on my computer. I have yet to find a good algorithm that deals with facial recognition. The plan from here is try and find a good algorithm and see if I can make that work on its own. Then, make a simple application on an Android device. Finally, I would put the algorithm in the application and finally have a Facial Recognition App for Android. 
0 Comments

    garrett moody

    This is my blog about my capstone project.

    Archives

    May 2015
    April 2015
    March 2015
    February 2015

    Categories

    All

    RSS Feed

Create a free web site with Weebly