# API Reference

### get\_version

```python
def get_version() -> str:
```

<table data-header-hidden><thead><tr><th width="136"></th><th></th></tr></thead><tbody><tr><td><strong>Name</strong></td><td>get_version</td></tr><tr><td><strong>Description</strong></td><td>Retrieves the SDK version information from a library.</td></tr><tr><td><strong>Input</strong></td><td>None</td></tr><tr><td><strong>Output</strong></td><td>The version string is returned as a standard Python string.</td></tr></tbody></table>

### get\_device\_id <a href="#get_device_id" id="get_device_id"></a>

```python
def get_device_id() -> str:
```

<table data-header-hidden><thead><tr><th width="136"></th><th></th></tr></thead><tbody><tr><td><strong>Name</strong></td><td>get_device_id</td></tr><tr><td><strong>Description</strong></td><td>Retrieves the Hardware ID from a library.</td></tr><tr><td><strong>Input</strong></td><td>None</td></tr><tr><td><strong>Output</strong></td><td>The Hardware ID is returned as a standard Python string.</td></tr></tbody></table>

### init\_sdk

{% code overflow="wrap" %}

```python
def init_sdk(dict_path: str, online_key: str) -> int:
```

{% endcode %}

<table data-header-hidden><thead><tr><th width="137"></th><th></th></tr></thead><tbody><tr><td><strong>Name</strong></td><td>init_sdk</td></tr><tr><td><strong>Description</strong></td><td>Initializes the SDK in online mode.</td></tr><tr><td><strong>Input</strong></td><td><ul><li><strong>dict_path</strong> (str): Path to the engine binary files directory</li><li><strong>online_key</strong> (str): Online key string </li></ul></td></tr><tr><td><strong>Output</strong></td><td><p>Status code indicating the result of the initialization.</p><ul><li>0: Success</li><li>Non-zero: Initialization failed</li></ul></td></tr></tbody></table>

### init\_sdk\_offline

{% code overflow="wrap" %}

```python
def init_sdk_offline(dict_path: str, offline_key_path: str) -> int:
```

{% endcode %}

<table data-header-hidden><thead><tr><th width="137"></th><th></th></tr></thead><tbody><tr><td><strong>Name</strong></td><td>init_sdk_offline</td></tr><tr><td><strong>Description</strong></td><td>Initializes the SDK in offline mode.</td></tr><tr><td><strong>Input</strong></td><td><ul><li><strong>dict_path</strong> (str): Path to the engine binary files directory</li><li><strong>offline_key</strong> (str): Path to the offline license key file</li></ul></td></tr><tr><td><strong>Output</strong></td><td><p>Status code indicating the result of the initialization.</p><ul><li>0: Success</li><li>Non-zero: Initialization failed</li></ul></td></tr></tbody></table>

### extract\_template

{% code overflow="wrap" %}

```python
def extract_template(image: np.ndarray, width: int, height: int, face_bbox: np.ndarray, template: np.ndarray, template_len: np.ndarray) -> int:
```

{% endcode %}

<table data-header-hidden><thead><tr><th width="137"></th><th></th></tr></thead><tbody><tr><td><strong>Name</strong></td><td>extract_template</td></tr><tr><td><strong>Description</strong></td><td>Extracts a template from an image</td></tr><tr><td><strong>Input</strong></td><td><ul><li><strong>image</strong> (numpy.ndarray): Input image matrix</li><li><strong>width</strong> (int): Width of the input image</li><li><strong>height</strong> (int): Height of the input image</li><li><strong>face_bbox</strong> (numpy.ndarray): Face bounding box coordinates. Extracted face bbox will be stored</li><li><strong>template</strong> (numpy.ndarray): Template buffer. Extracted template will be stored</li><li><strong>template_len</strong> (numpy.ndarray): Length of the extracted template</li></ul></td></tr><tr><td><strong>Output</strong></td><td><p>Status code indicating the result of the template extraction.</p><ul><li>>0: Success</li><li>0: No Face</li><li>-1: SDK Activation Error</li><li>-2: SDK Initialization Error</li></ul></td></tr></tbody></table>

### calculate\_similarity

```python
def calculate_similarity(feature_1: np.ndarray, feature_2: np.ndarray) -> float:
```

<table data-header-hidden><thead><tr><th width="137"></th><th></th></tr></thead><tbody><tr><td><strong>Name</strong></td><td>calculate_similarity</td></tr><tr><td><strong>Description</strong></td><td>Calculates the similarity between two features</td></tr><tr><td><strong>Input</strong></td><td><ul><li><strong>feature_1</strong> (numpy.ndarray): 1st feature</li><li><strong>feature_2</strong> (numpy.ndarray): 2nd feature</li></ul></td></tr><tr><td><strong>Output</strong></td><td><p>Similarity score between the two features</p><p>The score ranges from 0.0 to 1.0<br><strong>Default Threshold is 0.67</strong></p></td></tr></tbody></table>
