Skip to main content
Version: 3.14.0

Swift Sample

Swift Video Recognition Demo#

The sample demonstrates tracking, detection and identification of faces from the database on the video stream from the camera. Also, gender, age and main emotion are determined for tracked faces.

Software requirements#

  • XCode >= 10
  • iOS-device with iOS >= 12

Run the sample#

  1. To run the Swift Sample, download and extract archive iOS ARM 64-bit with the latest Face SDK distributive.
  2. Place the license file 3divi_face_sdk.lic to the directory license.
  3. Copy folders facerec.framework and swift_api from the directory ios_arm_64 to root directory of Face SDK.
  4. Open the project file examples/swift/video_recognition_demo/video_recognition_demo.xcodeproj in the XCode.
  5. Open the project settings. In the "Build Settings" tab, go to the "Signing" section. Select the value of the "Development Team" parameter.
  6. To build and run the application, click the "Run" button .

Note: face detection and identification are performed only when the device is in vertical (portrait) orientation.

After launching the application a preview from the front camera of the device is displayed on the device screen. A red circle is displayed around the detected faces. Information about the age, gender and dominant emotion of the person is displayed inside the circle.

Face detection

To identify a person, add a person's face to the database. To add a face to the database, enter the person's name in the text box at the bottom of the screen and click the "Add to database" button.
Note: you can add a face to the database only when there is one person in front of the camera.

If the person is identified, then the circle color changes from red to green, and the name from the database is displayed.

Face identification

Last updated on