A :obj:`Stream` object is a (pseudo-)container allowing storage, transfert and processing of numerical data,
A :obj:`Stream` object is a (pseudo-)container allowing storage, transfert and processing of numerical data,
with a focus on raw multi-channel video. It shares part of the interface of a :obj:`numpy.ndarray` object, for
with a focus on raw multi-channel video. It shares part of the interface of a :obj:`numpy.ndarray` object, for
instance the propertises `ndim`and `shape`, but with a name on top
instance the propertises :obj:`ndim`and :obj:`shape`, but with a name on top
.. code-block:: python
.. code-block:: python
from bob.io.stream import Stream
from bob.io.stream import Stream
...
@@ -52,7 +52,7 @@ instance the propertises `ndim`and `shape`, but with a name on top
...
@@ -52,7 +52,7 @@ instance the propertises `ndim`and `shape`, but with a name on top
print(color.ndim) # -> None
print(color.ndim) # -> None
print(color.shape) # -> None
print(color.shape) # -> None
A :obj:`Stream` object is created in an 'indefinite' state, characterised by a `shape` and `ndim` properties equal to `None`.
A :obj:`Stream` object is created in an 'indefinite' state, characterised by a :obj:`shape` and :obj:`ndim` properties equal to :obj:`None`.
Such a newly created can be made to point to a dataset stored in a properly formated HDF5 file
Such a newly created can be made to point to a dataset stored in a properly formated HDF5 file
.. code-block:: python
.. code-block:: python
...
@@ -65,7 +65,7 @@ Such a newly created can be made to point to a dataset stored in a properly form
...
@@ -65,7 +65,7 @@ Such a newly created can be made to point to a dataset stored in a properly form
print(color.ndim) # -> 4
print(color.ndim) # -> 4
print(color.shape) # -> (60, 3, 1080, 1920)
print(color.shape) # -> (60, 3, 1080, 1920)
Which is the 'definite' state where the objet points towards a data source, this time characterised by definite values of `shape` and `ndim`.
Which is the 'definite' state where the objet points towards a data source, this time characterised by definite values of :obj:`shape` and :obj:`ndim`.
A last possible state for such an object is a 'streaming' state where
A last possible state for such an object is a 'streaming' state where
.. code-block:: python
.. code-block:: python
...
@@ -74,7 +74,7 @@ A last possible state for such an object is a 'streaming' state where
...
@@ -74,7 +74,7 @@ A last possible state for such an object is a 'streaming' state where
print(color.ndim) # -> 4
print(color.ndim) # -> 4
print(color.shape) # -> (None, 3, 480, 720)
print(color.shape) # -> (None, 3, 480, 720)
the first element of the `shape` property is `None`, such 'streaming' states are treated at a later stage . Unlike a :obj:`numpy.ndarray`
the first element of the :obj:`shape` property is :obj:`None`, such 'streaming' states are treated at a later stage . Unlike a :obj:`numpy.ndarray`
object, the first dimension of a stream :obj:`Stream` is always a time direction and a unit slice a 'frame', setting back
object, the first dimension of a stream :obj:`Stream` is always a time direction and a unit slice a 'frame', setting back
our stream to a definite state
our stream to a definite state
...
@@ -87,8 +87,8 @@ our stream to a definite state
...
@@ -87,8 +87,8 @@ our stream to a definite state
print(frame.shape) # -> (60, 3, 1080, 1920)
print(frame.shape) # -> (60, 3, 1080, 1920)
print(type(frame)) # -> <class 'numpy.ndarray'>
print(type(frame)) # -> <class 'numpy.ndarray'>
Similarly to a numpy array of more than one dimension, subscripting on the first index of a sream also yields a numpy arry. If the
Similarly to a numpy array of more than one dimension, subscripting on the first index of a sream also yields a numpy array. If the
the first index however is not an integer but a range (a pythonic `slice` formally)
the first index however is not an integer but a range (a pythonic :obj:`slice` formally)
.. code-block:: python
.. code-block:: python
what = color[3:13, :, 100:200, 300:400]
what = color[3:13, :, 100:200, 300:400]
...
@@ -106,13 +106,13 @@ is a only node in a data processing chain, with a parent and a child
...
@@ -106,13 +106,13 @@ is a only node in a data processing chain, with a parent and a child
print(color.child == what) # -> True
print(color.child == what) # -> True
This processing chain can be further extended by adding 'filters' after the child node, this is done by invoquing methods
This processing chain can be further extended by adding 'filters' after the child node, this is done by invoquing methods