# This file was automatically generated by SWIG (http://www.swig.org).
# Version 3.0.8
#
# Do not make changes to this file unless you know what you are doing--modify
# the SWIG interface file instead.
from sys import version_info
if version_info >= (2, 6, 0):
def swig_import_helper():
from os.path import dirname
import imp
fp = None
try:
fp, pathname, description = imp.find_module('_pyupm_vcap', [dirname(__file__)])
except ImportError:
import _pyupm_vcap
return _pyupm_vcap
if fp is not None:
try:
_mod = imp.load_module('_pyupm_vcap', fp, pathname, description)
finally:
fp.close()
return _mod
_pyupm_vcap = swig_import_helper()
del swig_import_helper
else:
import _pyupm_vcap
del version_info
try:
_swig_property = property
except NameError:
pass # Python < 2.2 doesn't have 'property'.
def _swig_setattr_nondynamic(self, class_type, name, value, static=1):
if (name == "thisown"):
return self.this.own(value)
if (name == "this"):
if type(value).__name__ == 'SwigPyObject':
self.__dict__[name] = value
return
method = class_type.__swig_setmethods__.get(name, None)
if method:
return method(self, value)
if (not static):
if _newclass:
object.__setattr__(self, name, value)
else:
self.__dict__[name] = value
else:
raise AttributeError("You cannot add attributes to %s" % self)
def _swig_setattr(self, class_type, name, value):
return _swig_setattr_nondynamic(self, class_type, name, value, 0)
def _swig_getattr_nondynamic(self, class_type, name, static=1):
if (name == "thisown"):
return self.this.own()
method = class_type.__swig_getmethods__.get(name, None)
if method:
return method(self)
if (not static):
return object.__getattr__(self, name)
else:
raise AttributeError(name)
def _swig_getattr(self, class_type, name):
return _swig_getattr_nondynamic(self, class_type, name, 0)
def _swig_repr(self):
try:
strthis = "proxy of " + self.this.__repr__()
except Exception:
strthis = ""
return "<%s.%s; %s >" % (self.__class__.__module__, self.__class__.__name__, strthis,)
try:
_object = object
_newclass = 1
except AttributeError:
class _object:
pass
_newclass = 0
def getVersion():
return _pyupm_vcap.getVersion()
getVersion = _pyupm_vcap.getVersion
_pyupm_vcap.VCAP_DEFAULT_VIDEODEV_swigconstant(_pyupm_vcap)
VCAP_DEFAULT_VIDEODEV = _pyupm_vcap.VCAP_DEFAULT_VIDEODEV
_pyupm_vcap.VCAP_DEFAULT_OUTPUTFILE_swigconstant(_pyupm_vcap)
VCAP_DEFAULT_OUTPUTFILE = _pyupm_vcap.VCAP_DEFAULT_OUTPUTFILE
_pyupm_vcap.VCAP_DEFAULT_WIDTH_swigconstant(_pyupm_vcap)
VCAP_DEFAULT_WIDTH = _pyupm_vcap.VCAP_DEFAULT_WIDTH
_pyupm_vcap.VCAP_DEFAULT_HEIGHT_swigconstant(_pyupm_vcap)
VCAP_DEFAULT_HEIGHT = _pyupm_vcap.VCAP_DEFAULT_HEIGHT
_pyupm_vcap.VCAP_DEFAULT_JPEG_QUALITY_swigconstant(_pyupm_vcap)
VCAP_DEFAULT_JPEG_QUALITY = _pyupm_vcap.VCAP_DEFAULT_JPEG_QUALITY
[docs]class VCAP(_object):
"""
API for the Video Capture driver.
ID: vcap
Name: Video Frame Capture and Image Save Utility
Category: video This UPM module captures a still frame from a Linux
V4L device, such as a USB webcam, and and then allows you to save it
as a JPEG image into a file.
The camera and driver in use must support streaming, mmap-able buffers
and must provide data in YUYV format. This should encompass most video
cameras out there. It has been tested with a few off the shelf cameras
without any problems.
C++ includes: vcap.hpp
"""
__swig_setmethods__ = {}
__setattr__ = lambda self, name, value: _swig_setattr(self, VCAP, name, value)
__swig_getmethods__ = {}
__getattr__ = lambda self, name: _swig_getattr(self, VCAP, name)
__repr__ = _swig_repr
def __init__(self, *args):
"""
VCAP(std::string
videoDev=VCAP_DEFAULT_VIDEODEV)
VCAP object constructor
Parameters:
-----------
videoDev: The path to the video device, default is /dev/video0.
"""
this = _pyupm_vcap.new_VCAP(*args)
try:
self.this.append(this)
except Exception:
self.this = this
__swig_destroy__ = _pyupm_vcap.delete_VCAP
__del__ = lambda self: None
[docs] def setResolution(self, width, height):
"""
bool
setResolution(int width, int height)
Set the desired resolution of the output image. Note, this is a hint
to the underlying video driver. The video driver is free to lower the
specified resolution if the hardware cannot support it. You can use
getHeight() and getWidth() after calling this method to see what the
video driver chose.
Parameters:
-----------
width: The desired width of the image.
width: The desired height of the image.
true if the operation succeeded, false otherwise.
"""
return _pyupm_vcap.VCAP_setResolution(self, width, height)
[docs] def captureImage(self):
"""
bool captureImage()
Capture an image from the camera.
true if the operation succeeded, false otherwise.
"""
return _pyupm_vcap.VCAP_captureImage(self)
[docs] def saveImage(self, *args):
"""
bool
saveImage(std::string filename=VCAP_DEFAULT_OUTPUTFILE)
Save the captured image (created with captureImage()) to a file in
JPEG format. The file will be overwritten if it already exists.
Parameters:
-----------
filename: The name of the file in which to store the image.
true if the operation succeeded, false otherwise.
"""
return _pyupm_vcap.VCAP_saveImage(self, *args)
[docs] def getWidth(self):
"""
int getWidth() const
Return the current width of the image. You can use this method to
determine if the video driver downgraded it after a call to
setResolution().
true Current width of capture.
"""
return _pyupm_vcap.VCAP_getWidth(self)
[docs] def getHeight(self):
"""
int getHeight() const
Return the current height of the image. You can use this method to
determine if the video driver downgraded it after a call to
setResolution().
true Current height of capture.
"""
return _pyupm_vcap.VCAP_getHeight(self)
[docs] def setJPGQuality(self, quality):
"""
void
setJPGQuality(unsigned int quality)
Set the JPEG quality.
Parameters:
-----------
quality: A number between 0-100, with higher numbers meaning higher
quality. Numbers less than 0 will be clamped to 0, numbers higher than
100 will be clamped to 100.
"""
return _pyupm_vcap.VCAP_setJPGQuality(self, quality)
[docs] def getJPGQuality(self):
"""
int getJPGQuality()
const
Get the current JPEG quality setting.
the current JPEG quality setting.
"""
return _pyupm_vcap.VCAP_getJPGQuality(self)
[docs] def setDebug(self, enable):
"""
void setDebug(bool
enable)
Enable or disable debugging output.
Parameters:
-----------
enable: true to enable debugging, false otherwise
"""
return _pyupm_vcap.VCAP_setDebug(self, enable)
VCAP_swigregister = _pyupm_vcap.VCAP_swigregister
VCAP_swigregister(VCAP)
# This file is compatible with both classic and new-style classes.