Save calibration payload format and live config
This commit is contained in:
@@ -2,7 +2,7 @@ camera_id = "cold_display_cam_01"
|
|||||||
timezone = "Asia/Shanghai"
|
timezone = "Asia/Shanghai"
|
||||||
|
|
||||||
[stream]
|
[stream]
|
||||||
rtsp_url = ""
|
rtsp_url = "rtsp://admin:Zxjp2026@192.168.8.9:554/h264/ch1/main/av_stream"
|
||||||
|
|
||||||
[thresholds]
|
[thresholds]
|
||||||
max_dwell_seconds = 10800
|
max_dwell_seconds = 10800
|
||||||
@@ -15,38 +15,38 @@ zone_ids = ["r1c1", "r1c2", "r1c3", "r1c4", "r2c1", "r2c2", "r2c3", "r2c4"]
|
|||||||
|
|
||||||
[[zones]]
|
[[zones]]
|
||||||
id = "r1c1"
|
id = "r1c1"
|
||||||
polygon = [[0.00, 0.00], [0.25, 0.00], [0.25, 0.50], [0.00, 0.50]]
|
polygon = [[0.441053, 0.344678], [0.475789, 0.372749], [0.453684, 0.455088], [0.404211, 0.428889]]
|
||||||
|
|
||||||
[[zones]]
|
[[zones]]
|
||||||
id = "r1c2"
|
id = "r1c2"
|
||||||
polygon = [[0.25, 0.00], [0.50, 0.00], [0.50, 0.50], [0.25, 0.50]]
|
polygon = [[0.486316, 0.367135], [0.520000, 0.397076], [0.503158, 0.468187], [0.467368, 0.451345]]
|
||||||
|
|
||||||
[[zones]]
|
[[zones]]
|
||||||
id = "r1c3"
|
id = "r1c3"
|
||||||
polygon = [[0.50, 0.00], [0.75, 0.00], [0.75, 0.50], [0.50, 0.50]]
|
polygon = [[0.545263, 0.400819], [0.587368, 0.417661], [0.554737, 0.500000], [0.509474, 0.483158]]
|
||||||
|
|
||||||
[[zones]]
|
[[zones]]
|
||||||
id = "r1c4"
|
id = "r1c4"
|
||||||
polygon = [[0.75, 0.00], [1.00, 0.00], [1.00, 0.50], [0.75, 0.50]]
|
polygon = [[0.581255, 0.408928], [0.717971, 0.468544], [0.711092, 0.574018], [0.556320, 0.500645]]
|
||||||
|
|
||||||
[[zones]]
|
[[zones]]
|
||||||
id = "r2c1"
|
id = "r2c1"
|
||||||
polygon = [[0.00, 0.50], [0.25, 0.50], [0.25, 1.00], [0.00, 1.00]]
|
polygon = [[0.396842, 0.475673], [0.487368, 0.543041], [0.472632, 0.612281], [0.373684, 0.584211]]
|
||||||
|
|
||||||
[[zones]]
|
[[zones]]
|
||||||
id = "r2c2"
|
id = "r2c2"
|
||||||
polygon = [[0.25, 0.50], [0.50, 0.50], [0.50, 1.00], [0.25, 1.00]]
|
polygon = [[0.502105, 0.528070], [0.535789, 0.546784], [0.516842, 0.660936], [0.477895, 0.632865]]
|
||||||
|
|
||||||
[[zones]]
|
[[zones]]
|
||||||
id = "r2c3"
|
id = "r2c3"
|
||||||
polygon = [[0.50, 0.50], [0.75, 0.50], [0.75, 1.00], [0.50, 1.00]]
|
polygon = [[0.555789, 0.552398], [0.602105, 0.569240], [0.580000, 0.657193], [0.535789, 0.645965]]
|
||||||
|
|
||||||
[[zones]]
|
[[zones]]
|
||||||
id = "r2c4"
|
id = "r2c4"
|
||||||
polygon = [[0.75, 0.50], [1.00, 0.50], [1.00, 1.00], [0.75, 1.00]]
|
polygon = [[0.602105, 0.567368], [0.700000, 0.606667], [0.689474, 0.722690], [0.581053, 0.683392]]
|
||||||
|
|
||||||
[trash]
|
[trash]
|
||||||
roi = [[0.80, 0.65], [1.00, 0.65], [1.00, 1.00], [0.80, 1.00]]
|
roi = [[0.776842, 0.486901], [0.896842, 0.522456], [0.841053, 0.857427], [0.716842, 0.853684]]
|
||||||
|
|
||||||
[event_sink]
|
[event_sink]
|
||||||
path = "logs/events.jsonl"
|
path = "logs/events.jsonl"
|
||||||
|
|||||||
@@ -350,12 +350,12 @@ async function saveCalibration() {
|
|||||||
|
|
||||||
async function persistCalibration({requireAny}) {
|
async function persistCalibration({requireAny}) {
|
||||||
const zones = zoneIds
|
const zones = zoneIds
|
||||||
.map((id) => ({id, polygon: state.polygons[id]}))
|
.map((id) => ({id, polygon: serializePolygon(state.polygons[id])}))
|
||||||
.filter((zone) => zone.polygon.length >= 3);
|
.filter((zone) => zone.polygon.length >= 3);
|
||||||
const trashPolygon = state.polygons.trash;
|
const trashPolygon = state.polygons.trash;
|
||||||
const payload = {zones, trash: {}};
|
const payload = {zones, trash: {}};
|
||||||
if (trashPolygon.length >= 3) {
|
if (trashPolygon.length >= 3) {
|
||||||
payload.trash.roi = trashPolygon;
|
payload.trash.roi = serializePolygon(trashPolygon);
|
||||||
}
|
}
|
||||||
if (!zones.length && !payload.trash.roi) {
|
if (!zones.length && !payload.trash.roi) {
|
||||||
if (requireAny) {
|
if (requireAny) {
|
||||||
@@ -370,6 +370,10 @@ async function persistCalibration({requireAny}) {
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function serializePolygon(points) {
|
||||||
|
return points.map((point) => [point.x, point.y]);
|
||||||
|
}
|
||||||
|
|
||||||
function setTab(tab) {
|
function setTab(tab) {
|
||||||
state.activeTab = tab;
|
state.activeTab = tab;
|
||||||
document.querySelectorAll(".tabs button").forEach((button) => {
|
document.querySelectorAll(".tabs button").forEach((button) => {
|
||||||
|
|||||||
Reference in New Issue
Block a user