From 5d1294cb64563bb87240802e5c592b6b793e4dc6 Mon Sep 17 00:00:00 2001 From: "Gokul B. Nair" <14059534+gokulbnr@users.noreply.github.com> Date: Thu, 22 Aug 2024 14:15:53 +1000 Subject: [PATCH] Update io.py 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 --- tonic/io.py | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/tonic/io.py b/tonic/io.py index 40f52c0..150eff8 100644 --- a/tonic/io.py +++ b/tonic/io.py @@ -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):