feat: utiliser pipeline GStreamer libcamerasrc pour OV5647 sur Pi Bookworm

Remplace cv2.VideoCapture(0) + cam.set() par un pipeline GStreamer
compatible libcamera, nécessaire sur Raspberry Pi OS Bookworm.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
2026-06-08 17:21:07 +02:00
parent abf08fc6ef
commit cce7fe93b8

View File

@ -32,11 +32,15 @@ def apply_settings(frame):
def capture_loop(): def capture_loop():
global current_frame global current_frame
# Sur Pi Zero avec OV5647, /dev/video0 # Pipeline GStreamer pour CSI sur Pi Bookworm
cam = cv2.VideoCapture(0) pipeline = (
cam.set(cv2.CAP_PROP_FRAME_WIDTH, 1280) "libcamerasrc ! "
cam.set(cv2.CAP_PROP_FRAME_HEIGHT, 720) "video/x-raw,width=1280,height=720,framerate=15/1 ! "
cam.set(cv2.CAP_PROP_FPS, 15) "videoconvert ! "
"video/x-raw,format=BGR ! "
"appsink drop=1"
)
cam = cv2.VideoCapture(pipeline, cv2.CAP_GSTREAMER)
if not cam.isOpened(): if not cam.isOpened():
print("ERREUR : impossible d'ouvrir la caméra") print("ERREUR : impossible d'ouvrir la caméra")