VideoCapture
index
z:\camvue\videocapture.py

VideoCapture.py
 
by Markus Gritsch <gritsch@iue.tuwien.ac.at>

 
Modules
       
PIL.Image
PIL.ImageDraw
PIL.ImageFont
string
time
vidcap

 
Classes
       
Device

 
class Device
    Create instances of this class which will then represent video devices.
 
For the lifetime of the instance, the device is blocked, so it can not be
used by other applications (which is quite normal Windows behavior).
If you want to access the device from another program, you have to delete
the instance first (e.g. del cam).
 
  Methods defined here:
__init__(self, devnum=0, showVideoWindow=0)
devnum:  VideoCapture enumerates the available video capture devices
         on your system.  If you have more than one device, specify
         the desired one here.  The device number starts from 0.
 
showVideoWindow: 0 ... do not display a video window (the default)
                 1 ... display a video window
 
                 Mainly used for debugging, since the video window
                 can not be closed or moved around.
displayCaptureFilterProperties(self)
Displays a dialog containing the property page of the capture filter.
 
For VfW drivers you may find the option to select the resolution most
likele here.
displayCapturePinProperties(self)
Displays a dialog containing the property page of the capture pin.
 
For WDM drivers you may find the option to select the resolution most
likele here.
displayPropertyPage(self)
deprecated
 
Use the methods displayCaptureFilterProperties() and
displayCapturePinProperties() instead.
getBuffer(self)
Returns a string containing the raw pixel data.
 
You probably don't want to use this function, but rather getImage() or
saveSnapshot().
getDisplayName(self)
Gets the Windows "friendly name" for the device (for example "Microsoft LifeCam VX-1000")
 
(contributed by Jeremy Mortis (mortis@tansay.ca)
getImage(self, timestamp=0, boldfont=0, textpos='bl')
Returns a PIL Image instance.
 
timestamp:  0 ... no timestamp (the default)
            1 ... simple timestamp
            2 ... timestamp with shadow
            3 ... timestamp with outline
 
boldfont:   0 ... normal font (the default)
            1 ... bold font
 
textpos:    The position of the timestamp can be specified by a string
            containing a combination of two characters.  One character
            must be either t or b, the other one either l, c or r.
 
            t ... top
            b ... bottom
 
            l ... left
            c ... center
            r ... right
 
            The default value is 'bl'
saveSnapshot(self, filename, timestamp=0, boldfont=0, textpos='bl', **keywords)
Saves a snapshot to the harddisk.
 
The filetype depends on the filename extension.  Everything that PIL
can handle can be specified (foo.jpg, foo.gif, foo.bmp, ...).
 
filename:   String containing the name of the resulting file.
 
timestamp:  see getImage()
 
boldfont:   see getImage()
 
textpos:    see getImage()
 
Additional keyword arguments can be give which are just passed to the
save() method of the Image class.  For example you can specify the
compression level of a JPEG image by quality=75 (which is the default
value anyway).
setResolution(self, width, height)
Sets the capture resolution. (without dialog)
 
(contributed by Don Kimber <kimber@fxpal.com>)

 
Functions
       
now()
Returns a string containing the current date and time.
 
This function is used internally by VideoCapture to generate the timestamp
with which a snapshot can optionally be marked.

 
Data
        default_textpos = 'bl'
shadowcolor = 0
textcolor = 16777215