Showcase Demo sample project
This sample application demonstrates:
- Facial features tracking of multiple faces from camera, images and videos
- Age, gender and emotion estimation
Currently, tracking is limited to 4 faces, although this can be modified.
Pre-built Android application is located in the bin folder. Full source code of this sample is located in Samples/Android/ShowcaseDemo.
Using the sample application
To try Showcase Demo application, you need to transfer and install application on your Android device. First, connect your phone as a storage device and transfer the apk file onto SD card. Then, use file explorer on the Android device to locate and install the sample application. If you are not able to install the application, the following steps might be required (depending on your Android version):
- In security settings of your device, go to Install unknown apps, select the app which is used as file explorer and enable Allow from this source
- In security settings of your device, enable Unknown sources
- Go to Play Store -> Play Protect end disable option Scan device for security threats
After the installation is finished you can run the application on the device.
Application automatically starts tracking and analysing face from camera frame. You can switch between front and back camera by choosing middle button from the top toolbar. The rightmost button allows the user to select an image or video from the device to be used as the source.
By pressing menu icon, you can choose which output from face analyser and face tracker will be displayed.
Building the sample project
ShowcaseDemo sample project is located in the ShowcaseDemo subfolder of the visage|SDK for Android folder.
Prerequisites for building and running the sample project are:
- Java JDK (version 17 or higher)
- Android Studio 2025
- Android SDK 33 (minimum API level 23)
- Android NDK (r28)
- Android device with Android 6.0 or higher
Sample applications were built and tested using:
- Java JDK version 17
- Android Studio 2025.1.2
- Android SDK 33 (minimum API level 23)
- Android NDK (r28)
- Android Gradle Plugin 8.5.2
- Android Gradle 8.7
- Android device with Android 16.0
- Android device with Android 12.0
Implementation overview
The visage|SDK API is written in C++. Since development on Android is done in Java, this sample uses AndroidWrapper C++ class that exposes Java methods for using tracking and face analysis API, while the implementation of those methods is done in C++.
The AndroidWrapper C++ class connects with GUI and
implements actions that call tracking and face analysis methods.
The specific classes and methods that demonstrate visage|SDK are:
C++:
-
AndroidWrapper: Provides an Java interface to main tracker and face analysis functions.
-
AndroidImageCapture: Used for passing one raw image to the tracker.
-
AndroidStreamCapture: Used for passing input from Android camera to the tracker.
-
AndroidCapture: Used as an interface for obtaining image data from different sources (camera, video, image).
-
VisageRendering: Contains methods that use OpenGL to do all the necessary rendering (displaying tracking and face analysis results).
Java:
-
MainActivity: Android activity that starts when sample application is launched.
-
VisageWrapper: Java wrapper used to wrap JNI methods from AndroidWrapper.
-
Camera2Fragment: Android fragment that is attached to MainActivity when tracking from camera is active.
-
ImageFragment: Android fragment that is attached to MainActivity when tracking from image is active.
-
TrackerView: Base class used for defining surface and rendering functions required for displaying tracking and face analysis results.