diff --git a/tonic/io.py b/tonic/io.py index 8eb9fd3..ae9aa3e 100644 --- a/tonic/io.py +++ b/tonic/io.py @@ -143,6 +143,33 @@ def read_dvs_red(filename): return shape, xytp +def read_davis_346(filename): + """Get the aer events from DAVIS346 with resolution of (260, 346) + + Parameters: + filename: filename + + Returns: + shape (tuple): + (height, width) of the sensor array + + events: numpy structured array of events + """ + data_version, data_start = read_aedat_header_from_file(filename) + all_events = get_aer_events_from_file(filename, data_version, data_start) + all_addr = all_events["address"] + t = all_events["timeStamp"] + + # x, y, and p : bit-shift and bit-mask values taken from jAER (https://github.com/SensorsINI/jaer) + x = (346 - 1) - ((all_addr & 4190208) >> 12) + y = (260 - 1) - ((all_addr & 2143289344) >> 22) + p = ((all_addr & 2048) >> 11) + + xytp = make_structured_array(x, y, t, p) + shape = (346, 260) + return shape, xytp + + def read_dvs_346mini(filename): """Get the aer events from DVS with resolution of (132,104)