Face Detect Demo sample project

The Face Detect Demo sample project demonstrates facial features detection and face recognition based on the VisageSDK::FacialFeaturesDetector and VisageSDK::VisageFaceRecognition classes.
Full source code of this sample is located in Samples/Android/FaceDetectDemo.

The application needs to be rebuilt with license key in order to work properly. More information on how to obtain license key and include it in the application can be found in Licensing section of the documentation.

Using the sample application

To start the application a transfer and installation of the application on an Android device must be done first. To do this use Windows Explorer to drag the Visage Face Detect Demo APK file from bin folder in visage|SDK for Android root folder on to your phone's SD card (which will show as a drive on the PC). Use file explorer application on Android device to locate transferred APK file and run the installation. If you are not able to install the application, the following steps might be required (depending on your Android version):

After the installation is finished you can run the application on the device.

The application displays two buttons: Detect and Match Faces. Detect button loads an image from the device gallery. If any features were detected, they are drawn on the loaded image and shown on the screen. Match Faces button loads an image bundled with the sample application and performs face recognition on it. As a result, the name of the recognized person (or the name of the person with the most similar face found in the VisageFaceRecognition gallery) will be drawn on the loaded image and shown on the screen. Sample images are provided in assets/trackerdata folder.

Building and running the project

The FaceDetectDemo sample project is located in the Samples/Android/DetectorDemo sub-folder of the visage|SDK for Android folder.

Prerequisites for building and running the sample project are:

Sample applications were built and tested using:

Project is opened by choosing "Open an existing Android Studio project" after running Android Studio. Sample is located in "visageSDK-Android/Samples/Android". After that the following steps are necessary:

  1. Select the "Project" tab on the left and open file local.properties under Gradle Scripts
  2. To compile the native code, go to Build -> Make Project
  3. Now the application can be built by pressing the run button and choosing your Android device

Implementation overview

The visage|SDK API is written in C++ and since development on Android is done in Java, an interface between them must be implemented. In this sample project this is done through C++ classes that expose Java methods for using the detector and recognizer, while the implementation of those methods is done in C++.

The specific classes and methods that demonstrate visage|SDK are: