> For the complete documentation index, see [llms.txt](https://docs.recognito.vision/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.recognito.vision/face-recognition-sdk/integration-guide/windows/api-reference.md).

# API Reference

### init\_sdk

{% code overflow="wrap" %}

```python
def init_sdk() -> 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.</td></tr><tr><td><strong>Input</strong></td><td>None</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>

### get\_attribute

{% code overflow="wrap" %}

```python
def get_attribute(image: np.ndarray, width: int, height: int, face_results: ctypes.POINTER(FaceResult), max_face_num: int, mode: int) -> int:
```

{% endcode %}

<table data-header-hidden><thead><tr><th width="137"></th><th></th></tr></thead><tbody><tr><td><strong>Name</strong></td><td>get_attribute</td></tr><tr><td><strong>Description</strong></td><td>Detects and analyzes face.</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_results</strong> (ctypes.POINTER): Pointer to a structure containing face results</li><li><strong>max_face_num</strong> (int): Maximum number of faces to detect</li><li><strong>mode</strong> (int): 0-> Enroll mode, 1-> Identify mode</li></ul></td></tr><tr><td><strong>Output</strong></td><td><p>Status code indicating the result of getting attribute.</p><ul><li>>0: Number of detected faces</li><li>0: No Face</li><li>otherwise: Error</li></ul></td></tr></tbody></table>

Here is **`FaceResult`** Structure.

```python
class FaceResult(Structure):
    _fields_ = [
        ("x1", c_int32),
        ("y1", c_int32),
        ("x2", c_int32),
        ("y2", c_int32),
        ("liveness", c_int32),
        ("mask", c_int32),
        ("glass", c_int32),
        ("age", c_int32),
        ("gender", c_int32),
        ("feature", c_ubyte * 2056)
    ]
```

<table data-header-hidden><thead><tr><th width="226"></th><th></th></tr></thead><tbody><tr><td><strong>(x1, y1)</strong></td><td>Coordinate of the top-left corner of the bounding box of the detected face.</td></tr><tr><td><strong>(x2, y2)</strong></td><td>Coordinate of the bottom-right corner of the bounding box of the detected face.</td></tr><tr><td><strong>liveness</strong></td><td><p>Liveness score of detected face</p><ul><li>0 -> SPOOF</li><li>1 -> REAL</li><li>-3 -> TOO SMALL FACE</li><li>-4 -> TOO LARGE FACE</li><li>-102 -> NO FACE</li><li>-103 -> LIVENESS CHECK FAILED</li></ul></td></tr><tr><td><strong>mask</strong></td><td><p>Mask detection of the detected face</p><ul><li>0 -> No, 1 -> Yes</li></ul></td></tr><tr><td><strong>glass</strong></td><td><p>Glass detection of the detected face</p><ul><li>0 -> No, 1 -> Yes</li></ul></td></tr><tr><td><strong>age</strong></td><td>Estimated age of the detected face</td></tr><tr><td><strong>gender</strong></td><td><p>Gender prediction of the detected face</p><ul><li>0 -> Male, 1 -> Female</li></ul></td></tr><tr><td><strong>feature</strong></td><td>Template buffer. Extracted template will be stored</td></tr></tbody></table>

### calculate\_similarity

{% code overflow="wrap" %}

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

{% endcode %}

<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.82</strong></p></td></tr></tbody></table>


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## 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, and the optional `goal` query parameter:

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

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

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.
