ZipArchive
- class machinevisiontoolbox.Sources.ZipArchive(filename, filter=None, loop=False, **kwargs)[source]
Iterate images from a zip archive
- Parameters:
filename (str) – path to zipfile
filter (str) – a Unix shell-style wildcard that specified which files to include when iterating over the archive
kwargs – options applied to image frames, see
convert
The resulting object is an iterator over the image files within the zip archive. The iterator returns
Imageobjects and the name of the file, within the archive, is given by itsnameattribute.If the path is not absolute, the video file is first searched for relative to the current directory, and if not found, it is searched for in the
imagesfolder of themvtb-datapackage, installed as a Toolbox dependency.Example:
>>> from machinevisiontoolbox import ZipArchive >>> images = ZipArchive('bridge-l.zip') >>> len(images) >>> for image in images: # iterate over files >>> # process image
alternatively:
>>> image = images[i] # load i'th file from the archive
- References:
Robotics, Vision & Control for Python, Section 11.1.2, P. Corke, Springer 2023.
- Note:
filteris a Unix shell style wildcard expression, not a Python regexp, so expressions like*.pngwould select all PNG files in the archive for iteration.- Seealso:
Methods
List all files within the archive to stdout.
Open a file from the archive