# 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?