Enable event snapshot API to honour query params after event ends (#22375)
CI / ARM Extra Build (push) Blocked by required conditions
CI / Synaptics Build (push) Blocked by required conditions
CI / AMD64 Build (push) Waiting to run
CI / ARM Build (push) Waiting to run
CI / Jetson Jetpack 6 (push) Waiting to run
CI / AMD64 Extra Build (push) Blocked by required conditions
CI / Assemble and push default build (push) Blocked by required conditions

* Enable event snapshot API to honour query params

* fix unused imports

* Fixes

* Run ruff check --fix

* Web changes

* Further config and web fixes

* Further docs tweak

* Fix missing quality default in MediaEventsSnapshotQueryParams

* Manual events: don't save annotated jpeg; store frame time

* Remove unnecessary grayscale helper

* Add caveat to docs on snapshot_frame_time pre-0.18

* JPG snapshot should not be treated as clean

* Ensure tracked details uses uncropped, bbox'd snapshot

* Ensure all UI pages / menu actions use uncropped, bbox'd

* web lint

* Add missed config helper text

* Expect  SnapshotsConfig not Any

* docs: Remove pre-0.18 note

* Specify timestamp=0 in the UI

* Move tests out of http media

* Correct missed settings.json wording

Co-authored-by: Josh Hawkins <32435876+hawkeye217@users.noreply.github.com>

* Revert to default None for quality

* Correct camera snapshot config wording

Co-authored-by: Josh Hawkins <32435876+hawkeye217@users.noreply.github.com>

* Fix quality=0 handling

Co-authored-by: Josh Hawkins <32435876+hawkeye217@users.noreply.github.com>

* Fix quality=0 handling #2

Co-authored-by: Josh Hawkins <32435876+hawkeye217@users.noreply.github.com>

* ReRun generate_config_translations

---------

Co-authored-by: leccelecce <example@example.com>
Co-authored-by: Josh Hawkins <32435876+hawkeye217@users.noreply.github.com>
This commit is contained in:
leccelecce
2026-03-22 13:33:04 -06:00
committed by GitHub
co-authored by leccelecce Josh Hawkins
parent b6c03c99de
commit ec7040bed5
32 changed files with 797 additions and 475 deletions
+20 -11
View File
@@ -158,36 +158,33 @@ class EventProcessor(threading.Thread):
end_time = (
None if event_data["end_time"] is None else event_data["end_time"]
)
snapshot = event_data["snapshot"]
# score of the snapshot
score = (
None
if event_data["snapshot"] is None
else event_data["snapshot"]["score"]
)
score = None if snapshot is None else snapshot["score"]
# detection region in the snapshot
region = (
None
if event_data["snapshot"] is None
if snapshot is None
else to_relative_box(
width,
height,
event_data["snapshot"]["region"],
snapshot["region"],
)
)
# bounding box for the snapshot
box = (
None
if event_data["snapshot"] is None
if snapshot is None
else to_relative_box(
width,
height,
event_data["snapshot"]["box"],
snapshot["box"],
)
)
attributes = (
None
if event_data["snapshot"] is None
if snapshot is None
else [
{
"box": to_relative_box(
@@ -198,9 +195,14 @@ class EventProcessor(threading.Thread):
"label": a["label"],
"score": a["score"],
}
for a in event_data["snapshot"]["attributes"]
for a in snapshot["attributes"]
]
)
snapshot_frame_time = None if snapshot is None else snapshot["frame_time"]
snapshot_area = None if snapshot is None else snapshot["area"]
snapshot_estimated_speed = (
None if snapshot is None else snapshot["current_estimated_speed"]
)
# keep these from being set back to false because the event
# may have started while recordings/snapshots/alerts/detections were enabled
@@ -229,6 +231,10 @@ class EventProcessor(threading.Thread):
"score": score,
"top_score": event_data["top_score"],
"attributes": attributes,
"snapshot_clean": event_data.get("snapshot_clean", False),
"snapshot_frame_time": snapshot_frame_time,
"snapshot_area": snapshot_area,
"snapshot_estimated_speed": snapshot_estimated_speed,
"average_estimated_speed": event_data["average_estimated_speed"],
"velocity_angle": event_data["velocity_angle"],
"type": "object",
@@ -306,8 +312,11 @@ class EventProcessor(threading.Thread):
"type": event_data["type"],
"score": event_data["score"],
"top_score": event_data["score"],
"snapshot_clean": event_data.get("snapshot_clean", False),
},
}
if event_data.get("draw") is not None:
event[Event.data]["draw"] = event_data["draw"]
if event_data.get("recognized_license_plate") is not None:
event[Event.data]["recognized_license_plate"] = event_data[
"recognized_license_plate"