# API Reference

### setActivation

{% code overflow="wrap" %}

```swift
+(int)setActivation:(NSString*)license;
```

{% endcode %}

<table data-header-hidden><thead><tr><th width="137"></th><th></th></tr></thead><tbody><tr><td><strong>Name</strong></td><td>setActivation</td></tr><tr><td><strong>Description</strong></td><td>Activate SDK</td></tr><tr><td><strong>Input</strong></td><td><ul><li><strong>license</strong> (NSString*): The license string</li></ul></td></tr><tr><td><strong>Output</strong></td><td><p>The SDK activation status code.</p><ul><li>0: Success</li><li>Non-zero: Activation failed</li></ul></td></tr></tbody></table>

### initSDK

{% code overflow="wrap" %}

```swift
+(int)initSDK;
```

{% endcode %}

<table data-header-hidden><thead><tr><th width="137"></th><th></th></tr></thead><tbody><tr><td><strong>Name</strong></td><td>initSDK</td></tr><tr><td><strong>Description</strong></td><td>Initiate SDK</td></tr><tr><td><strong>Input</strong></td><td>None</td></tr><tr><td><strong>Output</strong></td><td><p>The SDK initialization status code.</p><ul><li>0: Success</li><li>-1: License Key Error</li><li>-2: License AppID Error</li><li>-3: License Expired</li><li>-4: Activate Error</li><li>-5: Initialize SDK Error</li></ul></td></tr></tbody></table>

### faceDetection

{% code overflow="wrap" %}

```swift
+(NSMutableArray*)faceDetection:(UIImage*)image;
```

{% endcode %}

<table data-header-hidden><thead><tr><th width="137"></th><th></th></tr></thead><tbody><tr><td><strong>Name</strong></td><td>faceDetection</td></tr><tr><td><strong>Description</strong></td><td>Detect Face</td></tr><tr><td><strong>Input</strong></td><td><ul><li><strong>image</strong> (UIImage*): The input image</li></ul></td></tr><tr><td><strong>Output</strong></td><td>An array of <a href="/pages/acYCwClH0Eh3auberFsG#facebox"><strong>FaceBox</strong></a> objects representing the detected faces.</td></tr></tbody></table>

#### FaceBox

{% code overflow="wrap" %}

```swift
@interface FaceBox : NSObject

@property (nonatomic) int x1;
@property (nonatomic) int y1;
@property (nonatomic) int x2;
@property (nonatomic) int y2;
@property (nonatomic) float liveness;
@property (nonatomic) float yaw;
@property (nonatomic) float roll;
@property (nonatomic) float pitch;
@end
```

{% endcode %}

The liveness score ranges from 0.0 to 1.0\
**Default Liveness Threshold is 0.7**

### templateExtraction

{% code overflow="wrap" %}

```swift
+(NSData*)templateExtraction:(UIImage*)image faceBox:(FaceBox*)faceBox;
```

{% endcode %}

<table data-header-hidden><thead><tr><th width="137"></th><th></th></tr></thead><tbody><tr><td><strong>Name</strong></td><td>templateExtraction</td></tr><tr><td><strong>Description</strong></td><td>Extract face feature</td></tr><tr><td><strong>Input</strong></td><td><ul><li><strong>image</strong> (UIImage*): The input image</li><li><strong>faceBox</strong> (<a href="#facebox"><strong>FaceBox</strong></a><strong>*</strong>): The bounding box of the detected face</li></ul></td></tr><tr><td><strong>Output</strong></td><td>A NSData representing the extracted template from the face</td></tr></tbody></table>

### similarityCalculation

{% code overflow="wrap" %}

```swift
+(float)similarityCalculation:(NSData*)templates1 templates2:(NSData*)templates2;
```

{% endcode %}

<table data-header-hidden><thead><tr><th width="137"></th><th></th></tr></thead><tbody><tr><td><strong>Name</strong></td><td>similarityCalculation</td></tr><tr><td><strong>Description</strong></td><td>Calculate similarity between two face features</td></tr><tr><td><strong>Input</strong></td><td><ul><li><strong>templates1</strong> (NSData*): The first face template</li><li><strong>templates2</strong> (NSData*): The second face template</li></ul></td></tr><tr><td><strong>Output</strong></td><td>A float value representing the similarity score between the two face templates<br>The score ranges from 0.0 to 1.0<br><strong>Default Threshold is 0.8</strong></td></tr></tbody></table>


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.recognito.vision/face-recognition-sdk/integration-guide/ios/api-reference.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
