iOS Integration

Overview

The Face Capture SDK comes with a Swift interface for iOS integration. This chapter will outline the requirements for iOS integration, how to operate the included developer demo, and which parts of the demo source code correspond to the integration tasks outlined in the Application Design chapter.

Integration Requirements

The Face Capture SDK requires Camera permissions.

Demo Operation

The Face Capture SDK comes with a small developer demo that is intended to show how various options work. The demo allows developers to rapidly test various combinations of settings to determine what they need to adjust to meet their own application’s requirements. The demo is not intended to resemble a finished product and provides the user with many options that should not be accessible to an end-user in a production environment. Source code for the demo is provided within the SDK installer package.

Home Screen

alternate text

Home Screen

Settings Screen

alternate text

Settings Screen

Capture Screen

alternate text

Capture Screen

Result Screen

alternate text

Result Screen

Demo Code

This section provides details regarding the Face Capture API and how it is used to implement an application.

Create a Face Capture Object

Create a Face Capture Object
   let faceCapture = FaceCapture()

Create a Workflow Object

Create a Workflow Object
   try self.workflow = faceCapture.workflowCreate(workflowName: selectedWorkflow)

Adjust Workflow Settings

Adjust Workflow Settings
   try self.workflow?.setPropertyString(property: .USERNAME, value: username)
   try self.workflow?.setPropertyDouble(property: .CAPTURE_TIMEOUT, value: captureTimeout)
   try self.workflow?.setPropertyString(property: .CAPTURE_PROFILE, value: captureProfile)

Select a Camera

Select a camera
   self.cameraList = try faceCapture.getCameraList(
       position: FaceCapture.CameraPosition.fromString(term: selectedCameraPosition))
   self.selectedCamera = self.cameraList[0]
   try self.selectedCamera?.setOrientation(
       orientation: FaceCapture.CameraOrientation.fromString(term: selectedCameraOrientation))

Begin a Capture Session

Begin a Capture Session
   try faceCapture.startCaptureSession(workflowHandle: workflow, cameraHandle: camera)

Stop a Capture Session

Stop a Capture Session
   try faceCapture.stopCaptureSession()

Get the capture region

Get capture region
   self.currentCaptureRegion = try faceCapture.captureSessionGetCaptureRegion()

Handle Capture Session State

Capture Session State
   self.currentState = try faceCapture.getCaptureSessionState()

Handle Capture Session Images

Capture Session Images
   self.currentFrame = try self.currentState?.getFrame()

Handle Capture Session Feedback

Capture Session Feedback
   self.currentFeedback = try self.currentState?.getFeedback()

Handle Capture Session Status Changes

Capture Session Status Changes
   self.currentStatus = try self.currentState?.getStatus()

Get the Server Package

Get the Server Package
   self.currentCaptureServerPackage = try faceCapture.getServerPackage(
       workflowHandle: workflow,
       packageType: FaceCapture.PackageType.fromString(term: selectedPackageType))

Get the Encrypted Server Package

Get the Encrypted Server Package
   self.currentCaptureServerPackage = try faceCapture.getEncryptedServerPackage(
       encryptionType: FaceCapture.EncryptionType.fromString(encryptionType),
       encryptionKey: encryptionKey,
       workflowHandle: workflow,
       packageType: FaceCapture.PackageType.fromString(term: selectedPackageType))

Enable Autocapture

Enable Autocapture
   try faceCapture.captureSessionEnableAutocapture(true);