I have a question about how to init the origin timestamp to 0 at the start in Python, no a very long timestamp 1698313800401900.

96 views
Skip to first unread message

Qi Wang

unread,
Oct 26, 2023, 8:13:50 AM10/26/23
to davis-users
微信图片_20231026201333.png

Pierre Giraud

unread,
Oct 26, 2023, 9:56:24 AM10/26/23
to Qi Wang, davis-users
Hi,

Here are two options:
  1. Understand what the "long" timestamp means, and convert it to real date and time:
    from datetime import datetime

    timestamp = 1698313800401900

    date_and_time_string = str(datetime.fromtimestamp(timestamp/1e6))
    print(date_and_time_string)
    Which should give you:
    '2023-10-26 11:50:00.401900'

  2. Simply transform all your timestamps by subtracting your "origin of time" to them:
    import dv_processing as dv

    # Recreating your event store
    store = dv.EventStore()
    store.push_back(1698313800401700, 193, 126, True)
    store.push_back(1698313800401700, 193, 127, True)
    store.push_back(1698313800401706, 192, 126, True)
    store.push_back(1698313800401706, 192, 127, True)
    store.push_back(1698313800401717, 190, 127, True)
    store.push_back(1698313800401732, 187, 123, False)
    store.push_back(1698313800401732, 187, 127, False)
    store.push_back(1698313800401738, 186, 126, False)
    store.push_back(1698313800401738, 186, 127, False)

    # Printing the events with original timestamps
    for ev in store:
        print(f"Original event [{ev.timestamp()}, {ev.x()}, {ev.y()}, {ev.polarity()}]")

    # Printing the events with shifted timestamps
    origin_of_time = store.getLowestTime()
    for ev in store:
        print(f"Shifted event [{ev.timestamp() - origin_of_time}, {ev.x()}, {ev.y()}, {ev.polarity()}]")
    This code is inspired from our dv-processing documentation: https://dv-processing.inivation.com/rel_1.7/event_store.html#create-and-store-events
Best Regards,

--

Pierre Giraud
Software Engineer

iniVation AG



From: davis...@googlegroups.com <davis...@googlegroups.com> on behalf of Qi Wang <wangq...@gmail.com>
Sent: Thursday, 26 October 2023 14:13
To: davis-users <davis...@googlegroups.com>
Subject: [davis-users] I have a question about how to init the origin timestamp to 0 at the start in Python, no a very long timestamp 1698313800401900.
 
微信图片_20231026201333.png

--
You received this message because you are subscribed to the Google Groups "davis-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to davis-users...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/davis-users/c6b669b5-d570-4801-bd2c-b669405fd323n%40googlegroups.com.

Qi Wang

unread,
Oct 27, 2023, 9:41:13 AM10/27/23
to davis-users
Hi Pierre,
 
thank you for your reply. I think i made myself unclear at the first.I have looked at most of the examples on the documentation of dv_processing and the method you provide i have seen before.

My real question is:
  •  how to get the single event data from the realtime event camera using?
All the best and thank you for replying!

Wang
Reply all
Reply to author
Forward
0 new messages