Face recognition in mobile app development
Artificial intelligence, machine learning, bright future and proofs of conspiracy theory - how can all this be combined in one sentence or thought, in a way that makes sense? The correct answer is when referring to the development of a mobile application for face recognition. Today, this technology finds a lot of applications not only in the field of security (for example, searching for criminals on video from surveillance cameras in real time, or the recognition of airline passengers), but also in everyday life. Another example includes searching for people from photos on Facebook, grouping images in Google Photos, unlocking smartphones "with a face," etc. Though this operation requires huge computing power and was originally priced high to keep up with this need (midsize businesses and startups сould likely not afford to use it when it was first conceived), now such functionality is affordable and available to everyone. Creating a custom face recognition app for Android is no longer a problem from a cost or functional perspective.
What is face recognition?
The problem of identifying a person's face for subsequent identification analysis has been a challenge for researchers working in the field of artificial intelligence, machine learning and computer vision. Nevertheless, for a long time, even a large number of studies conducted globally did not lead to the creation of real fast-processing systems capable of detecting and recognizing a person under different lighting conditions or positions relative to the angle of survey. Therefore, unlike other means of personal biometric identification, the technology of human face recognition has long been waiting in the sidelines, until about the time that a new method developed by Paul Viola and Michael Jones was introduced in 2001.
This algorithm produces excellent recognition and speed performance indicators and also provides low false-detection rates at an angle of less than 30 degrees. If images have larger angles, the percentage of the correct response is critically reduced. Thus, measurements of the face and/or use of the algorithm becomes impossible.
How it works
For people, facial recognition (as well as recognition of any other objects) is an innate ability, which can not be said about machines - or at least not until recently, even though the relevant technology has been around for more than 50 years. For a machine, this is a problem that requires a certain solution algorithm, so we will assume that face recognition is a sequence of problems that the machine will have to solve:
- The first problem is the analysis of the image for the presence of the face.
- The next step is to highlight the unique features of the person that can be used to compare the test image from the reference image. After all, each person is unique, which means that everyone has a unique voice, fingerprints and facial features - in this case called a faceprint. Absolutely every person has their own distinctive landmarks, nodal points, and various peaks, for example: the width of a person's nose, the shape and height of cheekbones, the length and shape of jaws, distance between the eyes and, of course, the depth of eye sockets.
- The last point is the detailed comparison of the resulting image with the one from the application’s database.
Of course, science does not stand still and, in 2005, another more advanced method, the "Histograms of Oriented Gradients for Human Detection (HOG)," was discovered. This method calculates gradient in each selected pixel and, depending on the direction of the particular gradient, writes the value to the histogram. In general, HOG looks like a very long vector of values, each of which is the value of a certain histogram cell.
Why do pixels need to be replaced with gradients? If only a pixel is analyzed directly, then photos of one person will likely differ (one from another) because of the different type and intensity of light and the number of pixels. On the other hand, if only a gradient and its directions are analyzed, then the images of the person obtained from different photos will almost be identical.
Next, the image is divided into square areas, the number of gradient arrows in the main directions is counted, and the selected area is replaced by an arrow with the predominant direction of the gradient.
How to create a mobile app for face recognition
To build a face recognition mobile app nowadays, the biggest decision is which approach to use, which, in turn, depends on the project size and final cost. When choosing a mobile platform, it is worth paying close attention to the features of a camera for each platform and the possibility to access and interact with it. For today's popular operating systems, you can find open source examples of algorithms and services for face recognition, as well as native and third-party options. The differences are:
Native APIs - both for Android and iOS, these interfaces were created for their ease of use and fast integration. These APIs are quite limited in functionality, but will help in decreasing the final cost of face recognition mobile app development. Besides, Apple and Google are constantly evolving their operations systems, so this will probably be improved in the near future.
Third Party Options - use third-party services like Microsoft Azure’s Face API, Amazon Rekognition and KeyLemon Face Recognition API, or even Cloud Vision API to build hybrid applications. Often, such services are paid, but they have great functionality and are able to recognize not only faces but also emotions and much more. Let's take a look at the example of Cloud Vision API which includes features like:
- Recognition of specific features and special points on the face;
- The service can help to recognize different objects on the image and sort them by certain parameters: for example, an image with animals (up to the definition of a species), a portrait, a macro, etc.;
- Detection of unacceptable content in its different manifestations;
- Text recognition;
- Determine the location of the subject by photo; and
- Detecting symbols, logos, and icons.
OpenCV (Open Source Computer Vision Library) - is an open source library of various algorithms for computer vision, image processing and numerical algorithms of general purpose. It was created specifically for the introduction and standardization of the general interface of computer vision, as well as for popularizing and increasing the number of applications in this field and the invention of new models of use. It’s free, but hard to integrate within mobile applications (e.g. for android face detection app development) and also requires extensive knowledge or solid grounding.
Face recognition apps
If you want to create custom solutions, it would be great to know what the market brings to the field today. Here are the top five popular face recognition apps for mobile platforms:
This program will help you get rid of the need to remember passwords for your favorite sites or help you get convenient access to applications or data on your smartphone. Intel True Key is a kind of password manager which allows you to save all credentials for services that you use and access them later in a faster way. For example, with face recognition or fingerprint scan. Moreover, the application allows logging in with the help of trusted devices.
The principle of the application is quite simple - it remembers the passwords you entered and, when necessary, allows you to login to the site, for example, by recognizing your face without having to enter credentials manually. Thus, you don't need to remember the data for each individual site every time you want to enter it.
Face Recognition (Sokrush)
Face recognition programs can not only protect your data but also entertain you and your friends or colleagues. Face recognition from Sokrush is a face recognition app for android, designed to help you understand a person’s mood. To do this, you need to photograph the person of interest and the application will try to analyze the mood based on the person’s image.
Developers are positioning this application mainly for entertainment purposes, with ae disclaimer that you should not take the received results too seriously. In reality, the program works really well. It is based on an algorithm that allows for the recognition of facial expressions and human emotions with a fairly high accuracy. In the end, as we can see, applications of this type can not only be "serious" but also "fun."
The FindFace app has another interesting feature. Recognizing faces, this program offers people search capabilities in social networks through a photo that you can take anywhere - on the street, cafe or on the way to work. This can be useful, for example, for people who want to meet someone, but are afraid to do. Using this application, you can unnoticeably take a picture of a person, find their profile on the network and send a friend request directly to them. Another scenario of use is the search for criminals with the help of surveillance cameras, which gives law enforcement a great advantage, allowing them to take preventive measures (what the police are already doing in the application’s test mode).
Face Detection Lock Screen
This program is aimed at protecting your confidential information inside a smartphone or tablet. This application grants access to the device or internal applications only in cases of successful recognition of your face. It is worth noting that the function of adding a password is also present - this is done for the sake of even greater security and convenience of work. For example, in the case of a false (defective) recognition or impossibility of recognizing the owner of the device, the person will be asked to enter the previously set password, ensuring that the device is fully secure.
Facevault is a face recognition app for iphone and iPad, which allows users to unlock iOS devices, providing a different level of comfort and security. After installing the application and registering your face, you no longer have to swipe the screen or enter a password to unlock the device. Now it's enough to just look at the phone, as the application uses its front camera for detection. As with the previous product, if it is not possible to fully identify the person who is trying to unlock the device, the user will be prompted to enter a special code.
Face recognition technology is starting to work successfully alongside fingerprint detection technology, and is almost on par with the same. By increasing the level of protection of your personal data and devices, these technologies and applications can offer a fairly wide range of use. As mentioned above, face recognition technology can be used for entertainment and even to provide security on the street, subway or in stadiums. The development of third-party services from large companies allows us to draw the likely conclusion that this technology will be popular for a long time to come.