Recording events straight to csv

Recording events straight to csv

While digging through the documentation, examples, and source code, I found a rather poorly documented feature of the python HAL API, and I am wondering if it works the way I think it does. I have tried a few examples and had some promising results, but I want to know if this is a supported feature of the API and whether there are any caveats I should be aware of. Below I have posted some example code.

# assume that camera discovery is already done and we have a device
cd_decoder = device.get_i_event_cd_decoder()
stream_decoder = device.get_i_events_stream_decoder()
stream = device.get_i_events_stream()

cd_decoder.add_event_buffer_callback(lambda buffer: save_csv(buffer, 'test.csv'))
streaming = True
camera.start_stream()
Timer(5, lambda streaming=streaming: streaming=False).start() # Stop streaming after 5 seconds
while streaming:
    data = stream.get_latest_raw_data()
    if data is not None:
        stream_decoder.decode(data)
    sleep(0.1)

The code makes use of the event_stream_decoder and cd_decoder to write data directly to a csv file rather than recording to a raw file and then converting it. Would this result in (more or less) the same events as if I recorded a raw file and converted it?

    As a Prophesee customer, join the community conversation. 
    Request your free access today.

      Information

      In this Community Forum, you can discuss products, technology and applications. Only registred users can post but everyone can read. To ask a private question, enter a support ticket in My Area https://support.prophesee.ai/portal/en/newticket