The camera does not work with opencv, but it works with streamers

I am trying to use beaglebone with a USB camera using opencv and python. I'm having trouble capturing an image. However, the streamer of the command line tool seems to work. For python, I get:

>>> import cv2
>>> cap = cv2.VideoCapture(0)
>>> cap.read()
libv4l2: error dequeuing buf: No such device
VIDIOC_DQBUF: No such device

However, from the command line, I can do the following, and it works fine:

streamer -f jpeg -o image.jpeg

There is / dev / video0 And when I use lsusb, I see the camera as

Bus 001 Device 003: ID 1908:2310 GEMBIRD 

Any suggestions on how to get the camera to work with cv2

+4
source share
1 answer

, , , 320x240, 640x480. , 320x240 , .

.

import cv2
cap = cv2.VideoCapture(0)
cap.set(3,320)
cap.set(4,240)
status,image = cap.read()
cv2.imwrite("current.jpg", image)
0

Source: https://habr.com/ru/post/1621024/


All Articles