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
|
return
|
||||||
|
|
||||||
print("Caméra initialisée")
|
print("Caméra initialisée")
|
||||||
|
fps_counter = 0
|
||||||
|
fps_display = 0.0
|
||||||
|
fps_timer = time.time()
|
||||||
while True:
|
while True:
|
||||||
ok, frame = cam.read()
|
ok, frame = cam.read()
|
||||||
if ok:
|
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)
|
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:
|
with frame_lock:
|
||||||
current_frame = frame.copy()
|
current_frame = frame.copy()
|
||||||
time.sleep(0.066) # ~15fps
|
|
||||||
|
|
||||||
def generate_mjpeg():
|
def generate_mjpeg():
|
||||||
while True:
|
while True:
|
||||||
|
|||||||
Reference in New Issue
Block a user