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?

1
  • have you tried with python 2.6? I heard rumours saying that there may be problems with 2.7... just rumours... Commented Jan 31, 2011 at 10:05

1 Answer 1

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).

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.