Commit a75d2bda authored by mashun1's avatar mashun1
Browse files

evtexture

parents
Pipeline #1325 canceled with stages
0.000000000
0.001865671
0.003731343
0.005597014
0.007462686
0.009328358
0.011194029
0.013059701
0.014925373
0.016791044
0.018656716
0.020522388
0.022388059
0.024253731
0.026119402
0.027985074
0.029850746
0.031716417
0.033582089
0.035447761
0.037313432
0.039179104
0.041044776
0.042910447
0.044776119
0.046641791
0.048507462
0.050373134
0.052238805
0.054104477
0.055970149
0.057835820
0.059701492
0.061567164
0.063432835
0.065298507
0.067164179
0.069029850
0.070895522
0.072761194
0.074626865
0.076492537
0.078358208
0.080223880
0.082089552
0.083955223
0.085820895
0.087686567
0.089552238
0.091417910
0.093283582
0.095149253
0.097014925
0.098880597
0.100746268
0.102611940
0.104477611
0.106343283
0.108208955
0.110074626
0.111940298
0.113805970
0.115671641
0.117537313
0.119402985
0.121268656
0.123134328
0.125000000
0.126865671
0.128731343
0.130597014
0.132462686
0.134328358
0.136194029
0.138059701
0.139925373
0.141791044
0.143656716
0.145522388
0.147388059
0.149253731
0.151119402
0.152985074
0.154850746
0.156716417
0.158582089
0.160447761
0.162313432
0.164179104
0.166044776
0.167910447
0.169776119
0.171641791
0.173507462
0.175373134
0.177238805
0.179104477
0.180970149
0.182835820
0.184701492
0.186567164
0.188432835
0.190298507
0.192164179
0.194029850
0.195895522
0.197761194
0.199626865
0.201492537
0.203358208
0.205223880
0.207089552
0.208955223
0.210820895
0.212686567
0.214552238
0.216417910
0.218283582
0.220149253
0.222014925
0.223880597
0.225746268
0.227611940
0.229477611
0.231343283
0.233208955
0.235074626
0.236940298
0.238805970
0.240671641
0.242537313
0.244402985
0.246268656
0.248134328
0.250000000
0.251865671
0.253731343
0.255597014
0.257462686
0.259328358
0.261194029
0.263059701
0.264925373
0.266791044
0.268656716
0.270522388
0.272388059
0.274253731
0.276119402
0.277985074
0.279850746
0.281716417
0.283582089
0.285447761
0.287313432
0.289179104
0.291044776
0.292910447
0.294776119
0.296641791
0.298507462
\ No newline at end of file
0.000000000
0.001865671
0.003731343
0.005597014
0.007462686
0.009328358
0.011194029
0.013059701
0.014925373
0.016791044
0.018656716
0.020522388
0.022388059
0.024253731
0.026119402
0.027985074
0.029850746
0.031716417
0.033582089
0.035447761
0.037313432
0.039179104
0.041044776
0.042910447
0.044776119
0.046641791
0.048507462
0.050373134
0.052238805
0.054104477
0.055970149
0.057835820
0.059701492
0.061567164
0.063432835
0.065298507
0.067164179
0.069029850
0.070895522
0.072761194
0.074626865
0.076492537
0.078358208
0.080223880
0.082089552
0.083955223
0.085820895
0.087686567
0.089552238
0.091417910
0.093283582
0.095149253
0.097014925
0.098880597
0.100746268
0.102611940
0.104477611
0.106343283
0.108208955
0.110074626
0.111940298
0.113805970
0.115671641
0.117537313
0.119402985
0.121268656
0.123134328
0.125000000
0.126865671
0.128731343
0.130597014
0.132462686
0.134328358
0.136194029
0.138059701
0.139925373
0.141791044
0.143656716
0.145522388
0.147388059
0.149253731
0.151119402
0.152985074
0.154850746
0.156716417
0.158582089
0.160447761
0.162313432
0.164179104
0.166044776
0.167910447
0.169776119
0.171641791
0.173507462
0.175373134
0.177238805
0.179104477
0.180970149
0.182835820
0.184701492
0.186567164
0.188432835
0.190298507
0.192164179
0.194029850
0.195895522
0.197761194
0.199626865
0.201492537
0.203358208
0.205223880
0.207089552
0.208955223
0.210820895
0.212686567
0.214552238
0.216417910
0.218283582
0.220149253
0.222014925
0.223880597
0.225746268
0.227611940
0.229477611
0.231343283
0.233208955
0.235074626
0.236940298
0.238805970
0.240671641
0.242537313
0.244402985
0.246268656
0.248134328
0.250000000
0.251865671
0.253731343
0.255597014
0.257462686
0.259328358
0.261194029
0.263059701
0.264925373
0.266791044
0.268656716
0.270522388
0.272388059
0.274253731
0.276119402
0.277985074
0.279850746
0.281716417
0.283582089
0.285447761
0.287313432
0.289179104
0.291044776
0.292910447
0.294776119
0.296641791
0.298507462
\ No newline at end of file
import os
try:
import esim_py
except ImportError:
print("esim_py not found, importing binaries. These do not correspond to source files in this repo")
import sys
binaries_folder = os.path.join(os.path.dirname(__file__), "..", "bin")
sys.path.append(binaries_folder)
import esim_py
import matplotlib.pyplot as plt
import numpy as np
import os
import glob
from os.path import join
def viz_events(events, resolution):
pos_events = events[events[:,-1]==1]
neg_events = events[events[:,-1]==-1]
image_pos = np.zeros(resolution[0]*resolution[1], dtype="uint8")
image_neg = np.zeros(resolution[0]*resolution[1], dtype="uint8")
np.add.at(image_pos, (pos_events[:,0]+pos_events[:,1]*resolution[1]).astype("int32"), pos_events[:,-1]**2)
np.add.at(image_neg, (neg_events[:,0]+neg_events[:,1]*resolution[1]).astype("int32"), neg_events[:,-1]**2)
image_rgb = np.stack(
[
image_pos.reshape(resolution),
image_neg.reshape(resolution),
np.zeros(resolution, dtype="uint8")
], -1
) * 50
return image_rgb
Cp, Cn = 0.1, 0.1
refractory_period = 1e-4
log_eps = 1e-3
use_log = True
H, W = 180, 240
image_folder = os.path.join(os.path.dirname(__file__), "data/images/images/")
timestamps_file = os.path.join(os.path.dirname(__file__), "data/images/timestamps.txt")
video_file = os.path.join(os.path.dirname(__file__), "data/video/video.avi")
esim = esim_py.EventSimulator(Cp,
Cn,
refractory_period,
log_eps,
use_log)
fig, ax = plt.subplots(ncols=5, nrows=5, figsize=(6,6))
contrast_thresholds_pos = [0.1, 0.2, 0.3, 0.4, 0.5]
contrast_thresholds_neg = [0.1, 0.2, 0.3, 0.4, 0.5]
refractory_periods = [1e-5, 1e-4, 1e-3, 1e-2, 1e-1]
num_events_plot = 30000
for i, Cp in enumerate(contrast_thresholds_pos):
for j, Cn in enumerate(contrast_thresholds_neg):
esim.setParameters(Cp, Cn, refractory_period, log_eps, use_log)
events = esim.generateFromFolder(image_folder, timestamps_file)
image_rgb = viz_events(events[:num_events_plot], [H, W])
ax[i,j].imshow(image_rgb)
ax[i,j].axis('off')
ax[i,j].set_title("Cp=%s Cn=%s" % (Cp, Cn))
plt.show()
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment