Skip to content

Commit

Permalink
added extract function for DAVIS346 recorded aedat files
Browse files Browse the repository at this point in the history
  • Loading branch information
gokulbnr committed Sep 1, 2023
1 parent 4b89557 commit 460b3c5
Showing 1 changed file with 27 additions and 0 deletions.
27 changes: 27 additions & 0 deletions tonic/io.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down

0 comments on commit 460b3c5

Please sign in to comment.