Webcam support for Linux

master
Gina Häußge 2013-01-02 16:41:04 +00:00
parent e1d541a6e4
commit f080468a4d
1 changed files with 3 additions and 4 deletions

View File

@ -4,8 +4,7 @@ __license__ = 'GNU Affero General Public License http://www.gnu.org/licenses/agp
try:
#Try to find the OpenCV library for video capture.
from opencv import cv
from opencv import highgui
import cv
except:
cv = None
@ -23,7 +22,7 @@ class Webcam(object):
def __init__(self):
self._cam = None
if cv != None:
self._cam = highgui.cvCreateCameraCapture(-1)
self._cam = cv.CreateCameraCapture(-1)
elif win32vidcap != None:
try:
self._cam = win32vidcap.Device()
@ -46,4 +45,4 @@ if __name__ == "__main__":
import os
webcam = Webcam()
webcam.save(os.path.join(settings().settings_dir, "image.png"))
webcam.save(os.path.join(settings().settings_dir, "image.png"))