0

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.

Community
  • 1
  • 1
cirea22
  • 25
  • 7

1 Answers1

2

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
Todd Stellanova
  • 901
  • 1
  • 9
  • 13
  • Great! You helped make my Logitech HD Webcam C525 work with my BeagleBone and Angstrom Linux distro. 'options uvcvideo nodrop=1 timeout=6000' in /etc/modprobe.d/uvcvideo.conf and image size of 1280 x 720. No neet to call v4l2-ctl to set parameters before. Thanks! – Pedro Ferreira Apr 06 '14 at 14:57
  • Well, just made some testing and in fact just using the image size 1280 x 720 does the trick! No need for module parameters... – Pedro Ferreira Apr 06 '14 at 15:08