Package pyvision :: Package types :: Module Video :: Class VideoFromDirectory
[hide private]
[frames] | no frames]

Class VideoFromDirectory

source code

    object --+    
             |    
VideoInterface --+
                 |
                VideoFromDirectory

This class allows the user to treat a directory of images as a video.

This class will recursively search the directories and will load and return any image with an image extension: JPG,JPEG,PNG,TIF,TIFF,GIF,BMP,PPM,PGM

Instance Methods [hide private]
 
__init__(self, dirname, order='ascending', limit=None, size=None, followlinks=True)
Recursively scans a directory for images and returns all images that could be loaded.
source code
 
_checkExtension(self, filename)
Check the extension on a filename to see if it is in the list.
source code
 
_scanImageDir(self)
Scan the directory and populate image_paths.
source code
 
query(self)
Must be overridden to implement the specific frame-grabbing required by different video sources.
source code
 
__iter__(self)
Return an iterator for this video
source code
 
__len__(self) source code

Inherited from VideoInterface: grab, next, play, resize

Inherited from VideoInterface (private): _pauseAndPlay

Inherited from object: __delattr__, __format__, __getattribute__, __hash__, __new__, __reduce__, __reduce_ex__, __repr__, __setattr__, __sizeof__, __str__, __subclasshook__

Properties [hide private]

Inherited from object: __class__

Method Details [hide private]

__init__(self, dirname, order='ascending', limit=None, size=None, followlinks=True)
(Constructor)

source code 

Recursively scans a directory for images and returns all images that
could be loaded. 

Example:
    images = pv.VideoFromDirectory(dirname)
    for im in images:
        do something


@param dirname: directory where the images comprising the video exist 
@type dirname: str
@param order: return the images in a random order using the randam.shuffle function.
@type order: 'random' | 'ascending'
@param limit: limit the number of images returned.
@type limit: int
@param size: resize all images to this size.
@type: (int,int)

Overrides: object.__init__

query(self)

source code 

Must be overridden to implement the specific frame-grabbing required by different video sources.

Overrides: VideoInterface.query
(inherited documentation)

__iter__(self)

source code 

Return an iterator for this video

Overrides: VideoInterface.__iter__