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
Image
objects and the name of the file, within the archive, is given by itsname
attribute.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
images
folder of themvtb-data
package, 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:
filter
is a Unix style wildcard expression, not a Python regexp, so expressions like*.png
would 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