Enable and retrieve object snapshots
This guide shows how to enable, configure and decode object snapshots for the Object Snapshot feature in the fusion tracker module. If enabled and configured correctly, object snapshots will be sent both in the Fusion Tracker and Track Consolidation modules' output.
Prerequisites
- A device that supports the Object 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 Object Snapshot feature
- Read and decode images
- Disable Object Snapshot feature (Optional)
Lets get started!
Step 1: Enable Object Snapshot feature
The Object Snapshot feature is enabled by sending the following command to the device:
Remember to replace <servername>, <username> and <password> where applicable.
- curl
- HTTP
curl --request PATCH \
--anyauth \
--user "<username>:<password>" \
--header "Content-Type: application/json" \
"http://<servername>/config/rest/object-snapshot/v1/enabled" \
--data '{
"data": true
}'
PATCH /config/rest/object-snapshot/v1/enabled
Host: <servername>
Content-Type: application/json
{
"data": true
}
{
"status": "success"
}
Or use the Swagger UI to set the /object-snapshot/v1/enabled to true:
http://<servername>/config/web-ui/swagger-ui/?url=/config/discover/apis/object-snapshot/v1/openapi.json#/object-snapshot.v1/patch_object_snapshot_v1_enabled
Step 2: Read and decode images
Reading the data can be done either via MQTT or RTSP. The following example shows retrieved data with some fields omitted for readability.
{
"object_track_id": "1",
"channel_id": 1,
"id": "ABC123",
"timestamp": "2025-01-01T00:00:00.000000Z",
"data": "base64...",
"class": {
"score": 0.6,
"type": "Human"
},
"crop_box": {
"bottom": 0.99332,
"left": 0.03332,
"right": 0.90004,
"top": 0.49942
}
}
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 Object Snapshot feature (Optional)
The Object Snapshot feature is disabled by sending the following command to the device:
Remember to replace <servername>, <username> and <password> where applicable.
- curl
- HTTP
curl --request PATCH \
--anyauth \
--user "<username>:<password>" \
--header "Content-Type: application/json" \
"http://<servername>/config/rest/object-snapshot/v1/enabled" \
--data '{
"data": false
}'
PATCH /config/rest/object-snapshot/v1/enabled
Host: <servername>
Content-Type: application/json
{
"data": false
}
{
"status": "success"
}
Or use the Swagger UI to set the /object-snapshot/v1/enabled to false:
http://<servername>/config/web-ui/swagger-ui/?url=/config/discover/apis/object-snapshot/v1/openapi.json#/object-snapshot.v1/patch_object_snapshot_v1_enabled