Metadata-Version: 2.4
Name: pekat-vision-sdk
Version: 2.3.3
Summary: A Python module for communication with PEKAT VISION
Project-URL: Homepage, https://github.com/pekat-vision/pekat-vision-sdk-python
Project-URL: Documentation, https://pekat-vision.github.io/pekat-vision-sdk-python/
Project-URL: Repository, https://github.com/pekat-vision/pekat-vision-sdk-python.git
Project-URL: Changelog, https://github.com/pekat-vision/pekat-vision-sdk-python/blob/master/CHANGELOG.md
Author-email: developers@pekatvision.com
Maintainer-email: developers@pekatvision.com
License-Expression: MIT
License-File: LICENSE
Keywords: pekat,pekatvision,pekatvisionsdk,sdk,vision
Classifier: Development Status :: 5 - Production/Stable
Classifier: License :: OSI Approved :: MIT License
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3 :: Only
Classifier: Programming Language :: Python :: 3.8
Requires-Python: >=3.8
Requires-Dist: numpy
Requires-Dist: packaging
Requires-Dist: psutil
Requires-Dist: requests
Provides-Extra: opencv
Requires-Dist: opencv-python; extra == 'opencv'
Description-Content-Type: text/markdown

# PEKAT VISION SDK - Python

A Python module for communication with [PEKAT VISION](https://www.pekatvision.com/products/software/).

Full SDK documentation available here: <https://pekat-vision.github.io/pekat-vision-sdk-python>

## Installation

Type `pip install "pekat-vision-sdk"` into your terminal.

Installing with `pip install "pekat-vision-sdk[opencv]"` also installs [`opencv`](https://pypi.org/project/opencv-python/).

## Example

### Creating the analyzer

```python
from PekatVisionSDK import Instance

# Start a project locally (host 0.0.0.0 - listen on all interfaces)

p_local = Instance("~/PekatVisionProjects/my_project", port=8100, host="0.0.0.0")

# Connect to an already running project

p_remote = Instance(port=8000, already_running=True)
```

### Sending an image to analyze

```python
import numpy as np

# p = Instance(...)

# Analyze image from disk

result = p.analyze("path_to_image.png", response_type="annotated_image")

# Analyze a numpy image

# image: np.ndarray = ...
result = p.analyze(image)
```

### Accessing the results

```python
# Get the evaluation result (True/False)

flow_result = result.context["result"]

# Decode image bytes and save image on disk

import cv2

if result.image_bytes is not None:
    image = result.get_decoded_image()
    cv2.imwrite("result_with_annotations.png", image)
```

### Stopping a project

```python
# Project must have been started using the SDK
p_local.stop()
```
