Anura Core SDK for iOS

Anura Core SDK for iOS provides all the essential components for integrating NuraLogix Affective AI and DeepAffex into your iOS application. It includes DeepAffex Extraction Library, a DeepAffex Cloud API client, a camera control module, a face tracker, and other components to allow your application to take measurements using DeepAffex. This is the same SDK used to build Anura Lite by NuraLogix.

Requirements

The latest version of the Anura Core SDK for iOS is 1.9.2. It requires Apple iOS 13.0 or higher. For a detailed list of requirements, please refer to the platform requirements chapter.

Setup

Accessing Anura Core SDK and Sample App

Please contact NuraLogix to get access to the private Git repository.

Dependencies

  1. Run pod install under the root folder of the sample project. If you start your own project, please configure your podfile accordingly.

  2. Anura Core SDK for iOS frameworks are included in ./Frameworks. They are already configured in sample project's target Build Settings. If you start your own project, please configure the frameworks in your project's target Build Settings.

Using the Core SDK

DeepAffex License Key and Study ID

Before your application can connect to DeepAffex Cloud API, you will need a valid DeepAffex license key and Study ID, which can be found on DeepAffex Dashboard.

The included Sample App sets the DeepAffex license key and Study ID in Config.swift file, which would get included in the application at build time.

AnuraMeasurementViewController

Anura Core SDK for iOS provides a AnuraMeasurementViewController class that integrates the various components of the SDK, from fetching camera video frames all the way through rendering the video in the UI. It also provides delegate methods to observe the measurement state and lifecycle.

Measurement UI Customization

The exact measurement UI from the Anura App is available in AnuraMeasurementViewController (including stars, beating heart etc.) You can programmatically show or hide any element on the screen through MeasurementUIConfiguration. If you want to create your own UI, can you use MeasurementUIConfiguration to hide all the default UI elements and implement your own UI and place them on top of the camera view.

@objc @objcMembers public class MeasurementUIConfiguration : NSObject {
    
    ......
    
    @objc public var showHeartRateDuringMeasurement: Bool
    @objc public var showHistograms: Bool
    @objc public var showStatusMessages: Bool
    @objc public var showMeasurementStartedMessage: Bool
    @objc public var showCountdown: Bool
    @objc public var showOverlay: Bool
    @objc public var showMeasurementOutline: Bool
    @objc public var showLightingQualityStars: Bool
    @objc public var showFacePolygons: Bool
    
    
    ......
}

And you can also customize the font and color of some elements according to your needs:

static var exampleCustomTheme : MeasurementUIConfiguration {

    ......

    // Customize Fonts
    uiConfig.statusMessagesFont = UIFont(name: "AmericanTypewriter", size: 25)!
    uiConfig.countdownFont = UIFont(name: "AmericanTypewriter", size: 80)!
    uiConfig.heartRateFont = UIFont(name: "AmericanTypewriter-Bold", size: 30)!
    uiConfig.timerFont = UIFont(name: "AmericanTypewriter-Bold", size: 10)!
    
    // Customize Colors
    let greenColor = UIColor(red: 0, green: 0.77, blue: 0.42, alpha: 1.0)
    let darkMagentaColor = UIColor(red: 0.77, green: 0, blue: 0.35, alpha: 1.0)
    uiConfig.overlayBackgroundColor = UIColor(red: 0.2, green: 0, blue: 0.09, alpha: 0.75)
    uiConfig.measurementOutlineInactiveColor = .darkGray
    uiConfig.measurementOutlineActiveColor = darkMagentaColor
    uiConfig.heartRateShapeColor = greenColor
    uiConfig.lightingQualityStarsActiveColor = darkMagentaColor
    uiConfig.lightingQualityStarsInactiveColor = .darkGray
    uiConfig.statusMessagesTextColor = .white
    uiConfig.statusMessagesTextShadowColor = .black
    uiConfig.timerTextColor = .white
    uiConfig.heartRateTextColor = .white
    uiConfig.heartRateTextShadowColor = .black
    uiConfig.histogramActiveColor = greenColor
    uiConfig.histogramInactiveColor = darkMagentaColor
    
    ......

}

You can refer to MeasurementUIConfiguration+CustomTheme file for an example

A screenshot of the default measurement UI is shown below:

Anura iOS Measurement UI