https://github.com/intelrealsense/realsenseid-rest
Using RealSenseID Python bindings to bring remote access and control capabilities to the F4xx device families.
https://github.com/intelrealsense/realsenseid-rest
Last synced: 7 months ago
JSON representation
Using RealSenseID Python bindings to bring remote access and control capabilities to the F4xx device families.
- Host: GitHub
- URL: https://github.com/intelrealsense/realsenseid-rest
- Owner: IntelRealSense
- License: apache-2.0
- Created: 2024-06-13T14:20:26.000Z (almost 2 years ago)
- Default Branch: main
- Last Pushed: 2025-04-08T14:48:51.000Z (12 months ago)
- Last Synced: 2025-04-08T15:30:44.426Z (12 months ago)
- Language: Python
- Size: 1.2 MB
- Stars: 2
- Watchers: 2
- Forks: 0
- Open Issues: 4
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# ReadSenseID-REST
This software aims to providing REST and WebSocket interface to the RealSenseID library.
It is meant to be a kickstarter for projects that utilize RealSenseID with remote access.
## Pre-requisites
- Python 3.10+ (All the way to Python 3.12)
## Installation - First Time
Prepare a virtual environment:
Note: If you're on Ubuntu, and it complains about `pip` not available, run this:
```shell
sudo apt install -y python3-pip
```
Standard installation:
First time only (Linux & Windows):
```shell
python3 -m pip install poetry # Install poetry
poetry install # Install requirements
```
Or you can use the official poetry installer: https://python-poetry.org/docs/#installing-with-the-official-installer
and then:
```shell
poetry install # Install requirements
```
## Update / Run
Update Packages (Linux & Windows):
```shell
poetry install # Install / Update requirements
```
Then everytime you need to run:
```shell
poe run
```
or
```shell
poetry run fastapi run rsid_rest/main.py
```
or
```shell
poetry run python3 -m uvicorn rsid_rest.main:app --reload
```
## Usage
### API Documentation
Point your browser to: http://127.0.0.1:8000/docs/
### Sample Frontend
Point your browser to: http://127.0.0.1:8000/gui/
## Configuration and Settings
`.env` files and environment variables can be used to configura the application. The following table shows
the file names for environment files.
### Env files
| Environment | File |
|-------------|:-------------:|
| Dev | `.env` |
| Prod | `prod.env` |
### General Settings
The following variables can be set in the `.env` files or passed as Environment Variables before starting the app.
| Variable | Default | Configuration |
|------------------------------------|:--------:|----------------------------------------------------------------------------------------------------------|
| `auto_detect` | `True` | Automatically detect camera on system. Useful in dev environments |
| `com_port` | `None` | Specifies COM port when `auto_detect` is False. Windows example: `COM5` |
| `preview_camera_number` | `-1` | Camera index for preview `-1` for auto-detect |
| `db_mode` | `device` | DB location: `device` or `host` |
### Host DB Mode Settings
Similar to General Settings, the following variables can be set in `.env` or in the environment variables. They are only effective if `db_mode=host`
| Variable | Default | Configuration |
|------------------------------------|:--------:|----------------------------------------------------------------------------------------------------------|
| `host_mode_auth_type` | `hybrid` | In `host` DB mode: `hybrid`: use vector DB to enhance performance or: `device`: only use device matcher. |
| `host_mode_hybrid_max_results` | `10` | In `host` and `hybrid`: Vector DB filters should filter for a max of X candidates |
| `host_mode_hybrid_score_threshold` | `0.2` | In `host` and `hybrid`: Vector DB filters should filter use this score threshold (keep low) |
### Streaming Settings
Similar to General Settings, the following variables can be set in `.env` or in the environment variables.
| Variable | Default | Configuration |
|------------------------------------|:--------:|----------------------------------------------------------------------------------------------------------|
| `preview_stream_type` | `jpeg` | Streaming Preview output: `jpeg` or `webp` |
| `preview_jpeg_quality` | `85` | Streaming Preview JPEG quality. Min: `1` Max: `100` |
| `preview_webp_quality` | `85` | Streaming Preview WebP quality. Min: `1` Max: `100` |
### Creating a Client using the OpenAPI Schema
Running the following command will generate `openapi.json` file that can be used with the OpenAPI generator
```shell
poe gen-openapi
```
Navigate to: https://github.com/OpenAPITools/openapi-generator?tab=readme-ov-file#overview to find out more about
the ability to automatically generate SDK that can use this API.
---
## Important Note
> End-user is responsible for providing the authentication and security mechanisms to protect access to the camera and RealSenseID API.
> Please refer to https://fastapi.tiangolo.com/tutorial/security/ for documentation on how to integrate authentication.