0

I'm trying to open my usb camera on my Raspberry Pi using the following code:

VideoCapture capture;
capture.open(0);

The code can work perfectly one time but after running it again later I get:

HIGHGUI ERROR: V4L: index 0 is not correct!

without touching the camera or the code! Sometimes changing to capture.open(1); solves it but sometimes not. I read somewhere you can use (-1) and it will use the first camera it finds but that didn't work either.

DMEM
  • 1,573
  • 8
  • 25
  • 43
  • What USB camera have you got? – NRKirby Apr 09 '15 at 15:51
  • [Logitech QuickCam Communicate STX](http://support.logitech.com/product/quickcam-communicate-stx). Do you think it got something to do with the camera? It is very old... – DMEM Apr 09 '15 at 16:04
  • What output do you get if you execute `lsusb -t` – NRKirby Apr 09 '15 at 16:09
  • I tried a newer logitech camera and I get the same problem. here is what I get with `lsusb -t`: – DMEM Apr 10 '15 at 09:11
  • `pi@raspberrypi ~/Desktop/Track $ lsusb -t /: Bus 01.Port 1: Dev 1, Class=root_hub, Driver=dwc_otg/1p, 480M |__ Port 1: Dev 2, If 0, Class=hub, Driver=hub/5p, 480M |__ Port 1: Dev 3, If 0, Class=vend., Driver=smsc95xx, 480M |__ Port 3: Dev 4, If 0, Class='bInterfaceClass 0x0e not yet handled', Driver=uvcvideo, 480M` – DMEM Apr 10 '15 at 09:12
  • `|__ Port 3: Dev 4, If 1, Class='bInterfaceClass 0x0e not yet handled', Driver=uvcvideo, 480M |__ Port 3: Dev 4, If 2, Class=audio, Driver=snd-usb-audio, 480M |__ Port 3: Dev 4, If 3, Class=audio, Driver=snd-usb-audio, 480M |__ Port 4: Dev 6, If 0, Class=vend., Driver=rt73usb, 480M` – DMEM Apr 10 '15 at 09:12

0 Answers0