Commit a74471ff authored by Vincent POLLET's avatar Vincent POLLET

[DOC] Update readme with motive and example

parent 749692af
Pipeline #44012 failed with stage
in 4 minutes and 58 seconds
......@@ -15,11 +15,19 @@
=============
New package
Bob IO Stream
=============
This package is part of the signal-processing and machine learning toolbox Bob_.
Motivation
----------
This package provides a way to define efficient processing pipelines, based on the concept of "streams", to load and
process or save video data stored in hdf5 files. The stream abstraction allows to define pipelines of processing steps
with an easy syntax, and provides a way to access the processed data with a "numpy-like" api. It was designed to
minimize computation and disk access by loading only necessary data and buffering video frames and processed data.
Installation
------------
......@@ -28,6 +36,39 @@ package, run::
$ conda install bob.io.stream
Example
-------
Here is an example of how to use the package to load data recorded with 3 different cameras, build a depth map using
2 of them and use it to project the third camera's data.
.. code-block:: python
# Import Stream and StreamFile classes
# Processing filters are available through the Stream class
from bob.io.stream import StreamFile, Stream
# Open a Streamfile to a hdf5 file containing video data.
f = StreamFile(input_example.h5", face_streams.json", face_calibration.json)
# Define processing pipeline by chaining streams:
# First define the streams to load the data from the file (color, left and right), and align them using adjust
color = Stream("color", f)
nir_left = Stream("nir_left_stereo", f).adjust(color)
nir_right = Stream("nir_right_stereo", f).adjust(color)
# Define the reprojection operation through the stereo and reproject filters
map_3d = nir_left.stereo(nir_right)
# get the depth map, map it to a color image for visualization
depth = map_3d.select(channel=2).colormap(colormap="jet")
# Define the reprojection stream
rep_color = color.reproject(nir_left, nir_right, map_3d)
# Now that the pipeline is defined, the processed data can be accessed as if indexing in a numpy array:
rep_color[0] # Loads data and apply processing to provide the first frame of the reprojected stream.
rep_color[2:10] # Loads several frames, etc...
Contact
-------
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment