Question

I am using opencv on ubuntu on a beaglebone black. I have a usb camera hooked up to the beagle bone through a USB hub. When I try and run my program I get continuous "Select Timeout" errors. I have enabled module traces as per: this suggestion and it gives me

uvcvideo:Dropping payload (out of sync)
uvcvideo:Marking buffer as bad (error bit set)

over and over again. I think that the 'dropping payload' isn't that big of a deal because it gives me the same error when i run it on my laptop and that works just fine. But the buffer error is exclusive to the beaglebone and I have no idea what to do about it. Any ideas would be great.

Was it helpful?

Solution

I had this same problem, and same error log in dmesg. I think what's required is to set the capture size (i.e. CV_CAP_PROP_FRAME_WIDTH and CV_CAP_PROP_FRAME_WIDTH) to an appropriate value for your camera.

After some experimentation, this worked for me on the BeagleBone Black with a Logitech HD Webcam C525:

#! /usr/bin/env python

import cv2
import sys


vc = cv2.VideoCapture(0)
vc.set(cv2.cv.CV_CAP_PROP_FRAME_WIDTH,1280)
vc.set(cv2.cv.CV_CAP_PROP_FRAME_HEIGHT,720)
if not vc.isOpened():
    sys.stderr.write('could not connect to camera! \n')
    sys.exit(1)

for count in range(0,5):
    success,frame = vc.read()
    if not success:
        sys.stderr.write('could not read image from cam \n')
        sys.exit(1)
    cv2.imwrite('capture_%02d.png' % count,frame)



vc.release()
vc = None

I'm not sure if it's required, but I also preconfigured the camera with:

root@beaglebone:~#  v4l2-ctl --set-fmt-video=width=1280,height=720,pixelformat=1
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top