5

I'm running Python2.7 on Arch Linux. I installed OpenCV via Pacman.

The Python code I'm using is:

import cv

capture = cv.CaptureFromCAM(0)

Very simple. All I'm trying to do, for now, is get Python access to my webcam. But that above code outputs:

[user@host python]$ python2.7 webcam.py 
VIDIOC_QUERYMENU: Invalid argument
VIDIOC_QUERYMENU: Invalid argument
VIDIOC_QUERYMENU: Invalid argument

My webcam works fine with Cheese (linux webcam program). So, presumable, there shouldn't be any driver/module issues...

Any ideas?

dave
  • 7,717
  • 19
  • 68
  • 100
  • have you tried with python 2.6? I heard rumours saying that there may be problems with 2.7... just rumours... – meduz Jan 31 '11 at 10:05

1 Answers1

3

Take a look at this: Displaying a webcam feed using OpenCV and Python

It appears that you're not passing .CaptureFromCAM() the right argument. If there is only one camera, you can do something like this:

    capture = cv.CaptureFromCAM(-1)

The -1 tells it to just grab whatever camera it can find (see this).

Community
  • 1
  • 1
J. Taylor
  • 4,567
  • 3
  • 35
  • 55