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.
Building and running the project
The Showcase Demo sample project is located in the ShowcaseDemo subfolder of the visage|SDK for iOS folder.
Prerequisites to running the sample project are:
- Xcode (version 14.0+)
- iOS device (iPhone 5s / iPad 5 or newer)
The project is opened in Xcode by double-clicking on the ShowcaseDemo.xcodeproj project file. To run the project an iOS device must first be attached to the computer and selected as the build target. The project sample application can then be run by choosing the Run option in Xcode.
Using the sample application
The sample application consists of a toolbar with three buttons (from left to right): options panel, camera switch button, and load image/video button.
In the options panel it is possible to toggle the display of various face tracking information: feature points, splines, gaze tracking, axes and wireframe, as well as enable or disable face analysis features (age, gender and emotion estimation).
The middle button switches between the front and rear device camera. By default, the application will track from the frontal camera.
The rightmost button allows the user to select an image or video from the device to be used as the source.
Building the sample project
ShowcaseDemo sample project is located in the ShowcaseDemo subfolder of the visage| SDK for iOS folder.
Prerequisites for building and running the sample project are:
- Apple MacOS 13.0
- Apple iPhone 5s or higher
- Xcode (version 14.0+)
Sample applications were built and tested using:
- Xcode version 14.1
- Apple iPhone 11
NOTE: Without a valid license the application will not work. The application is available on demand via TestFlight. For more information please contact your sales representative.
Implementation overview
The visage|SDK API is written in C++ and since development on iOS is done in Objective-C a special way of interfacing the two must be employed. In this sample project this is done through TrackerWrapper Objective-C class that exposes Objective-C methods for using the tracker, while the implementation of those methods is done in Objective-C++, a combination of Objective-C and C++.
The ViewController C++ class connects with GUI and
implements actions that call start and stop the tracker and display the tracking results using CustomGLView object.
The specific classes and methods that demonstrate visage|SDK are:
Other important classes are:
-
AppDelegate: Implements the app delegate.
-
ViewController: Implements default view controller and application GUI. This class calls methods that are implemented in TrackerWrapper class.
-
CustomGLView: Implements OpenGL ES view for results display.
-
Informer: Class used for displaying tracking information to the user.
-
AnalyserInformer: Displays analyser results.
-
VisageRendering: Displays the current frame and the following tracking results using OpenGL.
More details about each class are available in documentation for specific class.
Users are free to modify the sample project to test the functionalities of the Visage tracker.
The sample project also serves as a starting point when creating new projects that will use visage|SDK.
Configuration selection
TrackerWrapper.mm contains the code for device-specific selection of tracking configuration, ensuring optimal tracking performance on different devices by taking into account their performance, camera and screen characteristics. Please read more details about configuration selection in the section Device-specific configuration selection.