EN: Oz Knowledge Base
Search
K
Links

Checking Liveness and Face Biometry

To check liveness and face biometry, you need to upload media to our system and then analyze them.
To interpret the results of analyses, please refer to Types of Analyses.
Below, you'll see the example of performing a check and its description.
1
let analysisRequest = AnalysisRequestBuilder()
2
// create one or more analyses
3
let analysis = Analysis.init(
4
media: mediaToAnalyze, // mediaToAnalyze is an array of OzMedia that were captured or otherwise created
5
type: .quality, // check the analysis types in iOS methods
6
mode: .serverBased) // or .onDevice if you want the on-device analysis
7
analysisRequest.uploadMedia(mediaToAnalyze)
8
analysisRequest.addAnalysis(analysis)
9
// initiate the analyses
10
analysisRequest.run(
11
statusHandler: { state in }, // scenario steps progress handler
12
errorHandler: { _ in }
13
) { result in
14
// receive and handle analyses results here
15
}
To delete media files after the checks are finished, use the cleanTempDirectory method.

Adding Metadata

To add metadata to a folder, use AnalysisRequest.addFolderMeta.
let analysis = Analysis.init(media: mediaToAnalyze, type: .quality, mode: .serverBased)
var folderMeta: [String: Any] = ["key1": "value1"]
analysisRequest.addFolderMeta(folderMeta)
...

Extracting the Best Shot

In the params field of the Analysis structure, you can pass any additional parameters (key + value), for instance, to extract the best shot on the server side.
let analysis = Analysis.init(media: mediaToAnalyze, type: .quality, mode: .serverBased, params: [“extract_best_shot” : true])

Using Media from Another SDK

To use a media file that is captured with another SDK (not Oz iOS SDK), specify the path to it in the OzMedia structure (the bestShotURL property):
let referenceMedia = OZMedia.init(movement: .selfie,
mediaType: .movement,
metaData: ["meta":"data"],
videoURL: nil,
bestShotURL: imageUrl,
preferredMediaURL: nil,
timestamp: Date())

Adding Media to a Certain Folder

If you want to add your media to the existing folder, use the addFolderId method:
let analysis = Analysis.init(media: mediaToAnalyze, type: .quality, mode: .serverBased)
analysisRequest.addFolderId(IdRequired)