feat: overlay résolution et FPS réel sur le flux vidéo
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
@ -47,13 +47,28 @@ def capture_loop():
|
||||
return
|
||||
|
||||
print("Caméra initialisée")
|
||||
fps_counter = 0
|
||||
fps_display = 0.0
|
||||
fps_timer = time.time()
|
||||
while True:
|
||||
ok, frame = cam.read()
|
||||
if ok:
|
||||
fps_counter += 1
|
||||
now = time.time()
|
||||
if now - fps_timer >= 1.0:
|
||||
fps_display = fps_counter / (now - fps_timer)
|
||||
fps_counter = 0
|
||||
fps_timer = now
|
||||
|
||||
frame = apply_settings(frame)
|
||||
h, w = frame.shape[:2]
|
||||
label = f"{w}x{h} | {fps_display:.1f} fps"
|
||||
cv2.putText(frame, label, (8, h - 8),
|
||||
cv2.FONT_HERSHEY_SIMPLEX, 0.5, (0, 0, 0), 2)
|
||||
cv2.putText(frame, label, (8, h - 8),
|
||||
cv2.FONT_HERSHEY_SIMPLEX, 0.5, (255, 255, 255), 1)
|
||||
with frame_lock:
|
||||
current_frame = frame.copy()
|
||||
time.sleep(0.066) # ~15fps
|
||||
|
||||
def generate_mjpeg():
|
||||
while True:
|
||||
|
||||
Reference in New Issue
Block a user