Compare commits
2 Commits
494c11ddbf
...
dd2dd53d7e
| Author | SHA1 | Date | |
|---|---|---|---|
| dd2dd53d7e | |||
| 980a3e5178 |
@@ -338,7 +338,12 @@ class Camera:
|
|||||||
self.frame_no = 0
|
self.frame_no = 0
|
||||||
self.cond = threading.Condition()
|
self.cond = threading.Condition()
|
||||||
self.status = "starting"
|
self.status = "starting"
|
||||||
self.stats = dict(decoded=0, received=0, snap_ms=0.0, hires=0, hires_ms=0.0, det_runs=0, det_ms=0.0, read_runs=0, read_ms=0.0, saves=0, verdicts=0)
|
self.stats = dict(decoded=0, received=0, snap_ms=0.0, hires=0, hires_ms=0.0, det_runs=0, det_ms=0.0, read_runs=0, read_ms=0.0, saves=0, verdicts=0, live=0)
|
||||||
|
# The live picture for the page: every decoded frame re-encoded as JPEG, ONCE per frame
|
||||||
|
# for all viewers, and only while somebody watches (2026-11-23, the H.264 test).
|
||||||
|
self.live_viewers, self.live_jpeg, self.live_no = 0, None, 0
|
||||||
|
self.live_cond = threading.Condition()
|
||||||
|
self.codec, self.first_frame_s = None, None # what the camera sends; connect -> first picture
|
||||||
self.present = False
|
self.present = False
|
||||||
# One lane, two cameras (entry and exit watch the same lane from both ends): only one
|
# One lane, two cameras (entry and exit watch the same lane from both ends): only one
|
||||||
# camera may hold a visit at a time. The other YIELDS, and stays yielded until its own
|
# camera may hold a visit at a time. The other YIELDS, and stays yielded until its own
|
||||||
@@ -519,21 +524,56 @@ class Camera:
|
|||||||
# --- stream mode: decode everything, keep the newest
|
# --- stream mode: decode everything, keep the newest
|
||||||
def grab_stream(self):
|
def grab_stream(self):
|
||||||
if True:
|
if True:
|
||||||
cap = cv2.VideoCapture(self.url, cv2.CAP_FFMPEG)
|
t0 = time.time()
|
||||||
|
# FFmpeg decodes H.264 on several threads by default, and each extra thread holds one
|
||||||
|
# more frame back: 5 frames on the 6-core booth PC, 0.4 s at 12.5 fps (measured
|
||||||
|
# 2026-11-23). decode_threads: 1 gives each frame out as soon as it is decoded.
|
||||||
|
n = self.app.cfg.get("decode_threads")
|
||||||
|
cap = (cv2.VideoCapture(self.url, cv2.CAP_FFMPEG, [cv2.CAP_PROP_N_THREADS, int(n)]) if n
|
||||||
|
else cv2.VideoCapture(self.url, cv2.CAP_FFMPEG))
|
||||||
if not cap.isOpened():
|
if not cap.isOpened():
|
||||||
raise ConnectionError("cannot open stream")
|
raise ConnectionError("cannot open stream")
|
||||||
self.status = "live"
|
self.status = "live"
|
||||||
log(self.name, "stream open", self.safe_url(),
|
fcc = int(cap.get(cv2.CAP_PROP_FOURCC))
|
||||||
|
self.codec = "".join(chr((fcc >> 8 * i) & 0xFF) for i in range(4)).strip("\x00 ") or "?"
|
||||||
|
log(self.name, "stream open", self.safe_url(), self.codec,
|
||||||
int(cap.get(cv2.CAP_PROP_FRAME_WIDTH)), "x", int(cap.get(cv2.CAP_PROP_FRAME_HEIGHT)))
|
int(cap.get(cv2.CAP_PROP_FRAME_WIDTH)), "x", int(cap.get(cv2.CAP_PROP_FRAME_HEIGHT)))
|
||||||
|
first = True
|
||||||
while True:
|
while True:
|
||||||
ok, f = cap.read()
|
ok, f = cap.read()
|
||||||
if not ok:
|
if not ok:
|
||||||
self.status = "stream lost"
|
self.status = "stream lost"
|
||||||
log(self.name, "stream lost, reconnecting")
|
log(self.name, "stream lost, reconnecting")
|
||||||
break
|
break
|
||||||
|
if first:
|
||||||
|
first, self.first_frame_s = False, round(time.time() - t0, 2)
|
||||||
|
log(self.name, f"first picture {self.first_frame_s} s after connecting")
|
||||||
self.publish(frame=f)
|
self.publish(frame=f)
|
||||||
cap.release()
|
cap.release()
|
||||||
|
|
||||||
|
# --- live picture: one JPEG per decoded frame, shared by all viewers, idle with none
|
||||||
|
def live_loop(self):
|
||||||
|
seen = 0
|
||||||
|
q = int(self.app.cfg.get("live_quality", 75))
|
||||||
|
while True:
|
||||||
|
with self.live_cond:
|
||||||
|
self.live_cond.wait_for(lambda: self.live_viewers > 0)
|
||||||
|
with self.cond:
|
||||||
|
self.cond.wait_for(lambda: self.frame_no != seen, timeout=2)
|
||||||
|
if self.frame_no == seen:
|
||||||
|
continue
|
||||||
|
f, _, seen = self.latest()
|
||||||
|
if f is None:
|
||||||
|
continue
|
||||||
|
img = f.copy() # the boxes must not land on the frame the detector and the clip use
|
||||||
|
for x1, y1, x2, y2, *_ in list(self.last_vehicles):
|
||||||
|
cv2.rectangle(img, (int(x1), int(y1)), (int(x2), int(y2)), (0, 255, 0), 2)
|
||||||
|
jpeg = cv2.imencode(".jpg", img, [cv2.IMWRITE_JPEG_QUALITY, q])[1].tobytes()
|
||||||
|
self.stats["live"] += 1
|
||||||
|
with self.live_cond:
|
||||||
|
self.live_jpeg, self.live_no = jpeg, self.live_no + 1
|
||||||
|
self.live_cond.notify_all()
|
||||||
|
|
||||||
# --- worker: presence in zone → plate
|
# --- worker: presence in zone → plate
|
||||||
def work(self):
|
def work(self):
|
||||||
period = 1.0 / self.app.cfg["detect_fps"]
|
period = 1.0 / self.app.cfg["detect_fps"]
|
||||||
@@ -1273,14 +1313,24 @@ class App:
|
|||||||
a = list(map(int, open("/proc/stat").readline().split()[1:]))
|
a = list(map(int, open("/proc/stat").readline().split()[1:]))
|
||||||
return sum(a), a[3] + a[4]
|
return sum(a), a[3] + a[4]
|
||||||
|
|
||||||
|
def net_rx(): # bytes received on the machine's real network cards (host network)
|
||||||
|
n = 0
|
||||||
|
for ln in open("/proc/net/dev").read().splitlines()[2:]:
|
||||||
|
name, rest = ln.split(":", 1)
|
||||||
|
if name.strip().startswith(("en", "eth", "wl")):
|
||||||
|
n += int(rest.split()[0])
|
||||||
|
return n
|
||||||
|
|
||||||
cpu0, _ = proc()
|
cpu0, _ = proc()
|
||||||
h0 = host()
|
h0 = host()
|
||||||
|
n0 = net_rx()
|
||||||
t0 = time.time()
|
t0 = time.time()
|
||||||
prev = {c.name: dict(c.stats) for c in self.cams}
|
prev = {c.name: dict(c.stats) for c in self.cams}
|
||||||
while True:
|
while True:
|
||||||
time.sleep(self.cfg["metrics_s"])
|
time.sleep(self.cfg["metrics_s"])
|
||||||
cpu1, rss = proc()
|
cpu1, rss = proc()
|
||||||
h1 = host()
|
h1 = host()
|
||||||
|
n1 = net_rx()
|
||||||
t1 = time.time()
|
t1 = time.time()
|
||||||
dt = t1 - t0
|
dt = t1 - t0
|
||||||
tot, idle = h1[0] - h0[0], h1[1] - h0[1]
|
tot, idle = h1[0] - h0[0], h1[1] - h0[1]
|
||||||
@@ -1288,12 +1338,15 @@ class App:
|
|||||||
proc_cores=round((cpu1 - cpu0) / dt, 2),
|
proc_cores=round((cpu1 - cpu0) / dt, 2),
|
||||||
proc_pct_of_host=round(100 * (cpu1 - cpu0) / dt / NCPU, 1),
|
proc_pct_of_host=round(100 * (cpu1 - cpu0) / dt / NCPU, 1),
|
||||||
host_busy_pct=round(100 * (tot - idle) / tot, 1) if tot else None,
|
host_busy_pct=round(100 * (tot - idle) / tot, 1) if tot else None,
|
||||||
rss_mb=round(rss / 2**20), load1=os.getloadavg()[0], cams={})
|
rss_mb=round(rss / 2**20), load1=os.getloadavg()[0],
|
||||||
|
net_rx_mbps=round((n1 - n0) * 8 / dt / 1e6, 2), cams={})
|
||||||
for c in self.cams:
|
for c in self.cams:
|
||||||
s, p = c.stats, prev[c.name]
|
s, p = c.stats, prev[c.name]
|
||||||
d = {k: s[k] - p[k] for k in s}
|
d = {k: s[k] - p[k] for k in s}
|
||||||
m["cams"][c.name] = dict(
|
m["cams"][c.name] = dict(
|
||||||
status=c.status, mode=c.mode, fps=round(d["received"] / dt, 1),
|
status=c.status, mode=c.mode, codec=c.codec, first_frame_s=c.first_frame_s,
|
||||||
|
live_viewers=c.live_viewers, live_per_s=round(d["live"] / dt, 1),
|
||||||
|
fps=round(d["received"] / dt, 1),
|
||||||
decoded_per_s=round(d["decoded"] / dt, 1),
|
decoded_per_s=round(d["decoded"] / dt, 1),
|
||||||
snap_ms=round(d["snap_ms"] / d["received"], 1) if c.mode == "snapshot" and d["received"] else None,
|
snap_ms=round(d["snap_ms"] / d["received"], 1) if c.mode == "snapshot" and d["received"] else None,
|
||||||
det_per_s=round(d["det_runs"] / dt, 1),
|
det_per_s=round(d["det_runs"] / dt, 1),
|
||||||
@@ -1303,12 +1356,12 @@ class App:
|
|||||||
read_ms=round(d["read_ms"] / d["read_runs"], 1) if d["read_runs"] else None,
|
read_ms=round(d["read_ms"] / d["read_runs"], 1) if d["read_runs"] else None,
|
||||||
saves=d["saves"], verdicts=d["verdicts"], present=c.present)
|
saves=d["saves"], verdicts=d["verdicts"], present=c.present)
|
||||||
prev[c.name] = dict(s)
|
prev[c.name] = dict(s)
|
||||||
cpu0, h0, t0 = cpu1, h1, t1
|
cpu0, h0, n0, t0 = cpu1, h1, n1, t1
|
||||||
with self.io_lock, open(self.out / "metrics.jsonl", "a") as fh:
|
with self.io_lock, open(self.out / "metrics.jsonl", "a") as fh:
|
||||||
fh.write(json.dumps(m) + "\n")
|
fh.write(json.dumps(m) + "\n")
|
||||||
log("metrics", f"proc {m['proc_cores']} cores ({m['proc_pct_of_host']}% of host)",
|
log("metrics", f"proc {m['proc_cores']} cores ({m['proc_pct_of_host']}% of host)",
|
||||||
f"rss {m['rss_mb']} MB", f"host {m['host_busy_pct']}%",
|
f"rss {m['rss_mb']} MB", f"host {m['host_busy_pct']}%", f"net in {m['net_rx_mbps']} Mbps",
|
||||||
" | ".join(f"{n}: {v['mode']} {v['fps']} in/s, {v['decoded_per_s']} dec/s"
|
" | ".join(f"{n}: {v['mode']} {v['codec']} {v['fps']} in/s, {v['decoded_per_s']} dec/s, live {v['live_per_s']}/s x{v['live_viewers']}"
|
||||||
+ (f", snap {v['snap_ms']} ms" if v['snap_ms'] else "") + f", det {v['det_ms']} ms, reads {v['reads']}"
|
+ (f", snap {v['snap_ms']} ms" if v['snap_ms'] else "") + f", det {v['det_ms']} ms, reads {v['reads']}"
|
||||||
+ (f" (hi-res {v['hires_ms']} ms)" if v['hires_ms'] else "") + ""
|
+ (f" (hi-res {v['hires_ms']} ms)" if v['hires_ms'] else "") + ""
|
||||||
f" @ {v['read_ms']} ms" for n, v in m["cams"].items()))
|
f" @ {v['read_ms']} ms" for n, v in m["cams"].items()))
|
||||||
@@ -1317,6 +1370,7 @@ class App:
|
|||||||
for c in self.cams:
|
for c in self.cams:
|
||||||
threading.Thread(target=c.grab, daemon=True, name=f"grab-{c.name}").start()
|
threading.Thread(target=c.grab, daemon=True, name=f"grab-{c.name}").start()
|
||||||
threading.Thread(target=c.work, daemon=True, name=f"work-{c.name}").start()
|
threading.Thread(target=c.work, daemon=True, name=f"work-{c.name}").start()
|
||||||
|
threading.Thread(target=c.live_loop, daemon=True, name=f"live-{c.name}").start()
|
||||||
threading.Thread(target=self.metrics, daemon=True, name="metrics").start()
|
threading.Thread(target=self.metrics, daemon=True, name="metrics").start()
|
||||||
Handler.app = self
|
Handler.app = self
|
||||||
srv = ThreadingHTTPServer(("0.0.0.0", self.cfg["http_port"]), Handler)
|
srv = ThreadingHTTPServer(("0.0.0.0", self.cfg["http_port"]), Handler)
|
||||||
@@ -1391,7 +1445,7 @@ async function saveZone(n){const z=S.zone[n]||[];if(z.length<3)return alert('Nee
|
|||||||
await fetch('zone/'+n,{method:'POST',body:JSON.stringify(z)});S.zone[n]=[];last=await (await fetch('status')).json();draw()}
|
await fetch('zone/'+n,{method:'POST',body:JSON.stringify(z)});S.zone[n]=[];last=await (await fetch('status')).json();draw()}
|
||||||
async function tick(){
|
async function tick(){
|
||||||
try{last=await (await fetch('status')).json();
|
try{last=await (await fetch('status')).json();
|
||||||
for(const c of last.cams){document.getElementById('i-'+c.name).src='frame/'+c.name+'.jpg?'+Date.now();
|
for(const c of last.cams){{const im=document.getElementById('i-'+c.name);if(!im.dataset.live){im.dataset.live=1;im.onerror=()=>{delete im.dataset.live};im.src='live/'+c.name+'.mjpg?'+Date.now()}}
|
||||||
document.getElementById('s-'+c.name).textContent=`${c.status} · ${c.present?'ZONE BUSY'+(c.crossing?' · last crossing '+({'a-to-b':'A → B (in)','b-to-a':'B → A (out)'})[c.crossing]:' · no crossing yet'):c.yielded?'lane busy (other camera)':c.busy?'vehicle in zone (no visit)':'empty'}${c.side?' · car '+({a:'on side A',b:'on side B',line:'on the line'})[c.side]:''}${c.read?' · '+c.read:''}`}
|
document.getElementById('s-'+c.name).textContent=`${c.status} · ${c.present?'ZONE BUSY'+(c.crossing?' · last crossing '+({'a-to-b':'A → B (in)','b-to-a':'B → A (out)'})[c.crossing]:' · no crossing yet'):c.yielded?'lane busy (other camera)':c.busy?'vehicle in zone (no visit)':'empty'}${c.side?' · car '+({a:'on side A',b:'on side B',line:'on the line'})[c.side]:''}${c.read?' · '+c.read:''}`}
|
||||||
const R=last.relays;relaybar.innerHTML=!R.configured?'Relays: not configured':
|
const R=last.relays;relaybar.innerHTML=!R.configured?'Relays: not configured':
|
||||||
(R.armed?`<b style="color:#f55">RELAYS ARMED</b> — R1 opens on a car in the zone. R2 (close) ${R.close_live?'<b style="color:#f55">is LIVE: it closes the real barrier on an abandoned open</b>':'stays a dry run (logged only)'}. Auto-disarm in ${Math.ceil(R.armed_left_s/60)} min. <button onclick="fetch('disarm',{method:'POST'})">Disarm</button>`
|
(R.armed?`<b style="color:#f55">RELAYS ARMED</b> — R1 opens on a car in the zone. R2 (close) ${R.close_live?'<b style="color:#f55">is LIVE: it closes the real barrier on an abandoned open</b>':'stays a dry run (logged only)'}. Auto-disarm in ${Math.ceil(R.armed_left_s/60)} min. <button onclick="fetch('disarm',{method:'POST'})">Disarm</button>`
|
||||||
@@ -1466,6 +1520,33 @@ class Handler(BaseHTTPRequestHandler):
|
|||||||
return self.send(200, json.dumps(dict(cams=cams, reads=reads, visits=visits, relays=relays)).encode(), "application/json")
|
return self.send(200, json.dumps(dict(cams=cams, reads=reads, visits=visits, relays=relays)).encode(), "application/json")
|
||||||
if self.path == "/relaystatus": # a status read on demand: moves nothing
|
if self.path == "/relaystatus": # a status read on demand: moves nothing
|
||||||
return self.send(200, json.dumps(a.relays.status()).encode(), "application/json")
|
return self.send(200, json.dumps(a.relays.status()).encode(), "application/json")
|
||||||
|
m = re.match(r"^/live/([\w-]+)\.mjpg", self.path)
|
||||||
|
if m: # the live picture: multipart JPEG, newest frame only (a slow viewer skips frames)
|
||||||
|
c = next((c for c in a.cams if c.name == m.group(1)), None)
|
||||||
|
if c is None:
|
||||||
|
return self.send(404, b"no camera", "text/plain")
|
||||||
|
self.send_response(200)
|
||||||
|
self.send_header("Content-Type", "multipart/x-mixed-replace; boundary=frame")
|
||||||
|
self.send_header("Cache-Control", "no-store")
|
||||||
|
self.end_headers()
|
||||||
|
with c.live_cond:
|
||||||
|
c.live_viewers += 1
|
||||||
|
c.live_cond.notify_all()
|
||||||
|
seen = c.live_no
|
||||||
|
try:
|
||||||
|
while True:
|
||||||
|
with c.live_cond:
|
||||||
|
if not c.live_cond.wait_for(lambda: c.live_no != seen, timeout=10):
|
||||||
|
continue
|
||||||
|
jpeg, seen = c.live_jpeg, c.live_no
|
||||||
|
self.wfile.write(b"--frame\r\nContent-Type: image/jpeg\r\nContent-Length: "
|
||||||
|
+ str(len(jpeg)).encode() + b"\r\n\r\n" + jpeg + b"\r\n")
|
||||||
|
except OSError:
|
||||||
|
pass # the viewer went away
|
||||||
|
finally:
|
||||||
|
with c.live_cond:
|
||||||
|
c.live_viewers -= 1
|
||||||
|
return
|
||||||
m = re.match(r"^/frame/([\w-]+)\.jpg", self.path)
|
m = re.match(r"^/frame/([\w-]+)\.jpg", self.path)
|
||||||
if m:
|
if m:
|
||||||
c = next((c for c in a.cams if c.name == m.group(1)), None)
|
c = next((c for c in a.cams if c.name == m.group(1)), None)
|
||||||
|
|||||||
@@ -2,7 +2,7 @@
|
|||||||
type: concept
|
type: concept
|
||||||
tags: [parking, entry, anti-fraud, safety, devices]
|
tags: [parking, entry, anti-fraud, safety, devices]
|
||||||
sources: []
|
sources: []
|
||||||
updated: 2026-07-04
|
updated: 2026-11-23
|
||||||
status: open
|
status: open
|
||||||
---
|
---
|
||||||
|
|
||||||
@@ -72,6 +72,10 @@ configured, a press is live **only while the entry lane's camera confirms a vehi
|
|||||||
never traps a car. A camera-less site keeps the radar-only gate; a faulty camera is dropped via the
|
never traps a car. A camera-less site keeps the radar-only gate; a faulty camera is dropped via the
|
||||||
admin [[entry-presence-bypass]] (`bypassPresenceCamera`), same as the operator-issued path.
|
admin [[entry-presence-bypass]] (`bypassPresenceCamera`), same as the operator-issued path.
|
||||||
|
|
||||||
|
> **2026-11-23 (user):** this gate stays as built under the event-driven refactor. When a camera
|
||||||
|
> gives no signal, the admin bypass ([[entry-presence-bypass]]) is the way to unblock the ticket
|
||||||
|
> ([[event-driven-refactor]]).
|
||||||
|
|
||||||
### REJECTED: camera-vetoed re-arm (the queue trap)
|
### REJECTED: camera-vetoed re-arm (the queue trap)
|
||||||
The obvious fix for the stationary-car dropout — *don't re-arm on loop-clear while the camera still
|
The obvious fix for the stationary-car dropout — *don't re-arm on loop-clear while the camera still
|
||||||
sees a car; re-arm when the lane flips free* — was designed and **rejected** (2026-07-04). The
|
sees a car; re-arm when the lane flips free* — was designed and **rejected** (2026-07-04). The
|
||||||
|
|||||||
@@ -2,7 +2,7 @@
|
|||||||
type: concept
|
type: concept
|
||||||
tags: [parking, entry, admin, devices, threat-model, presence]
|
tags: [parking, entry, admin, devices, threat-model, presence]
|
||||||
sources: []
|
sources: []
|
||||||
updated: 2026-07-04
|
updated: 2026-11-23
|
||||||
status: settled
|
status: settled
|
||||||
---
|
---
|
||||||
|
|
||||||
@@ -15,6 +15,9 @@ radar, a camera that stopped pushing ([[g3h-anpr-push-gotchas|it happens]]) —
|
|||||||
**legitimate** transient entry until support fixes the hardware. This feature lets the **admin**
|
**legitimate** transient entry until support fixes the hardware. This feature lets the **admin**
|
||||||
drop a specific signal as a requirement until then. Built 2026-07-02 (migration `0020`).
|
drop a specific signal as a requirement until then. Built 2026-07-02 (migration `0020`).
|
||||||
|
|
||||||
|
> **2026-11-23 (user):** this bypass is the mechanism that unblocks entry when a camera or a
|
||||||
|
> radar gives no signal, also under the event-driven refactor ([[event-driven-refactor]]).
|
||||||
|
|
||||||
## The principle: the admin is NOT the adversary
|
## The principle: the admin is NOT the adversary
|
||||||
|
|
||||||
The [[threat-model]] adversary is the **booth operator**; the admin is the trusted party. So the
|
The [[threat-model]] adversary is the **booth operator**; the admin is the trusted party. So the
|
||||||
|
|||||||
@@ -2,12 +2,17 @@
|
|||||||
type: concept
|
type: concept
|
||||||
tags: [parking, camera, anpr, subscription, lane, vision]
|
tags: [parking, camera, anpr, subscription, lane, vision]
|
||||||
sources: []
|
sources: []
|
||||||
updated: 2026-10-11
|
updated: 2026-11-23
|
||||||
status: open
|
status: open
|
||||||
---
|
---
|
||||||
|
|
||||||
# Lane Presence & ANPR Subscriber Entry
|
# Lane Presence & ANPR Subscriber Entry
|
||||||
|
|
||||||
|
> **2026-11-23:** the bridge described here has the server pull the still and post it to the
|
||||||
|
> vision service. The user decided that the server holds no video or image work and takes a
|
||||||
|
> camera's signal as one way in among several ([[event-driven-refactor]]). Not built; this page
|
||||||
|
> describes what runs today.
|
||||||
|
|
||||||
Two related things a camera's vehicle detection feeds, worked out over a long field session
|
Two related things a camera's vehicle detection feeds, worked out over a long field session
|
||||||
(2026-06-22, see [[lpr-camera]] for the camera-side saga + the corrected "it was the undrawn
|
(2026-06-22, see [[lpr-camera]] for the camera-side saga + the corrected "it was the undrawn
|
||||||
detection area" conclusion):
|
detection area" conclusion):
|
||||||
|
|||||||
@@ -2,7 +2,7 @@
|
|||||||
type: concept
|
type: concept
|
||||||
tags: [parking, booth, entry, threat-model, anpr, presence]
|
tags: [parking, booth, entry, threat-model, anpr, presence]
|
||||||
sources: []
|
sources: []
|
||||||
updated: 2026-07-04
|
updated: 2026-11-23
|
||||||
status: settled
|
status: settled
|
||||||
---
|
---
|
||||||
|
|
||||||
@@ -14,6 +14,10 @@ to mint entries — so it is **flagged, presence-gated, and paired with an exit
|
|||||||
([[plate-reconciliation]]). Built 2026-07-01. Companion to [[entry-exit-points]] (the entry flow it
|
([[plate-reconciliation]]). Built 2026-07-01. Companion to [[entry-exit-points]] (the entry flow it
|
||||||
reuses) and [[capacity-occupancy]].
|
reuses) and [[capacity-occupancy]].
|
||||||
|
|
||||||
|
> **2026-11-23 (user):** this gate stays as built under the event-driven refactor. When a camera
|
||||||
|
> gives no signal, the admin bypass ([[entry-presence-bypass]]) is the way to unblock the ticket
|
||||||
|
> ([[event-driven-refactor]]).
|
||||||
|
|
||||||
## Why give the operator this at all
|
## Why give the operator this at all
|
||||||
An operator *could* mint tickets to defraud — but a broken entry button otherwise **blocks the whole
|
An operator *could* mint tickets to defraud — but a broken entry button otherwise **blocks the whole
|
||||||
lot**, which is worse and more common. So the feature exists, and the fraud it enables is defended
|
lot**, which is worse and more common. So the feature exists, and the fraud it enables is defended
|
||||||
|
|||||||
@@ -2,7 +2,7 @@
|
|||||||
type: concept
|
type: concept
|
||||||
tags: [parking, vision, barrier, lane, ledger, safety, design]
|
tags: [parking, vision, barrier, lane, ledger, safety, design]
|
||||||
sources: []
|
sources: []
|
||||||
updated: 2026-11-22
|
updated: 2026-11-23
|
||||||
status: open
|
status: open
|
||||||
---
|
---
|
||||||
|
|
||||||
@@ -110,7 +110,7 @@ Two cameras mounted on **one physical lane that serves both directions** (user,
|
|||||||
|---|---|---|
|
|---|---|---|
|
||||||
| Address | `10.0.10.6` | `10.0.10.7` |
|
| Address | `10.0.10.6` | `10.0.10.7` |
|
||||||
| Model | DS-2CD1083G2-LIU (8MP, V5.8.4) | DS-2CD1043G2-LIU (4MP, V5.8.10) |
|
| Model | DS-2CD1083G2-LIU (8MP, V5.8.4) | DS-2CD1043G2-LIU (4MP, V5.8.10) |
|
||||||
| Sub-stream (102) | 1280×720 **MJPEG**, 12.5 fps (was 640×360 H.264, keyframe every 4 s) | 1280×720 **MJPEG**, 20 fps (was 640×360 H.264, keyframe every 2.5 s) |
|
| Sub-stream (102) | 1280×720 **H.264**, 12.5 fps, keyframe every 0.96 s (since 2026-11-23; MJPEG from 2026-11-17 until then) | 1280×720 **H.264**, 20 fps, keyframe every 1 s (since 2026-11-23; MJPEG from 2026-11-17 until then) |
|
||||||
| Line crossing / intrusion (`ISAPI/Smart/LineDetection`, `FieldDetection`) | `notSupport` | `notSupport` |
|
| Line crossing / intrusion (`ISAPI/Smart/LineDetection`, `FieldDetection`) | `notSupport` | `notSupport` |
|
||||||
| Motion detection | on, target `vehicle`, grid drawn | on, target `vehicle`, grid drawn |
|
| Motion detection | on, target `vehicle`, grid drawn | on, target `vehicle`, grid drawn |
|
||||||
| Alarm server (`httpHosts`) | the dev machine `10.0.10.203:3000` (user, 2026-11-19) | the dev machine `10.0.10.203:3000` (user, 2026-11-19) |
|
| Alarm server (`httpHosts`) | the dev machine `10.0.10.203:3000` (user, 2026-11-19) | the dev machine `10.0.10.203:3000` (user, 2026-11-19) |
|
||||||
@@ -203,6 +203,11 @@ signal.*
|
|||||||
|
|
||||||
### Phase-1 order (user, 2026-11-19)
|
### Phase-1 order (user, 2026-11-19)
|
||||||
|
|
||||||
|
> **Superseded (user, 2026-11-23).** The PoC as it ran on 2026-11-22 met the user's requirements
|
||||||
|
> and is the reference for building this into the parking system: the zone flow, the relay rules
|
||||||
|
> and the live close, as decided on 2026-11-22 below. The staged order in this section and the
|
||||||
|
> "Phase-1 shape" after it are kept as history and no longer bind the work.
|
||||||
|
|
||||||
The audit record comes first, because it actuates nothing: no relay, no interlock, no safety
|
The audit record comes first, because it actuates nothing: no relay, no interlock, no safety
|
||||||
review.
|
review.
|
||||||
|
|
||||||
@@ -353,6 +358,24 @@ build had to pick a default for each; they are listed on [[zone-anpr-poc]]:
|
|||||||
the check is not atomic. It does not replace the series interlock, which stays a precondition
|
the check is not atomic. It does not replace the series interlock, which stays a precondition
|
||||||
for a live R2.
|
for a live R2.
|
||||||
|
|
||||||
|
## Where the video work lives (user, 2026-11-23)
|
||||||
|
|
||||||
|
Decided by the user, and now part of a refactor of the whole repository:
|
||||||
|
[[event-driven-refactor]] has the full list, what is not decided, and what it touches in the code.
|
||||||
|
|
||||||
|
- **The server holds no video or image work.** The vision side talks to the cameras, decodes
|
||||||
|
whatever they send, and produces what the rest needs.
|
||||||
|
- **The server is agnostic about the camera side.** A camera's signal is one way in among
|
||||||
|
several; without it an RF card, a barcode or a push-button ticket does the job. The server does
|
||||||
|
nothing special when a camera is blind or dead. For this page that keeps the rule "no signal,
|
||||||
|
no close".
|
||||||
|
- **A bus connects the vision side, the server and the booth screen.** How the booth gets its
|
||||||
|
picture and how the vision side gets the camera logins settle with the user's guidelines.
|
||||||
|
- **Tried the same day:** the PoC decoding H.264 sub-streams costs the same CPU as MJPEG and an
|
||||||
|
eighth of the network ([[zone-anpr-poc]], "H.264 instead of MJPEG").
|
||||||
|
- Today the server still holds the live-view stream, pulls and re-encodes the stills, and reads
|
||||||
|
picture sizes ([[camera-live-view]], `apps/server/src/snapshot.ts`). Nothing has been moved.
|
||||||
|
|
||||||
## Open questions
|
## Open questions
|
||||||
|
|
||||||
- **Hardening the vision side** after the field trials: the work list, deferred on 2026-11-22, is
|
- **Hardening the vision side** after the field trials: the work list, deferred on 2026-11-22, is
|
||||||
|
|||||||
@@ -2,7 +2,7 @@
|
|||||||
type: concept
|
type: concept
|
||||||
tags: [parking, vision, anpr, passage, night, glare, hardening, poc, park-lab]
|
tags: [parking, vision, anpr, passage, night, glare, hardening, poc, park-lab]
|
||||||
sources: []
|
sources: []
|
||||||
updated: 2026-11-22
|
updated: 2026-11-23
|
||||||
---
|
---
|
||||||
|
|
||||||
# Vision hardening — what the zone PoC left open
|
# Vision hardening — what the zone PoC left open
|
||||||
@@ -25,6 +25,8 @@ Evidence for every item is on [[zone-anpr-poc]] (flow, relays, live closes) and
|
|||||||
- **The user's reading (2026-11-22):** the wet lens is the culprit and the weather cannot be
|
- **The user's reading (2026-11-22):** the wet lens is the culprit and the weather cannot be
|
||||||
fixed. park-lab is also the worst case there is: one lane for both directions, and a boom that
|
fixed. park-lab is also the worst case there is: one lane for both directions, and a boom that
|
||||||
crosses the exit camera's picture.
|
crosses the exit camera's picture.
|
||||||
|
- **Again on 2026-11-23 (user):** bad weather during the staff's morning traffic; the cameras are
|
||||||
|
outdoors and the weather cannot be fixed ([[zone-anpr-poc]], "Staff traffic").
|
||||||
|
|
||||||
## The picture itself (camera side)
|
## The picture itself (camera side)
|
||||||
|
|
||||||
@@ -50,6 +52,9 @@ Nothing in the software removes flare from a wet lens. None of these has been tr
|
|||||||
wide, against 81–99% for the glare boxes, so size alone will not separate them.
|
wide, against 81–99% for the glare boxes, so size alone will not separate them.
|
||||||
- **To try:** a visit starts only on a box that has held for a few looks; a box that touches
|
- **To try:** a visit starts only on a box that has held for a few looks; a box that touches
|
||||||
both the left and the right edge of the picture is not a car.
|
both the left and the right edge of the picture is not a car.
|
||||||
|
- By day too (2026-11-23, 09:01 UTC, exit camera): a box 824 px wide and 703 of 720 px high
|
||||||
|
over the grey mass in front of the lens, with a car's rear at its edge. It touches the left
|
||||||
|
edge only, so the both-edges rule would not catch it.
|
||||||
2. **The followed car goes unmatched more often at night.** The detector held its 5 looks a second
|
2. **The followed car goes unmatched more often at night.** The detector held its 5 looks a second
|
||||||
throughout (`metrics.jsonl`), but in several night visits the car was matched in only 3.1–4.1 of
|
throughout (`metrics.jsonl`), but in several night visits the car was matched in only 3.1–4.1 of
|
||||||
them. Each miss is a look in which the car's side is not known. Not investigated.
|
them. Each miss is a look in which the car's side is not known. Not investigated.
|
||||||
@@ -97,6 +102,20 @@ Nothing in the software removes flare from a wet lens. None of these has been tr
|
|||||||
11. **No format rule (user, 2026-11-21).** Items 5–8 are checks on the picture. A rule about what
|
11. **No format rule (user, 2026-11-21).** Items 5–8 are checks on the picture. A rule about what
|
||||||
a plate looks like stays out.
|
a plate looks like stays out.
|
||||||
|
|
||||||
|
**Added 2026-11-23:** the camera's on-screen label is read as a plate. The entry camera prints
|
||||||
|
"Hyrje" into the picture, bottom right, where a car's bumper stands when it is at the line. The
|
||||||
|
plate reader takes it for a plate (`HUIJE`), in video frames and in stills, and on 2026-11-23 one
|
||||||
|
still was sure enough to vote ([[zone-anpr-poc]], "H.264 instead of MJPEG"). **To try:** take the
|
||||||
|
label and the clock out of the picture in the camera's settings, or keep a plate box that falls on
|
||||||
|
a printed overlay from voting.
|
||||||
|
|
||||||
|
- **Done by the user (2026-11-23):** the labels "Hyrje" and "Dalje" now sit in the top-right
|
||||||
|
corner of both cameras' pictures, in the video and in the hi-res still, away from the zone and
|
||||||
|
from where a car stands. A tall vehicle reached it the same morning: an off-roader's box rose
|
||||||
|
to y = 37 of 720 with the label inside it (08:53 UTC). The label was not read then, nor in any
|
||||||
|
other of the staff's eight visits. That is one vehicle, so the overlay check stays on the
|
||||||
|
list.
|
||||||
|
|
||||||
## Flow and the close
|
## Flow and the close
|
||||||
|
|
||||||
12. **A car the detector loses inside the zone.** The code's default gives `unclear` and no close.
|
12. **A car the detector loses inside the zone.** The code's default gives `unclear` and no close.
|
||||||
@@ -164,10 +183,15 @@ Nothing in the software removes flare from a wet lens. None of these has been tr
|
|||||||
on park-lab.
|
on park-lab.
|
||||||
- **On park-lab:** container `zg2`, page on port 8094, files in `~/zone-anpr-gpu`. **It is stopped
|
- **On park-lab:** container `zg2`, page on port 8094, files in `~/zone-anpr-gpu`. **It is stopped
|
||||||
since the evening of 2026-11-22** (user: the barrier is operated only with the staff's remote
|
since the evening of 2026-11-22** (user: the barrier is operated only with the staff's remote
|
||||||
control until the system is ready to control it). `docker start zg2` brings it back with the
|
control until the system is ready to control it). `docker start zg2` brings it back with
|
||||||
committed `zone_anpr.py`, `close_live` and `close_on_lost` on, and the relays disarmed. Do not
|
`close_live` and `close_on_lost` on, and the relays disarmed. Do not start it during business
|
||||||
start it during business hours without the user's word. Earlier versions are kept beside it as
|
hours without the user's word. Earlier versions are kept beside it as
|
||||||
`zone_anpr.py.bak-20261122-*`.
|
`zone_anpr.py.bak-20261122-*`.
|
||||||
|
- **Since 2026-11-23** the `zone_anpr.py` on park-lab also has the live picture of the H.264
|
||||||
|
test ([[zone-anpr-poc]]); the version before it is `zone_anpr.py.bak-20261123-prelive`. The
|
||||||
|
test runs as container `zg-h264`, which has no relay board configured, on the same port 8094,
|
||||||
|
so `zg2` and `zg-h264` cannot run together. The user left `zg-h264` running on 2026-11-23
|
||||||
|
(harmless: no relay armed or configured).
|
||||||
- **Records there:** `out/visits.jsonl`, `out/relays.jsonl`, `out/reads.jsonl`,
|
- **Records there:** `out/visits.jsonl`, `out/relays.jsonl`, `out/reads.jsonl`,
|
||||||
`out/reads-all.jsonl`, and per visit `out/clips/<start>_<camera>/` with every processed frame,
|
`out/reads-all.jsonl`, and per visit `out/clips/<start>_<camera>/` with every processed frame,
|
||||||
its box, and the kept stills with their reads.
|
its box, and the kept stills with their reads.
|
||||||
|
|||||||
@@ -2,7 +2,7 @@
|
|||||||
type: concept
|
type: concept
|
||||||
tags: [parking, vision, anpr, passage, relay, poc, park-lab, review]
|
tags: [parking, vision, anpr, passage, relay, poc, park-lab, review]
|
||||||
sources: []
|
sources: []
|
||||||
updated: 2026-11-22
|
updated: 2026-11-23
|
||||||
---
|
---
|
||||||
|
|
||||||
# Zone ANPR PoC — code review (2026-11-21)
|
# Zone ANPR PoC — code review (2026-11-21)
|
||||||
@@ -170,7 +170,7 @@ The PoC was changed three times on 2026-11-22 ([[zone-anpr-poc]], "The 2026-11-2
|
|||||||
| 7–9 lane lock | open |
|
| 7–9 lane lock | open |
|
||||||
| 10–12 liveness and timing | open, except that a close needs a frame under 1 s old |
|
| 10–12 liveness and timing | open, except that a close needs a frame under 1 s old |
|
||||||
| 13 the still client dies for good | fixed: a new client for every still |
|
| 13 the still client dies for good | fixed: a new client for every still |
|
||||||
| 14 the back-off carries over to the next car | open |
|
| 14 the back-off carries over to the next car | open; seen live on 2026-11-23 (an 8 s pause from timeouts twenty minutes earlier) |
|
||||||
| 15 stills back to back with no cap | fixed: at most one every 0.5 s, capped while the car stands |
|
| 15 stills back to back with no cap | fixed: at most one every 0.5 s, capped while the car stands |
|
||||||
| 16 cause of the still hangs | open; still seen, by day and by night |
|
| 16 cause of the still hangs | open; still seen, by day and by night |
|
||||||
| One frame at the end decides the verdict (found by reading, not replayed then) | seen for real on 2026-11-22 night; fixed: a side counts after two looks |
|
| One frame at the end decides the verdict (found by reading, not replayed then) | seen for real on 2026-11-22 night; fixed: a side counts after two looks |
|
||||||
|
|||||||
@@ -2,7 +2,7 @@
|
|||||||
type: concept
|
type: concept
|
||||||
tags: [parking, vision, anpr, passage, relay, poc, park-lab]
|
tags: [parking, vision, anpr, passage, relay, poc, park-lab]
|
||||||
sources: []
|
sources: []
|
||||||
updated: 2026-11-22
|
updated: 2026-11-23
|
||||||
---
|
---
|
||||||
|
|
||||||
# Zone ANPR PoC — field trials on park-lab
|
# Zone ANPR PoC — field trials on park-lab
|
||||||
@@ -20,6 +20,11 @@ deferred to a later session, and the work list is on [[vision-hardening]].
|
|||||||
off beforehand. The user's rule for now: *the barrier is operated only with the staff's remote
|
off beforehand. The user's rule for now: *the barrier is operated only with the staff's remote
|
||||||
control; our system is not ready to control the barrier yet.*
|
control; our system is not ready to control the barrier yet.*
|
||||||
|
|
||||||
|
**Back for one test (user, 2026-11-23):** a copy with **no relay board configured** (container
|
||||||
|
`zg-h264`) runs on H.264 sub-streams, to see what decoding costs. `zg2` stays stopped. See
|
||||||
|
"H.264 instead of MJPEG" below. **Left running (user, 2026-11-23):** in this state it is
|
||||||
|
harmless, no relay is armed or configured. The cameras' sub-streams stay on H.264 with it.
|
||||||
|
|
||||||
- **Seeing the car:**
|
- **Seeing the car:**
|
||||||
- the **low-res MJPEG stream** (1280×720), about 5 frames a second through YOLOX-Tiny on the Intel
|
- the **low-res MJPEG stream** (1280×720), about 5 frames a second through YOLOX-Tiny on the Intel
|
||||||
iGPU;
|
iGPU;
|
||||||
@@ -362,6 +367,179 @@ it's open."*
|
|||||||
as A → B and drive-outs as "other direction". The exit camera is not used for crossing
|
as A → B and drive-outs as "other direction". The exit camera is not used for crossing
|
||||||
verdicts. Whether it still opens R1 or reads plates for drive-outs is not yet decided.
|
verdicts. Whether it still opens R1 or reads plates for drive-outs is not yet decided.
|
||||||
|
|
||||||
|
## H.264 instead of MJPEG (2026-11-23)
|
||||||
|
|
||||||
|
**Why (user).** The server should hold no video or image work. MJPEG let it pass frames along
|
||||||
|
undecoded, which locks the system to cameras that offer MJPEG. A camera that streams only H.264
|
||||||
|
or H.265 has to be decoded somewhere, and that place is the vision side. The test: switch the
|
||||||
|
sub-streams to H.264, decode them in the PoC, show a live picture on its page, and watch the
|
||||||
|
booth PC's load.
|
||||||
|
|
||||||
|
**Set-up.**
|
||||||
|
|
||||||
|
- Container `zg-h264` on park-lab: the same image and code, `config-h264test.json`, records in
|
||||||
|
`out-h264test/`, page on port 8094. Its config names **no relay board** and it has no relay
|
||||||
|
password, so its arm button has nothing to send to. Restart policy `no`.
|
||||||
|
- The PoC gained a **live picture** for the page (`/live/<camera>.mjpg`): every decoded frame is
|
||||||
|
re-encoded as a JPEG once, for all viewers, and only while somebody watches. Before, the page
|
||||||
|
fetched a still every 700 ms. The metrics gained the codec, the network intake, the viewers and
|
||||||
|
the time from connecting to the first picture.
|
||||||
|
- Decoding is in software (FFmpeg inside OpenCV 4.13), RTSP over TCP, with FFmpeg's `nobuffer`
|
||||||
|
and `low_delay` set. The detector stays on the iGPU.
|
||||||
|
- **Camera change:** channel 102 on both cameras went from MJPEG to **H.264** (Main profile), with
|
||||||
|
a keyframe about every second (GOP 12 on the entry camera, 20 on the exit camera). Resolution,
|
||||||
|
frame rate and the 1024 kbps VBR cap were left as they were. The settings from before are saved
|
||||||
|
on park-lab as `~/zone-anpr-gpu/h264test/cam6-102-before.xml` and `cam7-102-before.xml`; a PUT
|
||||||
|
of those files puts MJPEG back.
|
||||||
|
|
||||||
|
**Measured** (21 ten-second windows each, empty lane, one viewer on each camera's live picture):
|
||||||
|
|
||||||
|
| | MJPEG | H.264 |
|
||||||
|
|---|---|---|
|
||||||
|
| Process CPU, of 6 cores | 0.40 | 0.41 |
|
||||||
|
| Host busy | 8.0% | 7.8% |
|
||||||
|
| Memory | 309 MB | 372 MB |
|
||||||
|
| Network intake | 15.2 Mbps | 1.85 Mbps |
|
||||||
|
| Frames in and decoded a second (entry + exit) | 12.5 + 20 | 12.5 + 20 |
|
||||||
|
| Live frames a second to the viewer | 12.5 + 20 | 12.5 + 20 |
|
||||||
|
| Detector, ms a look | 21 | 32 |
|
||||||
|
| First picture after connecting (entry, exit), one connect each | 1.8 s, 2.9 s | 3.6 s, 2.6 s |
|
||||||
|
|
||||||
|
- **The codec makes no difference to the CPU.** The network intake falls to an eighth.
|
||||||
|
- The earlier figure of 6–7% CPU was also taken with every MJPEG frame decoded (mode `stream`),
|
||||||
|
not only the frames looked at.
|
||||||
|
- Eight H.264 decode errors were logged in the second the exit stream first connected
|
||||||
|
(06:47:55 UTC), and none in the five minutes after. No stream loss after the switch.
|
||||||
|
- **The user, watching the page during the MJPEG run (2026-11-23):** "7%–8% CPU load. Not
|
||||||
|
bad." The user has not yet commented on the H.264 numbers.
|
||||||
|
|
||||||
|
**Delay from the camera to the live picture** (2026-11-23). Measured as on [[camera-live-view]]:
|
||||||
|
the camera's printed clock against the arrival of the live picture's JPEG, here at a viewer on
|
||||||
|
the booth PC itself, with each camera's clock bracketed over ISAPI to ±6–14 ms. 65–75 second
|
||||||
|
flips per camera; the minute flip agrees, so the figures are not off by whole seconds.
|
||||||
|
|
||||||
|
| | Entry (12.5 fps) | Exit (20 fps) |
|
||||||
|
|---|---|---|
|
||||||
|
| MJPEG straight from the camera (2026-11-17) | 0.09–0.10 s | 0.09–0.10 s |
|
||||||
|
| H.264, decoder on its default threads | 0.51–0.61 s | 0.39–0.43 s |
|
||||||
|
| H.264, **one decode thread** | 0.12–0.24 s | 0.18 s |
|
||||||
|
|
||||||
|
- **Cause of the first figure:** FFmpeg decodes H.264 on several threads by default, and each
|
||||||
|
extra thread holds one more frame back. On the 6-core booth PC that is 5 frames: 0.40 s at
|
||||||
|
12.5 fps, 0.25 s at 20 fps, which is the drop measured. The `low_delay` capture option did
|
||||||
|
not prevent it.
|
||||||
|
- **Fix in the PoC:** config key `decode_threads` (passed to OpenCV as `CAP_PROP_N_THREADS`);
|
||||||
|
the test copy runs with 1.
|
||||||
|
- With one decode thread and nobody watching the process used 0.27 cores and 328 MB, with no
|
||||||
|
decode error and the detector still at 5 looks a second.
|
||||||
|
- What is left, about 0.1 s over MJPEG, covers the camera's H.264 encoder, the decode and the
|
||||||
|
re-encode. A browser elsewhere adds its network and drawing time, which this does not include.
|
||||||
|
|
||||||
|
**The user's readings on the booth PC (2026-11-23, H.264, default decode threads):**
|
||||||
|
|
||||||
|
| | CPU | Download | Upload |
|
||||||
|
|---|---|---|---|
|
||||||
|
| Watching both pictures | 7–8% | 1.3 Mibps | 19.5 Mibps |
|
||||||
|
| Nobody watching | 5–6% | 1.1 Mibps | 400 Kibps |
|
||||||
|
|
||||||
|
Memory is steady either way. The upload is the live picture going to the browser as JPEGs
|
||||||
|
(about 107 KB a frame from the entry camera and 63–67 KB from the exit camera).
|
||||||
|
|
||||||
|
**A car in the zone** (2026-11-23, 07:32–07:33 UTC, AA927AU, H.264 with one decode thread; the
|
||||||
|
barrier was not driven, the relay lines are "would pulse" records). Read from the frames; the
|
||||||
|
user has not yet said what was driven.
|
||||||
|
|
||||||
|
| Start (UTC) | What the frames show | Verdict | Plate |
|
||||||
|
|---|---|---|---|
|
||||||
|
| 07:32:23 | drove up, stood 17 s short of the line, backed out | `abandoned`, would close | `AA927AU` decided after 0.34 s: 2 video frames and 1 still |
|
||||||
|
| 07:32:54 | drove up further, stood 4 s, backed out | `abandoned`, would close | undecided: `AA927AU` 2 votes, `HUIJE` 1 vote |
|
||||||
|
|
||||||
|
- **The flow judged both as the frames show them.** The followed car was matched in 5.0 looks a
|
||||||
|
second in both visits.
|
||||||
|
- **Video frames read the plate as well as before.** With the plate 65–90 px wide, 4 of 4 reads
|
||||||
|
were right and sure, the same as in the MJPEG day trial of 2026-11-22 (4 of 4). The sample is
|
||||||
|
small.
|
||||||
|
- **The camera's on-screen label was read as a plate.** In the second visit the car stood with
|
||||||
|
its bumper under the label "Hyrje" that the camera prints into the picture, and its own plate
|
||||||
|
was edge-on. 21 video frames and 3 stills then read the label (`HUIJE`, `HU1JE`, `HUIJB`), and
|
||||||
|
one still was sure enough (0.986) to vote. This is not an H.264 effect: 30 such reads are in
|
||||||
|
the records of 2026-11-20 to 22, none of them sure enough to vote until today. Now on
|
||||||
|
[[vision-hardening]]. The user moved both labels to the top-right corner the same day.
|
||||||
|
- **Load with the car in the zone:** 0.36–0.42 cores while it stood, and 0.84 cores (15% of the
|
||||||
|
host) for the ten seconds with 33 plate reads; memory rose from 329 to 512 MB and fell back to
|
||||||
|
441 MB. The detector kept 5 looks a second at 25–31 ms.
|
||||||
|
- **Two stills timed out** in the second visit (2 s and 4 s pauses), as on the earlier days. No
|
||||||
|
decode error and no stream loss.
|
||||||
|
|
||||||
|
**Staff traffic** (2026-11-23, 07:52–09:11 UTC, the same test copy). The user: the staff drove,
|
||||||
|
not the user. Nobody said what each vehicle did, so the column "What the frames show" is a
|
||||||
|
reading of the recorded frames, and these visits are not part of the scored set in
|
||||||
|
`recordings/`. The barrier was not driven: all 13 rows in `relays.jsonl` have `sent: false`.
|
||||||
|
|
||||||
|
| Start (UTC) | Camera | What the frames show | Seen | Verdict | Plate |
|
||||||
|
|---|---|---|---|---|---|
|
||||||
|
| 07:52:53 | entry | a dark car drives in without stopping | 0.6 s | `passed` | none: 1 video read at 52 px (weak), the one still timed out |
|
||||||
|
| 08:00:43 | exit | the same model of car, front to the camera, behind a blur that covers most of the picture | 0.4 s | `abandoned`, lost | undecided: `AB242TD`, 1 vote from a still (0.96); 3 video reads at 49–55 px |
|
||||||
|
| 08:28:36 | exit | a dark SUV moves out of sight behind a grey mass that fills the left half of the picture | 1.2 s | `abandoned`, lost | none: 3 stills, no plate found |
|
||||||
|
| 08:33:29 | entry | a black SUV stands 20 s short of the line, then five people push it through, rear first | 26.8 s | `passed` | none: 11 stills, no plate found; 4 stills timed out |
|
||||||
|
| 08:53:16 | entry | a white off-roader drives in without stopping | 2.2 s | `passed` | none: 2 video reads at 41–44 px (weak), 1 still read weak (0.61) with the plate at the crop's edge, 1 still timed out |
|
||||||
|
| 09:01:24 | exit | the white off-roader's rear at the edge of the grey mass | 0.2 s | `abandoned` | none |
|
||||||
|
| 09:09:44 | exit | a dark hatchback stands 62 s in the zone, then moves back, away from the camera | 63.3 s | `abandoned` | none: 91 video tries, 5 weak reads; 2 weak still reads |
|
||||||
|
| 09:11:04 | exit | not looked at | 0.6 s | `abandoned`, lost | none |
|
||||||
|
|
||||||
|
- **Bad weather (user, 2026-11-23).** The cameras are outdoors and the weather cannot be
|
||||||
|
fixed. The lane is wet in every clip of that morning. The soft plates and the blur in the exit
|
||||||
|
camera's picture have to be read with that in mind; how much of them is the weather was not
|
||||||
|
separated from the rest.
|
||||||
|
- **Entry camera: 3 of 3 `passed`,** which is what the frames show, and no close would have gone
|
||||||
|
out. The pushed car was followed for 27 s at 5 looks a second with five people around it.
|
||||||
|
- **Exit camera: not scored.** It is out for verdicts (see "The exit camera is
|
||||||
|
out"). Each of its five visits would have pulsed the open relay.
|
||||||
|
- **No plate was decided in eight visits. The records do not show that H.264 is the cause, and
|
||||||
|
they do not rule it out:**
|
||||||
|
- in the two drive-ins the plate was 41–52 px wide in the video frames at the moment the visit
|
||||||
|
started, under the 64 px gate, so those reads could not vote on MJPEG either (item 4 on
|
||||||
|
[[vision-hardening]]: the plate has to be read before the visit starts);
|
||||||
|
- on the MJPEG days (2026-11-21 and 22) the entry camera's video reads under 65 px were sure
|
||||||
|
(≥ 0.90) in 10 of 120; today in 3 of 17. At 65–90 px: 6 of 36 on MJPEG, 4 of 4 today, all
|
||||||
|
four from the user's own drive;
|
||||||
|
- the exit camera's five video reads at 82–88 px (09:10:46–47) scored 0.11–0.21. In those
|
||||||
|
frames the plate is too soft to read by eye. On the MJPEG days the exit camera's reads at
|
||||||
|
that width were sure in 2 of 7.
|
||||||
|
- The sample is too thin for a comparison. A drive with a known plate is still needed.
|
||||||
|
- **The blur and the grey mass in the exit camera's picture are not decoding faults.** The blur
|
||||||
|
of 08:00 is in the hi-res still as well, which does not come from the H.264 stream. What they
|
||||||
|
are was not established from the frames ([[vision-hardening]] records that the boom crosses
|
||||||
|
this camera's picture).
|
||||||
|
- **A vehicle's box reached the moved label, and it was not read.** The off-roader's box rose to
|
||||||
|
y = 37 of 720 at the right edge (08:53:19), with the label "Hyrje" inside it. No read of the
|
||||||
|
label is in the records of any of the eight visits.
|
||||||
|
- **Still timeouts on the entry camera:** 8 in 28 tries today (the user's drive included),
|
||||||
|
against 9 in 67 on 2026-11-22 by day. Cause not known. One on the exit camera.
|
||||||
|
- **The pause carried over to the next car** (finding 14 on [[zone-anpr-poc-review]], seen
|
||||||
|
live): the fail count is reset only by a still that succeeds, so the timeout at 07:52:54
|
||||||
|
drew an 8 s pause after the two of 07:32–07:33, twenty minutes earlier.
|
||||||
|
- **The stream held:** 12.5 and 20 frames a second in every ten-second window from 07:34 to
|
||||||
|
09:14 UTC, no decode error, no reconnect.
|
||||||
|
- **Load:** 0.27 cores with an empty lane; 0.77–0.90 cores (13–15% of the host) in the windows
|
||||||
|
with a standing vehicle being read. Memory went from 329 to 497 MB over the morning in steps,
|
||||||
|
one at each visit. The MJPEG run of 2026-11-22 did the same (296 MB after a start, 448–535 MB
|
||||||
|
after visits, peaks of 0.9–1.05 cores), so neither is an H.264 effect.
|
||||||
|
|
||||||
|
**Not measured.**
|
||||||
|
|
||||||
|
- Plate reading from H.264 frames at night, and by day with a known plate on a car that drives
|
||||||
|
through (the staff's drive-ins gave no usable comparison). The user (2026-11-23): this will be
|
||||||
|
handled as work of its own; it does not hold up moving the video work to the vision side
|
||||||
|
([[event-driven-refactor]]).
|
||||||
|
- Why the detector's time rose from 21 to about 30 ms a look. It still made its 5 looks a second
|
||||||
|
on both cameras in every run.
|
||||||
|
|
||||||
|
**Side effect, as long as 102 stays on H.264.** The parking server's booth camera tiles
|
||||||
|
([[camera-live-view]]) take MJPEG only (`packages/devices/src/drivers/rtsp-mjpeg.ts` refuses any
|
||||||
|
other codec), so they show no live video for these two cameras, on park-lab and on the dev
|
||||||
|
machine.
|
||||||
|
|
||||||
## Still open
|
## Still open
|
||||||
|
|
||||||
Deferred by the user on 2026-11-22. The work list, with the evidence for each item, is on
|
Deferred by the user on 2026-11-22. The work list, with the evidence for each item, is on
|
||||||
|
|||||||
@@ -2,7 +2,7 @@
|
|||||||
type: decision
|
type: decision
|
||||||
tags: [parking, camera, ui, booth, video, hikvision]
|
tags: [parking, camera, ui, booth, video, hikvision]
|
||||||
sources: []
|
sources: []
|
||||||
updated: 2026-11-17
|
updated: 2026-11-23
|
||||||
status: settled
|
status: settled
|
||||||
---
|
---
|
||||||
|
|
||||||
@@ -13,6 +13,10 @@ footer]] and watch that camera live while a vehicle is in front of it. **BUILT 2
|
|||||||
verified end to end against the two park-lab cameras through the real server and in a browser
|
verified end to end against the two park-lab cameras through the real server and in a browser
|
||||||
(not yet in the [[desktop-shell-tauri|desktop shell]] — see *Not yet verified*).
|
(not yet in the [[desktop-shell-tauri|desktop shell]] — see *Not yet verified*).
|
||||||
|
|
||||||
|
> **2026-11-23:** the user decided that the server holds no video or image work
|
||||||
|
> ([[event-driven-refactor]]). The live picture is to come from the vision side; how the booth
|
||||||
|
> screen gets it is not decided. This page describes what is built and running.
|
||||||
|
|
||||||
## What the user asked for (2026-11-17)
|
## What the user asked for (2026-11-17)
|
||||||
|
|
||||||
- The camera chips in the footer are clickable; a click opens that camera's tile in the bottom
|
- The camera chips in the footer are clickable; a click opens that camera's tile in the bottom
|
||||||
@@ -114,6 +118,12 @@ agreement.
|
|||||||
`camera-activity` on `/api/ws`; two viewers on the entry camera and one on the exit camera went
|
`camera-activity` on `/api/ws`; two viewers on the entry camera and one on the exit camera went
|
||||||
`connecting → live` in 151 / 181 ms, 8–10 fps each, zero malformed JPEGs.
|
`connecting → live` in 151 / 181 ms, 8–10 fps each, zero malformed JPEGs.
|
||||||
|
|
||||||
|
> **2026-11-23:** channel 102 on both park-lab cameras is on **H.264** for a decoding test
|
||||||
|
> ([[zone-anpr-poc]], "H.264 instead of MJPEG"). The tiles take MJPEG only, so they show no
|
||||||
|
> live video for these cameras until 102 is put back or the live picture moves to the vision
|
||||||
|
> side ([[passage-confirmation]], "Where the video work lives").
|
||||||
|
|
||||||
|
|
||||||
## Install step (new)
|
## Install step (new)
|
||||||
|
|
||||||
Set the camera's **sub-stream (102) video encoding to MJPEG** (web UI: Configuration → Video/Audio
|
Set the camera's **sub-stream (102) video encoding to MJPEG** (web UI: Configuration → Video/Audio
|
||||||
|
|||||||
@@ -2,7 +2,7 @@
|
|||||||
type: decision
|
type: decision
|
||||||
tags: [parking, decision, devices, transport]
|
tags: [parking, decision, devices, transport]
|
||||||
sources: []
|
sources: []
|
||||||
updated: 2026-06-15
|
updated: 2026-11-23
|
||||||
status: settled
|
status: settled
|
||||||
---
|
---
|
||||||
|
|
||||||
@@ -44,3 +44,11 @@ If the system grows to **many lanes / many controllers**, or multiple subsystems
|
|||||||
signage) all need to share events, a broker becomes a worthwhile central event bus. That aligns
|
signage) all need to share events, a broker becomes a worthwhile central event bus. That aligns
|
||||||
with the [[autonomous-direction|unmanned]] roadmap at multi-lane scale — re-evaluate then. Until
|
with the [[autonomous-direction|unmanned]] roadmap at multi-lane scale — re-evaluate then. Until
|
||||||
then, direct HTTP/UDP wins on simplicity and reliability.
|
then, direct HTTP/UDP wins on simplicity and reliability.
|
||||||
|
|
||||||
|
## The condition is met (2026-11-23)
|
||||||
|
|
||||||
|
The user decided a bus between the vision side, the server and the booth screen, as part of an
|
||||||
|
event-driven refactor of the repository ([[event-driven-refactor]]). That is the case named
|
||||||
|
above: several subsystems sharing events. Which bus is not decided, and nothing here says the
|
||||||
|
relay controller moves onto it. The objections above (new infrastructure on the appliance, one
|
||||||
|
more thing on the path that opens the barrier) still want an answer in that plan.
|
||||||
|
|||||||
@@ -0,0 +1,107 @@
|
|||||||
|
---
|
||||||
|
type: decision
|
||||||
|
tags: [parking, decisions, architecture, event-driven, vision, camera, bus, refactor]
|
||||||
|
sources: []
|
||||||
|
updated: 2026-11-23
|
||||||
|
status: open
|
||||||
|
---
|
||||||
|
|
||||||
|
# Event-driven refactor of the repository
|
||||||
|
|
||||||
|
**Decided by the user on 2026-11-23: this repository is to be refactored as a whole, following an
|
||||||
|
event-driven pattern.** The user will provide the instructions and a guidelines document.
|
||||||
|
**Nothing is designed or built until that document arrives.** This page holds what is decided,
|
||||||
|
what is not, and what the decisions touch in the code as it stands.
|
||||||
|
|
||||||
|
How it came up: the discussion on bringing the ideas of the [[zone-anpr-poc]] into the product
|
||||||
|
([[passage-confirmation]]), and the H.264 decoding test of the same day.
|
||||||
|
|
||||||
|
## Decided (user, 2026-11-23)
|
||||||
|
|
||||||
|
1. **The repository is refactored as a whole, event-driven.** The shape comes from the user's
|
||||||
|
guidelines.
|
||||||
|
2. **A bus connects the vision side, the server and the booth screen.** Its details settle with
|
||||||
|
the guidelines.
|
||||||
|
3. **The server holds no video or image work.** Using MJPEG locked the system to cameras that
|
||||||
|
offer it; another vendor's stream has to be decoded into a usable form, and the server is not
|
||||||
|
the place for that. The vision side talks to the cameras, decodes whatever they send, and
|
||||||
|
produces what the rest needs.
|
||||||
|
4. **The server is agnostic about the camera side.** A signal from a camera is one way in among
|
||||||
|
several. If it comes, good. If it does not, an RF card, a barcode or a push-button ticket does
|
||||||
|
the job. The user's examples: a car with no plate at all; a leaf, a piece of cardboard or a
|
||||||
|
plastic bag in front of the lens; a camera that dies. The server does nothing special in any
|
||||||
|
of them. Where a missing camera or radar signal blocks a ticket, the admin bypass unblocks it
|
||||||
|
([[entry-presence-bypass]]). The monitoring already in place shows that a service or a device is down
|
||||||
|
([[device-status-monitoring]]), and the operator raises the issue.
|
||||||
|
5. **Services that die together are an accepted concession,** and a watchdog service takes care
|
||||||
|
of crashed services. Not designed.
|
||||||
|
6. **Plate reading from H.264 frames is work to be done,** and does not hold up this direction.
|
||||||
|
The morning's records neither blame nor clear H.264 ([[zone-anpr-poc]], "Staff traffic").
|
||||||
|
7. **Watching the live picture from outside the booth's network is out of scope for now.**
|
||||||
|
|
||||||
|
## Not decided
|
||||||
|
|
||||||
|
- **Which bus, and how it relates to the platform.** Suggested by the assistant and not
|
||||||
|
confirmed by the user: the buffered NATS leaf on the booth PC that the platform wiki describes
|
||||||
|
for syncing the ledger (`EDA/wiki/queries/q-parking-core-service-on-the-platform.md`, deferred
|
||||||
|
by the user on 2026-10-20) could also be this local bus.
|
||||||
|
- The events: their names, their contents, who publishes and who consumes.
|
||||||
|
- How the booth screen gets the live picture, and how the vision side gets the camera logins.
|
||||||
|
Both were left to this refactor.
|
||||||
|
- The watchdog.
|
||||||
|
- The order of the work, and what happens to the features that are built.
|
||||||
|
|
||||||
|
## What the decisions touch in today's code
|
||||||
|
|
||||||
|
| Today | Where |
|
||||||
|
|---|---|
|
||||||
|
| The server holds the live view: an RTSP client that takes MJPEG only, and a hub that serves the booth tiles | `apps/server/src/camera-live.ts`, `packages/devices/src/drivers/rtsp-mjpeg.ts`, `packages/devices/src/drivers/rfc2435.ts` ([[camera-live-view]]) |
|
||||||
|
| The server pulls stills from the cameras, re-encodes them and reads their size | `apps/server/src/snapshot.ts`, `packages/devices/src/drivers/camera.ts` |
|
||||||
|
| The plate bridge: on a camera's push the server pulls a still and posts it to the vision service | `apps/server/src/anpr-entry.ts`, `apps/server/src/vision-client.ts`, `apps/server/src/routes/hikvision-alarm.ts` ([[lane-presence-and-anpr-entry]]) |
|
||||||
|
| The vision service is stateless: it is handed pictures and never talks to a camera | `apps/vision/` ([[vision-service]], [[vision-service-packaging]]) |
|
||||||
|
| The server cuts and blurs the car-wash review picture | `apps/server/src/modules/carwash/review-outbox.ts` ([[vision-review-outbox]]) |
|
||||||
|
| The server stores and serves the evidence pictures of ledger events | `apps/server/src/routes/snapshots.ts` |
|
||||||
|
| Monitoring: the server probes each camera for reachability and the vision service's `/health`, and shows both in the booth footer | `apps/server/src/device-monitor.ts` ([[device-status-monitoring]]) |
|
||||||
|
|
||||||
|
The zone flow, the relay rules and the plate consensus exist only in the prototype
|
||||||
|
(`poc/zone-anpr/`), with their checks and recorded visits ([[vision-hardening]], "What carries
|
||||||
|
over").
|
||||||
|
|
||||||
|
## Where the decisions meet what is built
|
||||||
|
|
||||||
|
1. **The camera gates the entry button today. Settled (user, 2026-11-23): it stays, and the
|
||||||
|
bypass is the answer.** With an entry camera configured, a press on the button prints a
|
||||||
|
ticket only while that camera reports a vehicle (`apps/server/src/entry-flow.ts`,
|
||||||
|
[[entry-double-press]]), and the operator-issued entry needs the radar and the camera
|
||||||
|
([[operator-issued-entry]]). A camera that is dead or blinded stops the button ticket until
|
||||||
|
an admin sets the bypass ([[entry-presence-bypass]]). The user: that unblocking mechanism for
|
||||||
|
camera and radar events is in place.
|
||||||
|
- The signal behind that gate is the camera's own vehicle detection, pushed to the server
|
||||||
|
(`apps/server/src/routes/hikvision-alarm.ts`), not the vision service.
|
||||||
|
2. **A blinded camera shows as healthy. Settled (user, 2026-11-23): not the system's concern.**
|
||||||
|
The monitoring probes whether a camera answers, not whether it sees. A camera that is healthy
|
||||||
|
but blinded is an operational matter of the business.
|
||||||
|
3. **A broker was skipped on purpose in 2026-06 (open)** ([[dingtian-vs-mqtt]]): new infrastructure on
|
||||||
|
a single-purpose appliance, and one more thing on the path that opens the barrier. That page
|
||||||
|
named its own condition for looking again, several subsystems sharing events, and it is now
|
||||||
|
met. Its objections still want an answer in the plan.
|
||||||
|
4. **Evidence pictures (open).** A snapshot is written before the barrier pulse and attached to the
|
||||||
|
signed entry ([[standing-decisions]], "Bounded request cost"; [[append-only-event-chain]]).
|
||||||
|
Who takes it and who keeps it once the server holds no image work is open.
|
||||||
|
5. **[[vision-service]], decision 3,** has the Node backend call the vision service over
|
||||||
|
localhost HTTP with pictures the camera driver pulled. The refactor replaces that.
|
||||||
|
6. **The repository's `CLAUDE.md`** still describes the server as the home of the device
|
||||||
|
drivers. Left as it is until the guidelines arrive.
|
||||||
|
|
||||||
|
## What stays whatever the shape
|
||||||
|
|
||||||
|
From the repository's guide, and not put in question by the user: [[offline-first]], the signed
|
||||||
|
append-only ledger ([[append-only-event-chain]]), [[barrier-not-a-door]], [[fail-state-safety]],
|
||||||
|
and the licence rule of [[standing-decisions]].
|
||||||
|
|
||||||
|
## Evidence so far
|
||||||
|
|
||||||
|
The H.264 test on park-lab ([[zone-anpr-poc]], "H.264 instead of MJPEG"): the vision side
|
||||||
|
decoding H.264 sub-streams costs the same CPU as MJPEG and an eighth of the network; the live
|
||||||
|
picture arrives 0.12–0.24 s behind the camera with one decode thread; the stream held for a
|
||||||
|
morning with no decode error.
|
||||||
@@ -2,7 +2,7 @@
|
|||||||
type: decision
|
type: decision
|
||||||
tags: [parking, decisions, open]
|
tags: [parking, decisions, open]
|
||||||
sources: [parking-system-architecture]
|
sources: [parking-system-architecture]
|
||||||
updated: 2026-11-22
|
updated: 2026-11-23
|
||||||
status: open
|
status: open
|
||||||
---
|
---
|
||||||
|
|
||||||
@@ -196,6 +196,13 @@ procurement. (See [[parking-system-architecture]] §10.)
|
|||||||
detector did not hold on a wet night. Still undecided: what a car lost inside the zone does, and the bench tests of the
|
detector did not hold on a wet night. Still undecided: what a car lost inside the zone does, and the bench tests of the
|
||||||
barrier's own safety. The open work is on [[vision-hardening]], deferred.)_
|
barrier's own safety. The open work is on [[vision-hardening]], deferred.)_
|
||||||
|
|
||||||
|
21. **Event-driven refactor of the repository.** _(Decided by the user, 2026-11-23; the shape is
|
||||||
|
open.)_ The whole repository is to be refactored along an event-driven pattern, with a bus
|
||||||
|
between the vision side, the server and the booth screen, and no video or image work in the
|
||||||
|
server. Waiting for the user's instructions and guidelines document. Not decided: which bus
|
||||||
|
and its relation to the platform, the events, how the booth gets its picture, how the vision
|
||||||
|
side gets the camera logins, the watchdog. All on [[event-driven-refactor]].
|
||||||
|
|
||||||
## Cloud takeover mode vs. the signed ledger (2026-10-22, parked)
|
## Cloud takeover mode vs. the signed ledger (2026-10-22, parked)
|
||||||
|
|
||||||
If the cloud commands the barrier while the booth PC is dead ([[relay-proxy-firmware]]), entry/exit
|
If the cloud commands the barrier while the booth PC is dead ([[relay-proxy-firmware]]), entry/exit
|
||||||
|
|||||||
@@ -2,7 +2,7 @@
|
|||||||
type: decision
|
type: decision
|
||||||
tags: [parking, decisions]
|
tags: [parking, decisions]
|
||||||
sources: [parking-system-architecture]
|
sources: [parking-system-architecture]
|
||||||
updated: 2026-06-21
|
updated: 2026-11-23
|
||||||
status: settled
|
status: settled
|
||||||
---
|
---
|
||||||
|
|
||||||
@@ -45,6 +45,16 @@ The decisions treated as settled in the design notes. (See [[parking-system-arch
|
|||||||
|
|
||||||
Unsettled items live in [[open-questions]].
|
Unsettled items live in [[open-questions]].
|
||||||
|
|
||||||
|
## The server holds no video or image work; a camera is one signal among several (2026-11-23)
|
||||||
|
|
||||||
|
Decided by the user. The vision side talks to the cameras, decodes whatever they send, and
|
||||||
|
produces what the rest needs. The server is agnostic about the camera side: if a signal comes
|
||||||
|
from a camera, good; if not, an RF card, a barcode or a push-button ticket does the job, and the
|
||||||
|
server does nothing special when a camera is blind or dead. Monitoring shows what is down and
|
||||||
|
the operator raises the issue. A bus connects the vision side, the server and the booth screen.
|
||||||
|
This comes with a refactor of the whole repository along an event-driven pattern, whose shape
|
||||||
|
waits for the user's guidelines: [[event-driven-refactor]]. Not built.
|
||||||
|
|
||||||
## No custom firmware on the Dingtian relay (2026-10-23)
|
## No custom firmware on the Dingtian relay (2026-10-23)
|
||||||
|
|
||||||
The [[dingtian-relay]] stays stock. The vendor locks the standard SKU, the bench unit was never
|
The [[dingtian-relay]] stays stock. The vendor locks the standard SKU, the bench unit was never
|
||||||
|
|||||||
@@ -2,7 +2,7 @@
|
|||||||
type: decision
|
type: decision
|
||||||
tags: [parking, decisions, vision, anpr, anti-fraud]
|
tags: [parking, decisions, vision, anpr, anti-fraud]
|
||||||
sources: []
|
sources: []
|
||||||
updated: 2026-06-15
|
updated: 2026-11-23
|
||||||
status: open
|
status: open
|
||||||
---
|
---
|
||||||
|
|
||||||
@@ -10,6 +10,12 @@ status: open
|
|||||||
|
|
||||||
Taken 2026-06-15, as part of the business-layer build ([[session-model]]).
|
Taken 2026-06-15, as part of the business-layer build ([[session-model]]).
|
||||||
|
|
||||||
|
> **2026-11-23:** decision 3 below (the Node backend calls the service over localhost HTTP, with
|
||||||
|
> pictures the camera driver pulled) is to be replaced: the user decided that the server holds no
|
||||||
|
> video or image work and that the vision side talks to the cameras
|
||||||
|
> ([[event-driven-refactor]]). Not built; the page describes what runs today. The fallback to
|
||||||
|
> the ticket path when the service is unavailable stays as it is.
|
||||||
|
|
||||||
## Decisions
|
## Decisions
|
||||||
|
|
||||||
1. **Build a host-side vision service** ([[opencv-anpr-service]]) that does ANPR (plate → identity)
|
1. **Build a host-side vision service** ([[opencv-anpr-service]]) that does ANPR (plate → identity)
|
||||||
|
|||||||
+3
-2
@@ -1,13 +1,13 @@
|
|||||||
---
|
---
|
||||||
type: overview
|
type: overview
|
||||||
tags: [parking, index]
|
tags: [parking, index]
|
||||||
updated: 2026-10-22
|
updated: 2026-11-23
|
||||||
---
|
---
|
||||||
|
|
||||||
# Index
|
# Index
|
||||||
|
|
||||||
Content catalog for the wiki. Start at [[overview]]. Maintained on every ingest.
|
Content catalog for the wiki. Start at [[overview]]. Maintained on every ingest.
|
||||||
Counts: 4 sources · 19 entities · 47 concepts · 9 decision records.
|
Counts: 7 sources · 28 entities · 68 concepts · 23 decision records.
|
||||||
|
|
||||||
## Overview & navigation
|
## Overview & navigation
|
||||||
- [[overview]] — the top-level synthesis and entry point.
|
- [[overview]] — the top-level synthesis and entry point.
|
||||||
@@ -153,6 +153,7 @@ Counts: 4 sources · 19 entities · 47 concepts · 9 decision records.
|
|||||||
- [[forgiven-exit]] — decision + as-built (2026-10-08): owner opens the EXIT barrier with no payment — a signed zero-amount payment carrying the forgone fee as its own Z-report line (never in cash/card), exit only, admin permission + open shift, reason optional, prints nothing.
|
- [[forgiven-exit]] — decision + as-built (2026-10-08): owner opens the EXIT barrier with no payment — a signed zero-amount payment carrying the forgone fee as its own Z-report line (never in cash/card), exit only, admin permission + open shift, reason optional, prints nothing.
|
||||||
- [[vision-service-packaging]] — the vision service lives in this monorepo (apps/vision/), separate process, wired into Turbo via a package.json shim; uv-managed Python.
|
- [[vision-service-packaging]] — the vision service lives in this monorepo (apps/vision/), separate process, wired into Turbo via a package.json shim; uv-managed Python.
|
||||||
- [[camera-live-view]] — BUILT 2026-11-17: booth camera tiles from the device footer — latest snapshot at rest, live video while that camera sees a vehicle; sub-stream MJPEG over RTSP, reassembled in-process (RFC 2435), one shared session per camera, latest-frame WS delivery; open tiles a user preference; large view with Live/Snapshot; 1280×720, no fps cap. Measured: ~0.1 s delay on the LAN, no extra ANPR 503s.
|
- [[camera-live-view]] — BUILT 2026-11-17: booth camera tiles from the device footer — latest snapshot at rest, live video while that camera sees a vehicle; sub-stream MJPEG over RTSP, reassembled in-process (RFC 2435), one shared session per camera, latest-frame WS delivery; open tiles a user preference; large view with Live/Snapshot; 1280×720, no fps cap. Measured: ~0.1 s delay on the LAN, no extra ANPR 503s.
|
||||||
|
- [[event-driven-refactor]] — 🟡 OPEN (user, 2026-11-23): the whole repository is to be refactored along an event-driven pattern — a bus between vision, server and booth screen, no video/image work in the server, the camera as one signal among several. Waits for the user's guidelines; lists what it touches in today's code and where it meets what is built.
|
||||||
- [[event-streams-split]] — split the signed business ledger (ledger_events) from unsigned device telemetry (device_events).
|
- [[event-streams-split]] — split the signed business ledger (ledger_events) from unsigned device telemetry (device_events).
|
||||||
- [[desktop-shell-tauri]] — ✅ Tauri v2 chosen over Electron for the desktop kiosk shell; thin wrapper, server keeps all logic. Best case Ubuntu 26.04 LTS (resolves WebKitGTK); worst case Windows+WSL → kiosk browser, no native shell. Auto-updater mirrors signed releases to public `mca/public_releases` (source repo is private — field appliances have no Gitea creds).
|
- [[desktop-shell-tauri]] — ✅ Tauri v2 chosen over Electron for the desktop kiosk shell; thin wrapper, server keeps all logic. Best case Ubuntu 26.04 LTS (resolves WebKitGTK); worst case Windows+WSL → kiosk browser, no native shell. Auto-updater mirrors signed releases to public `mca/public_releases` (source repo is private — field appliances have no Gitea creds).
|
||||||
- [[party-ledger]] — 🟡 DESIGN (2026-09-08, not built): counterparty sub-ledger for who-owes-whom across modules — parties + signed `charge` / settlement / `write_off` events, balance derived never stored, aging + statements + CSV; lands postpaid subscriptions, hotel guest-nights, fleet washes on account, supplier/utility bills. Sub-ledger only: no bookkeeping, statements are not fiscal invoices, parties per appliance.
|
- [[party-ledger]] — 🟡 DESIGN (2026-09-08, not built): counterparty sub-ledger for who-owes-whom across modules — parties + signed `charge` / settlement / `write_off` events, balance derived never stored, aging + statements + CSV; lands postpaid subscriptions, hotel guest-nights, fleet washes on account, supplier/utility bills. Sub-ledger only: no bookkeeping, statements are not fiscal invoices, parties per appliance.
|
||||||
|
|||||||
+62
@@ -4007,3 +4007,65 @@ the staff's remote control, because the system is not ready to control it yet. D
|
|||||||
stopped `zg2` on park-lab, with all four relays read off first. The parking server and vision
|
stopped `zg2` on park-lab, with all four relays read off first. The parking server and vision
|
||||||
containers on park-lab were left running. Recorded on [[zone-anpr-poc]] and [[vision-hardening]].
|
containers on park-lab were left running. Recorded on [[zone-anpr-poc]] and [[vision-hardening]].
|
||||||
|
|
||||||
|
|
||||||
|
## [2026-11-23] query | Passage confirmation — the PoC of 2026-11-22 is the reference
|
||||||
|
The user, while discussing how to bring the PoC's ideas into the vision service: the PoC as it ran
|
||||||
|
on 2026-11-22 met the requirements; the staged phase-1 order of 2026-11-19 is not to be cited as
|
||||||
|
binding any more. Marked as superseded on [[passage-confirmation]]. Still under discussion, nothing
|
||||||
|
decided: which process owns the camera streams (the user: the server should hold no video or
|
||||||
|
image work).
|
||||||
|
|
||||||
|
## [2026-11-23] query | H.264 instead of MJPEG — decoding test with the zone PoC
|
||||||
|
The user: the server should hold no video or image work; test H.264 with the PoC and watch the
|
||||||
|
booth PC's load. Ran a relay-less copy (`zg-h264`) on park-lab, added a live picture to the PoC's
|
||||||
|
page, measured MJPEG, then switched channel 102 on both cameras to H.264 and measured again: 0.40
|
||||||
|
against 0.41 cores, 15.2 against 1.85 Mbps. Recorded on [[zone-anpr-poc]]; the user's positions
|
||||||
|
(no video in the server, a watchdog for crashed services, an event-driven architecture to be
|
||||||
|
planned) on [[passage-confirmation]]; the side effect on the booth tiles on [[camera-live-view]].
|
||||||
|
The cameras are left on H.264 and the test copy is left running.
|
||||||
|
|
||||||
|
## [2026-11-23] query | H.264 test — delay from camera to live picture
|
||||||
|
Measured the delay of the PoC's live picture on H.264: 0.5 s (entry) and 0.4 s (exit) with the
|
||||||
|
decoder's default threads, 0.12–0.24 s and 0.18 s with one decode thread, against 0.09–0.10 s for
|
||||||
|
MJPEG. Cause: one frame held back per extra decode thread. Added `decode_threads` to the PoC. The
|
||||||
|
user's own load readings, watching and not watching, are on [[zone-anpr-poc]] with the rest.
|
||||||
|
|
||||||
|
## [2026-11-23] query | H.264 test — a car in the zone
|
||||||
|
Two approach-and-reverse visits on H.264 (07:32 UTC): both judged abandoned, the plate decided in
|
||||||
|
0.34 s in the first; in the second the camera's on-screen label "Hyrje" was read as a plate and
|
||||||
|
one still voted for it. Video-frame reads at 65–90 px were 4 of 4 right, as with MJPEG. Recorded
|
||||||
|
on [[zone-anpr-poc]]; the label misread added to [[vision-hardening]].
|
||||||
|
|
||||||
|
## [2026-11-23] query | H.264 test — staff traffic
|
||||||
|
Eight visits by the staff on the relay-less test copy (07:52–09:11 UTC), read from the frames:
|
||||||
|
the entry camera judged 3 of 3 as passed, among them a car pushed through by five people; no
|
||||||
|
plate was decided in any visit, and the records neither blame nor clear H.264 (the plates were
|
||||||
|
under the size gate or too soft). A tall vehicle's box reached the moved label and it was not
|
||||||
|
read. The still pause carried over from one car to the next (review finding 14). The stream held
|
||||||
|
with no decode error. Recorded on [[zone-anpr-poc]], [[vision-hardening]] and
|
||||||
|
[[zone-anpr-poc-review]].
|
||||||
|
|
||||||
|
## [2026-11-23] query | H.264 test — bad weather, test copy left running
|
||||||
|
The user: the morning's results have to be read with the bad weather in mind (outdoor cameras,
|
||||||
|
the weather cannot be fixed); the relay-less test copy `zg-h264` stays running. Noted on
|
||||||
|
[[zone-anpr-poc]] and [[vision-hardening]].
|
||||||
|
|
||||||
|
## [2026-11-23] query | Event-driven refactor — the user's decisions recorded
|
||||||
|
The user: plate reading from H.264 will be handled; the server is agnostic about the camera side
|
||||||
|
(no signal from a camera, then a card, a barcode or a push-button ticket does the job; monitoring
|
||||||
|
shows what is down and the operator raises it); viewing from outside is out for now; the whole
|
||||||
|
repository is to be refactored along an event-driven pattern, with a bus between the vision side,
|
||||||
|
the server and the booth screen; instructions and a guidelines document will follow. New page
|
||||||
|
[[event-driven-refactor]] (decided, not decided, what it touches in the code, where it meets what
|
||||||
|
is built). Pointers added on [[passage-confirmation]], [[vision-service]], [[camera-live-view]],
|
||||||
|
[[lane-presence-and-anpr-entry]], [[dingtian-vs-mqtt]], [[entry-double-press]],
|
||||||
|
[[operator-issued-entry]], [[entry-presence-bypass]], [[standing-decisions]], [[open-questions]],
|
||||||
|
[[overview]]. Found while recording: the camera gates the entry button today, which the
|
||||||
|
agnostic-server rule does not match; left for the user. Nothing built, nothing committed.
|
||||||
|
|
||||||
|
## [2026-11-23] query | Event-driven refactor — the camera gate and the blinded camera settled
|
||||||
|
The user: the bypass for camera and radar events is the unblocking mechanism and is in place, so
|
||||||
|
the camera gate on the entry button stays; a camera that is healthy but blinded is an operational
|
||||||
|
matter of the business, not the system's concern. The two points are marked settled on
|
||||||
|
[[event-driven-refactor]]; the notes on [[entry-double-press]], [[operator-issued-entry]] and
|
||||||
|
[[entry-presence-bypass]] say so.
|
||||||
|
|||||||
+6
-1
@@ -2,7 +2,7 @@
|
|||||||
type: overview
|
type: overview
|
||||||
tags: [parking, overview, synthesis]
|
tags: [parking, overview, synthesis]
|
||||||
sources: [parking-system-architecture]
|
sources: [parking-system-architecture]
|
||||||
updated: 2026-11-22
|
updated: 2026-11-23
|
||||||
---
|
---
|
||||||
|
|
||||||
# Parking System — Overview
|
# Parking System — Overview
|
||||||
@@ -47,6 +47,11 @@ deployed on-site at a parking facility. Two forces shape nearly every decision:
|
|||||||
6 [[open-questions]] still drive procurement — most critically **lane topology**, **failure
|
6 [[open-questions]] still drive procurement — most critically **lane topology**, **failure
|
||||||
modes (fail-open on exit)**, the **reconciliation channel**, and **backup/durability**.
|
modes (fail-open on exit)**, the **reconciliation channel**, and **backup/durability**.
|
||||||
|
|
||||||
|
**Refactor ahead (user, 2026-11-23):** the repository is to be refactored as a whole along an
|
||||||
|
event-driven pattern: a bus between the vision side, the server and the booth screen, no video
|
||||||
|
or image work in the server, and the camera as one signal among several. Its shape waits for the
|
||||||
|
user's guidelines; nothing is built. See [[event-driven-refactor]].
|
||||||
|
|
||||||
## Reading paths
|
## Reading paths
|
||||||
|
|
||||||
- *Security-first:* [[threat-model]] → [[append-only-event-chain]] → [[reconciliation]] →
|
- *Security-first:* [[threat-model]] → [[append-only-event-chain]] → [[reconciliation]] →
|
||||||
|
|||||||
Reference in New Issue
Block a user