1 year ago
#280504

Vi Peeters
Python OpenCV: Failed to allocate required memory & Unrecognized or unsupported array type in function 'cvGetMat'
I'm trying to open 3 cameras at the same time on a Jetson Nano 2GB with python 3.6.9 and opencv 4.5.4
import cv2
Camera1 = cv2.VideoCapture(0)
Camera2 = cv2.VideoCapture(1)
Camera3 = cv2.VideoCapture(2)
Largeur = 640
Hauteur = 480
Camera1.set(3, Largeur)
Camera1.set(4, Hauteur)
Camera2.set(3, Largeur)
Camera2.set(4, Hauteur)
Camera3.set(3, Largeur)
Camera3.set(4, Hauteur)
while True:
ret1, IMG1 = Camera1.read()
ret2, IMG2 = Camera2.read()
ret3, IMG3 = Camera3.read()
cv2.imshow("Webcam1", IMG1)
cv2.imshow("Webcam2", IMG2)
cv2.imshow("Webcam3", IMG3)
if cv2.waitKey(1) % 0xFF == ord("q"):
break
Camera1.release()
Camera2.release()
Camera3.release()
cv2.destroyAllWindows()
But, if I try to open the 3 at the same time i get this error:
GStreamer warning: Embedded video playback halted; module v4l2src2 reported: Failed to
allocate required memory
cv2.imshow("Webcam3", IMG3)
cv2.error: OpenCV(4.5.4) error: (-206:Bad flag (parameter or structure field))
Unrecognized or unsupported array type in function 'cvGetMat'
I'm able to use all 3 cameras by group of 2 at the time but not the 3. I think it's because of the low 2GB of ram, but i want to have someone else opinion before doing anything.
P.S. all the cameras are Logitech C925e
python
opencv
gstreamer
v4l2
nvidia-jetson-nano
0 Answers
Your Answer