Streaming frames ΒΆ

It is possible to stream individual frames from a pipeline if you want to control the processing yourself. This works on any hsi.HSImage object.

import hsi

img = hsi.open("<path>")
img = img.binning(2, hsi.bands)

# Use as an iterator with the context manager protocol
with img.stream() as stream:
    for i in range(100):
        meta, frame = next(frame) # Get the next frame
        print(frame.shape)

# Manual usage
stream = img.stream() # Start streaming
meta, frame = stream.get_frame() # Get a single frame
stream.stop() # Stop the stream

Important

If you want to collect the output into a data cube you should use Custom operations