Opening an Event File
In Metavision SDK, events can be stored in various file formats:
The different modules of the SDK can read the following formats:
HAL C++ API can read RAW files
SDK Stream C++ API can read RAW, DAT and HDF5 files
SDK Core Python API can read RAW, DAT and HDF5 files
As shown in the following sections, once a file is open with the SDK, we get a device
or a camera
object
that can be used similarly to a camera. Except the sensor-specific facilities (like biases, ROI, ERC etc.),
those objects can leverage all the streaming and decoding features of the SDK.
You can see the list of HAL facilities available on cameras and files
in the HAL C++ Facilities API and
the HAL Python Facilities API
Using HAL C++ API
A RAW file can be opened using the function Metavision::DeviceDiscovery::open_raw_file()
:
device = Metavision::DeviceDiscovery::open_raw_file(raw_file_path);
Once the device
is available, you can stream events as you would do from a camera.
You can refer to the page Reading Events from a device for more details.
If you want to start from an example, on how to stream events from a file with HAL API in C++,
you can check out the sample metavision_hal_showcase
Using SDK Stream C++ API
An event file (RAW, HDF5 or DAT) can be opened with the function :cpp:function:`Metavision::Camera::from_file <Metavision::Camera::from_file>`:
camera = Metavision::Camera::from_file(event_file_path)
Once the camera
is available, you can stream events from your file as you would do from a actual camera.
You can refer to the page Reading Events from a device for more details.
Alternatively, you can check our tutorial Get Started using C++ that shows how
to read events both from cameras and event files.
Using SDK Core Python API
An event file (RAW, HDF5 or DAT) can be opened with the EventsIterator
class:
mv_iterator = EventsIterator(event_file_path)
To see how to use this iterator read the event stream, you can check our programming guide on Reading Events from a device or follow our Python Get started guide.
Note
If you are using the lower level HAL Python API as shown in the metavision_hal_get_started sample you can only open RAW files (the native format of our cameras) using such a command:
device = DeviceDiscovery.open_raw_file(raw_file_path)