fix: move capture inference and print hook off camera thread

This commit is contained in:
2026-11-10 15:10:19 +01:00
parent 838becdd70
commit 898ceb5726
4 changed files with 170 additions and 14 deletions

View File

@@ -46,7 +46,13 @@ does not depend on a separate eye detector. It estimates frontal head orientatio
not eye gaze. Small, occluded or strongly tilted faces can still be missed;
validate group-photo accuracy and timings on the target kiosk.
The clean mirrored camera frame is counted once after capture. Debug logs retain
The camera copies and queues the clean mirrored frame after the countdown,
then immediately resumes the feed. A dedicated capture worker loads YuNet,
counts faces once, and calls the print hook sequentially. The bounded job channel
uses nonblocking submission; the next countdown waits until the worker is idle.
Accepted jobs are drained at shutdown. Lighting stays on until the frame snapshot
has been copied and queued, rather than waiting for face counting or printing.
Debug logs retain
candidate boxes, confidence, accepted/rejected counts, intended copies and timing.
The count is passed to an intentionally empty `print_picture` hook. There is no
printer command, image encoding, file output or physical printing yet.
@@ -58,4 +64,9 @@ results after 1.5 seconds. Green (`#84bf65`) means accepted; blue (`#4caee3`) me
rejected for head orientation. Rectangles use mirrored camera coordinates and
share the preview crop, but never enter capture or detector input. Counts are
always recomputed on the captured frame and can differ from the last live sample.
OpenCV remains limited to two threads; actual kiosk latency needs measurement.
All model loading and inference happen on background workers: palm/hand pose,
capture-time faces/print hook, and debug-only live faces. Camera and UI threads
never wait for inference or print scheduling. OpenCV uses one inference thread
per worker to reduce contention on the dual-core kiosk. This removes direct
blocking; actual feed timing still depends on CPU load and camera behavior and
needs measurement on the kiosk.