Timestamp Shifting

In Prophesee event-based sensor, the timestamp temporal origin (the zero) is the time when the camera started streaming, not the time when a RAW file starts being recorded. Hence, timestamps in RAW files do not typically start at 0. More precisely, if the raw stream is in EVT 3.0 the first event can have any timestamp in the range [0, 16.77s].

Having an “initial hole” in the timestamp sequence does not bring any value and is not convenient. So the SDK offers an option to shift the timestamps while decoding and consider the first decoded timestamp as the origin of time. With EVT3 for example, if the first timestamp decoded (using the first Time High and Time Low found) is 152000 and the first CD event has a timestamp of 152017, once we applied this “timestamp shifting” mechanism, the event will get a timestamp of 17.

Configuring with the SDK API

By default in the SDK, the timestamp shifting option is enabled in our various API. In the following section, we describe how this option can be disabled if you want to get access to the “raw timestamp”.

Using HAL C++ API

When using HAL C++ API, to disable the timestamp shifting, you should leverage RawFileConfig:

Metavision::RawFileConfig config;
config.do_time_shifting_ = false;
device = DeviceDiscovery::open_raw_file(file_path, config);

Using SDK Stream C++ API

When using SDK Stream Camera class, to disable the timestamp shifting, you should leverage the FileConfigHints class:

Metavision::FileConfigHints config;
config.set("time_shift", false);
camera = Metavision::Camera::from_file(file_path, config);

Using SDK Core Python API

When using SDK Core EventsIterator class, to disable the timestamp shifting, you should call the function initiate_device with the argument do_time_shifting set to False:

from metavision_core.event_io.raw_reader import initiate_device
from metavision_core.event_io import EventsIterator

device = initiate_device(path=args.input_path,  do_time_shifting=False)
mv_iterator = EventsIterator.from_device(device=device)

Timestamp in other file formats

When RAW files are converted to other formats (HDF5 or CSV) with our tools (e.g. File to HDF5 Converter, File to CSV Converter) we use the default API settings that apply the timestamp shifting, hence the timestamp in those files will be shifted.

  • For CSV, note that our Standalone decoder samples are not using the SDK API and are writing the raw timestamps in the output CSV file. Hence CSV files produced by those samples will not have the same timestamps as the one produced by our CSV converters (C++ CSV Converter and Python CSV converter).

  • For HDF5, note that the offset mentioned in the HDF5 format section should not be confused with the timestamp shift. This offset is only related to the way the indexes are stored. For the events, they are stored with their shifted timestamps (and the shift value is not saved in the file).