Enable and retrieve object snapshots
This guide shows how to enable, configure and decode object snapshots for the Best Snapshot feature for the fusion tracker module. If enabled and configured correctly, object snapshots will be send both in the Fusion Tracker and Track Summary modules output.
Prerequisites
- A device that supports the Best Snapshot feature, see compatible products page
- Access to data, for example either through MQTT or RTSP
- cURL installed
Overview
The guide contains the following steps:
- Enable Best Snapshot feature
- Read and decode images
- Disable Best Snapshot feature (Optional)
Lets get started!
Step 1: Enable Best Snapshot feature
The Best Snapshot feature is enabled by sending the following command to the device:
Don't forget to replace <device-ip>
, <user>
and <password>
where applicable.
curl --anyauth --user <user>:<password> \
"http://<device-ip>/config/rest/best-snapshot/v1/enabled" \
-H "Content-Type: application/json" -X PUT --data "{\"data\":true}"
{
"status": "success"
}
Or use the Swagger UI to set the /best-snapshot/v1/enabled
to true:
http://<device-ip>/config/web-ui/swagger-ui/?url=/config/discover/apis/best-snapshot/v1/openapi.json#/best-snapshot.v1/patch_best_snapshot_v1_enabled
Step 2: Read and decode images
Reading the data can be done either via MQTT or RTSP. Once you have some data, for example (some data has been removed to keep example small)
{
"frame": {
"timestamp": "2025-01-01T00:00:00.000000Z",
"observations": [
{
"track_id": "1",
"bounding_box": {
"bottom": 0.89332,
"left": 0.13332,
"right": 0.80004,
"top": 0.59942
},
"class": {
"type": "Human",
"score": 0.6
},
"image": {
"data": "<base-64 encoded image>",
"bounding_box": {
"bottom": 0.937405,
"left": 0.033312,
"right": 0.900048,
"top": 0.555335
}
}
},
]
}
}
To decode and display the image in python we can do the following:
import base64
from PIL import Image
from io import BytesIO
image_data = base64.b64decode("<base-64 encoded image>")
image = Image.open(BytesIO(image_data))
image.show()
Step 3: Disable Best Snapshot feature (Optional)
The Best Snapshot feature is enabled by sending the following command to the device:
Don't forget to replace <device-ip>
, <user>
and <password>
where applicable.
curl --anyauth --user <user>:<password> \
"http://<device-ip>/config/rest/best-snapshot/v1/enabled" \
-H "Content-Type: application/json" -X PUT --data "{\"data\":false}"
{
"status": "success"
}
Or use the Swagger UI to set the /best-snapshot/v1/enabled
to false:
http://<device-ip>/config/web-ui/swagger-ui/?url=/config/discover/apis/best-snapshot/v1/openapi.json#/best-snapshot.v1/patch_best_snapshot_v1_enabled