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:
@ -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")
|
||||
|
||||
Reference in New Issue
Block a user