I want to get the video stream from my webcam using python and OpenCV, for that task i've implemented this simple code:
import cv
cv.NamedWindow("w1", cv.CV_WINDOW_AUTOSIZE)
capture = cv.CaptureFromCAM(0)
def repeat():
frame = cv.QueryFrame(capture)
cv.ShowImage("w1", frame)
while True:
repeat()
when i try to execute it, i get the following error:
andfoy@ubuntu:~/Python$ python camera.py
VIDIOC_QUERYMENU: Argumento inválido
VIDIOC_QUERYMENU: Argumento inválido
VIDIOC_QUERYMENU: Argumento inválido
I changed the following line as suggested by other posts:
capture = cv.CaptureFromCAM(0)
to:
capture = cv.CaptureFromCAM(-1)
but the error persists.