Image IO

This section covers the API to the image io handlers. For more examples and information, refer to the relevant guides in the User Guide.

Current handlers

Video(footage)

Wrapper around various image readers that provides a simple API to achieve the same functions regardless of format.

Writer(output[, footage, fps, resolution, ...])

Create an encoder for exporting frames at a given output.

Reading and writing

Video.read(*args, **kwargs)

Read single or multiple frames from the provided footage.

Writer.write(frame)

Write a frame using the declared encoder.

Teardown of handlers

Video.close()

Close/teardown attached video handlers.

Writer.close()

Close/teardown declared encoders.

Helper functions

take_first(it)

Retrieve the first value from an iterable object.

fourcc_to_string(fourcc)

Convert fourcc integer code into codec string.

open_video(video)

Convenience function for creating a Video instance.

Ancillary classes/methods

Frames(reader, start, stop, step, ...)

Container for frames that is used in Video.read.

Frames.import_to_ndarray()

Import the declared frames into a contiguous numpy array.

Frames.__len__()

Retrieve the length of the provided frames without having to iterate across them.

Frames.__iter__()

Retrieve the frames declared at initiation.

Video.__len__()

Retrieve the length of the provided footage without having to iterate across it.