Hey there,
I'm currently working on project that can detect specific letters and colors. In order to do that, I'll need 2 USB Cameras getting live video, and taking photos. I've tried to implement a simple script to just open the live video from both of them, but it doesn't work. There you have the script:
When I start the code, I don't get any visual feedback from the câmeras and i get just like this :
I've tried to modify the code above to read the video from just one camera and it worked perfectly, for both of them.
Setup:
Raspberry Pi 4 B - 4GB
Raspberry Pi OS - 64 bits
Thonny Python - IDE
I'm currently working on project that can detect specific letters and colors. In order to do that, I'll need 2 USB Cameras getting live video, and taking photos. I've tried to implement a simple script to just open the live video from both of them, but it doesn't work. There you have the script:
Code:
import cv2import numpy as np# import RPi.GPIO as GPIOcap0 = cv2.VideoCapture(0)cap2 = cv2.VideoCapture(2)while cap0.isOpened() and cap2.isOpened(): ret0, frame0 = cap0.read() ret2, frame2 = cap2.read() if ret0: cv2.imshow('frame0', frame0) if ret2: cv2.imshow('frame2', frame2) if cv2.waitKey(1) & 0xFF == ord('q'): breakcv2.destroyAllWindows()cap0.release()cap2.release()
Do you guys have any thoughts, on how to solve this problem?[ WARN:0] global .modules/videoio/src/cap_gstreamer.cpp (935) open OpenCV | GStreamer warning: Cannot query video position: status=0, value=-1, duration=-1
I've tried to modify the code above to read the video from just one camera and it worked perfectly, for both of them.
Setup:
Raspberry Pi 4 B - 4GB
Raspberry Pi OS - 64 bits
Thonny Python - IDE
Statistics: Posted by SamMars — Thu Aug 29, 2024 1:47 am