Files
winf-photobooth-app/models/README.md

3.9 KiB
Raw Blame History

Palm detection model

palm_detection_mediapipe_2023feb.onnx is the floating-point MediaPipe palm detector distributed by OpenCV Zoo, under Apache 2.0 (see LICENSE).

Source: https://github.com/opencv/opencv_zoo/tree/main/models/palm_detection_mediapipe

Weights: https://media.githubusercontent.com/media/opencv/opencv_zoo/main/models/palm_detection_mediapipe/palm_detection_mediapipe_2023feb.onnx

SHA-256: 78ff51c38496b7fc8b8ebdb6cc8c1abb02fa6c38427c6848254cdaba57fcce7c

The weights are embedded in the executable. Inference and preprocessing are implemented in src/palm.rs, following OpenCV Zoo's mp_palmdet.py reference. No download is needed at runtime.

Open-hand verification

handpose_estimation_mediapipe_2023feb.onnx provides 21 hand landmarks for second-stage verification. Distributed under Apache 2.0 (see HANDPOSE_LICENSE).

Source and preprocessing reference: https://github.com/opencv/opencv_zoo/tree/main/models/handpose_estimation_mediapipe

Weights: https://media.githubusercontent.com/media/opencv/opencv_zoo/main/models/handpose_estimation_mediapipe/handpose_estimation_mediapipe_2023feb.onnx

SHA-256: db0898ae717b76b075d9bf563af315b29562e11f8df5027a1ef07b02bef6d81c

src/hand_pose.rs rotates and crops the detected hand, requires at least 0.65 hand confidence, and checks all five fingers for extension using 3D landmarks. Finger extension tolerates natural curvature and a relaxed thumb while rejecting curled fingers and fists. Rejected poses reset the dwell/progress timer; the outline persists for up to 750 ms after the last accepted sample to avoid flicker. This verifies an open hand, not whether the palm side rather than the back faces the camera. Thresholds may need tuning for the camera and viewing distance.

Capture face counting

The bundled haarcascade_frontalface_alt2.xml and haarcascade_eye_tree_eyeglasses.xml are OpenCV Haar cascades from https://github.com/opencv/opencv/tree/4.6.0/data/haarcascades. Each XML includes its upstream license notice. They are embedded in the binary; no model downloads or external model paths are needed at runtime.

Detection runs once per capture and at most twice per second for the live preview, with the longest image edge capped at 640 px, using a frontal-face cascade with an optional eye-pair check. When fewer than two eyes are detected, the frontal-face result is accepted: missing eyes are not reliable evidence of a side view. When two or more eyes are detected, a roughly level, centered pair is required. Debug output includes the acceptance reason. Faces below 40 px may be missed, and some turned faces may still pass the frontal cascade. This is a best-effort side-view filter, not an exact gaze estimator. OpenCV is limited to two threads. Validate counts and timings with representative group photos on the kiosk before deployment; no accuracy or latency guarantee is implied.

The current capture is the clean mirrored 640×480 camera frame, before overlays. The app sends a JPEG to lp -n COUNT -o fit-to-page using the default CUPS printer and its configured paper/media settings. Install the CUPS client (lp) and set up the default printer on the kiosk. Zero accepted faces means no print job; detection/printing errors are logged without stopping the preview or retrying a possibly submitted job. Debug logs include candidate boxes, eye counts, rejected faces, accepted face/copy count, detection duration and CUPS submission result.

Live preview rectangles show every frontal-face candidate: green (#84bf65) means accepted for printing; blue (#4caee3) means rejected by the eye-pair check. Rectangles use mirrored camera coordinates and share the preview cover crop. They are cached between samples and cleared by empty results or detection errors. They never appear in detector inputs or the printed photo. Live sampling is quiet; full per-face debug information is emitted for captures only. The preview is sampled separately from capture, so counts can change with movement or lighting.