-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathevent_container_test.py
80 lines (63 loc) · 2.42 KB
/
event_container_test.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
"""Testing Event Container.
Author: Yuhuang Hu
Email : duguyue100@gmail.com
"""
from __future__ import print_function
import cv2
import numpy as np
from pyaer import libcaer
from pyaer.davis import DAVIS
from timer import Timer
device = DAVIS(noise_filter=True)
print("Device ID:", device.device_id)
if device.device_is_master:
print("Device is master.")
else:
print("Device is slave.")
print("Device Serial Number:", device.device_serial_number)
print("Device String:", device.device_string)
print("Device USB bus Number:", device.device_usb_bus_number)
print("Device USB device address:", device.device_usb_device_address)
print("Device size X:", device.dvs_size_X)
print("Device size Y:", device.dvs_size_Y)
print("Logic Version:", device.logic_version)
print("Background Activity Filter:",
device.dvs_has_background_activity_filter)
print("Color Filter", device.aps_color_filter, type(device.aps_color_filter))
print(device.aps_color_filter == 1)
device.start_data_stream()
# setting bias after data stream started
device.set_bias_from_json("./scripts/configs/davis346_config.json")
clip_value = 3
histrange = [(0, v) for v in (260, 346)]
def get_event(device):
data = device.get_event()
return data
num_packet_before_disable = 1000
while True:
try:
with Timer("container_test", show_hist=True):
event_container = device.get_event_container()
if event_container is not None:
print("Duration (s): {}, Num Events: {}, Event Rate (ev/s): {}"
.format(
event_container.pol_event_duration,
event_container.num_pol_events,
event_container.pol_event_rate))
print("Signal Rate (ev/s): {}, Noise Rate (ev/s): {}"
.format(
event_container.valid_pol_events_rate,
event_container.invalid_pol_events_rate))
# print("Number of events:", num_pol_event, "Number of Frames:",
# frames.shape, "Exposure:",
# device.get_config(
# libcaer.DAVIS_CONFIG_APS,
# libcaer.DAVIS_CONFIG_APS_EXPOSURE),
# "Autoexposure:", device.get_config(
# libcaer.DAVIS_CONFIG_APS,
# libcaer.DAVIS_CONFIG_APS_AUTOEXPOSURE))
else:
pass
except KeyboardInterrupt:
device.shutdown()
break