4485cbf702
Split monolithic files into focused modules: - app/core: settings, logging, lifecycle - app/signaling: websocket server, ICE parser, message models - app/webrtc: peer session, video receiver, frame source - app/vision: pose landmarker wrapper, model config, pose types - app/exercises/dead_bug: detector, metrics, rules, state machine, types - app/rendering: skeleton renderer, status overlay, window display - app/audio: rep announcer - app/diagnostics: perf timer, crash handler - configs: environment-based settings - tests: unit tests for rules, state machine, ICE parser - run.py: entry point
21 lines
874 B
Python
21 lines
874 B
Python
from __future__ import annotations
|
|
|
|
import cv2
|
|
import numpy as np
|
|
|
|
from app.exercises.dead_bug.types import DeadBugResult
|
|
|
|
|
|
def draw_status_overlay(image: np.ndarray, result: DeadBugResult) -> None:
|
|
color = (60, 220, 90) if result.is_standard else (50, 180, 255)
|
|
cv2.rectangle(image, (12, 12), (520, 142), (20, 20, 20), -1)
|
|
cv2.putText(image, f"Dead bug reps: {result.rep_count}", (28, 48), cv2.FONT_HERSHEY_SIMPLEX, 0.9, color, 2)
|
|
cv2.putText(image, f"phase: {result.phase.value}", (28, 82), cv2.FONT_HERSHEY_SIMPLEX, 0.68, (230, 230, 230), 2)
|
|
status = "standard" if result.is_standard else "adjust"
|
|
cv2.putText(image, f"status: {status}", (28, 116), cv2.FONT_HERSHEY_SIMPLEX, 0.68, color, 2)
|
|
|
|
y = 170
|
|
for text in result.feedback:
|
|
cv2.putText(image, text, (28, y), cv2.FONT_HERSHEY_SIMPLEX, 0.68, (255, 255, 255), 2)
|
|
y += 30
|