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 Chee开发者_高级运维se (linux webcam program). So, presumable, there shouldn't be any driver/module issues...
Any ideas?
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).
精彩评论