Note
This C++ sample has a corresponding Python sample.
File to CSV
This tool allows to convert an event-based file (RAW, DAT or HDF5) to a CSV formatted file.
The source code of this sample can be found in <install-prefix>/share/metavision/sdk/stream/cpp_samples/metavision_file_to_csv
when installing Metavision SDK from installer or packages. For other deployment methods, check the page
Path of Samples.
Expected Output
The sample reads data from a RAW or HDF5 event file and writes them to a CSV file in the execution path.
How to start
You can directly execute pre-compiled binary installed with Metavision SDK or compile the source code as described in this tutorial.
To start the tool, provide the full path to a file (here, we use an HDF5 file from our Sample Recordings):
Linux
./metavision_file_to_csv -i spinner.hdf5
Windows
metavision_file_to_csv.exe -i spinner.hdf5
Beware that for RAW files, this converter is using the default settings of Camera class
for
the timestamp shifting feature (i.e. shifting is enabled), the shifted timestamps
are written in the output CSV file. Hence events found in the CSV files produced by this sample will not have the same
timestamps as the one produced by our Standalone Decoders.
However, metavision_file_to_csv
provides an option, --disable-timestamp-shifting
(or its shortcut -d
),
to disable this feature as needed. This allows you to preserve the original, absolute timestamps in the output as shown here:
$ ./metavision_file_to_csv -i industrial_fluid_flow.raw -o industrial_fluid_flow_timestamp_shifted.csv
Writing to /path/to/industrial_fluid_flow_timestamp_shifted.csv
Done!
$ more industrial_fluid_flow_timestamp_shifted.csv
616,314,0,16
813,654,0,16
384,27,0,17
$ ./metavision_file_to_csv -i industrial_fluid_flow.raw -o industrial_fluid_flow_timestamp_original.csv --disable-timestamp-shifting
Writing to /path/to/industrial_fluid_flow_timestamp_original.csv
Done!
$ more industrial_fluid_flow_timestamp_original.csv
616,314,0,2855312
813,654,0,2855312
384,27,0,2855313
We can see that:
when timestamp shifting is enabled (default behavior), the first timestamp is adjusted to 16
when timestamp shifting is disabled (with option
--disable-timestamp-shifting
), the original absolute timestamp of 2855312 is preserved