From cce7fe93b8edc9cb2114fbaf48ec5aaf7f2321d5 Mon Sep 17 00:00:00 2001 From: nicoboy Date: Mon, 8 Jun 2026 17:21:07 +0200 Subject: [PATCH] feat: utiliser pipeline GStreamer libcamerasrc pour OV5647 sur Pi Bookworm MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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 --- camera_server.py | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/camera_server.py b/camera_server.py index e879476..22e4a03 100644 --- a/camera_server.py +++ b/camera_server.py @@ -32,11 +32,15 @@ def apply_settings(frame): def capture_loop(): global current_frame - # Sur Pi Zero avec OV5647, /dev/video0 - cam = cv2.VideoCapture(0) - cam.set(cv2.CAP_PROP_FRAME_WIDTH, 1280) - cam.set(cv2.CAP_PROP_FRAME_HEIGHT, 720) - cam.set(cv2.CAP_PROP_FPS, 15) + # Pipeline GStreamer pour CSI sur Pi Bookworm + pipeline = ( + "libcamerasrc ! " + "video/x-raw,width=1280,height=720,framerate=15/1 ! " + "videoconvert ! " + "video/x-raw,format=BGR ! " + "appsink drop=1" + ) + cam = cv2.VideoCapture(pipeline, cv2.CAP_GSTREAMER) if not cam.isOpened(): print("ERREUR : impossible d'ouvrir la caméra")