Note
This Python sample has a corresponding C++ sample.
RAW EVT Encoder using Python
This sample illustrates how to use the RAWEvt2EventFileWriter
to re-encode events from a file into a RAW EVT2 file, possibly with some intermediate event filtering or processing.
The source code of this sample can be found in <install-prefix>/share/metavision/sdk/stream/py_samples/metavision_raw_evt_encoder
when installing Metavision SDK from installer or packages. For other deployment methods, check the page
Path of Samples.
Expected Output
This sample reads data from a recorded event file, applies a vertical flip operation, then saves the resulting events into a RAW EVT2 file.
By default, only CD events are processed and encoded. To also encode trigger events, use
the --encode-triggers
option.
When trigger support is enabled, by default the encoder will buffer CD events until the first trigger event is received,
which avoids EVT2 encoding errors but may lead to memory issues. Alternatively, the -max-event-latency
option can be
used to specify the maximum time expected to receive events and limit the number of CD events that are buffered. This will
help preventing memory issues, but note that this may also lead to EVT2 encoding errors if trigger events are received
after the specified latency.
How to start
To start the sample based on recorded data, provide the full path to an event file (for example, a RAW file from our Sample Recordings):
python -i metavision_raw_evt_encoder.py -i pedestrians.hdf5
This will create the file pedestrians_evt_encoded.raw
encoded in RAW EVT2 format and flipped vertically.