Skip to content

Commit

Permalink
Update io.py
Browse files Browse the repository at this point in the history
Features added in read_davis_346() :
- Seperating DVS events from the superset containing DVS, APS, and IMU events. 
- Corrected the bitwise operations to extract (x, y) image coordinates, (t) timestamp, and (p) polarity of only DVS events. Reference : https://gitlab.com/inivation/docs/-/blob/master/source/software/software-advanced-usage/file-formats/aedat-2.0.md?ref_type=heads
  • Loading branch information
gokulbnr authored Aug 22, 2024
1 parent c62db86 commit 5d1294c
Showing 1 changed file with 9 additions and 5 deletions.
14 changes: 9 additions & 5 deletions tonic/io.py
Original file line number Diff line number Diff line change
Expand Up @@ -160,14 +160,18 @@ def read_davis_346(filename):
all_addr = all_events["address"]
t = all_events["timeStamp"]

# Seperating DVS events from the shared set of DVS, APS, and IMU events.
bit_31 = (all_addr >> 31) & 0b1
dvs = np.where(bit_31 == 0)

# 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)
dvs_x = (346 - 1) - (all_addr[dvs] >> 12) & 0x3FF
dvs_y = (260 - 1) - (all_addr[dvs] >> 22) & 0x1FF
dvs_p = ((all_addr[dvs] & 2048) >> 11)

xytp = make_structured_array(x, y, t, p)
dvs_xytp = make_structured_array(dvs_x, dvs_y, t[dvs], dvs_p, dtype=events_struct)
shape = (346, 260)
return shape, start_timestamp, xytp
return shape, start_timestamp, dvs_xytp


def read_dvs_346mini(filename):
Expand Down

0 comments on commit 5d1294c

Please sign in to comment.