Example #1
0
import collections
import time

import numpy as np
import matplotlib.pyplot as plt
import matplotlib.animation
plt.ion()

import dvs

filename = 'dvs-ball-1ms.npz'
events = dvs.load(filename, dt_round=True)

dvs.flow(events, debug=True)
assert False

def imshow(image, ax=None):
    ax = plt.gca() if ax is None else ax
    # ax.imshow(image, vmin=-1, vmax=1, cmap='gray', interpolation=None)
    ax.imshow(image, cmap='gray', interpolation=None)

def gaussian(x, mean=0, std=1, normalize=True):
    y = np.exp(-(0.5 / std**2) * (x - mean)**2)
    y /= y.sum()
    return y

# def convolve_fft(x, y, axis=-1):
#     X = np.fft.fft(x, axis=axis)
#     Y

DEBUG = True
Example #2
0
"""
Record DVS data using the V-REP simulator.

Since simulation times are not fast with the kind of time-step
we want for DVS events, we use this file to simulate and record
the events, so that they can be processed in another file.

Using 'dvs-epuck.ttt'
"""
import numpy as np
import matplotlib.pyplot as plt

import dvs


stereo = False

filename = 'dvs.npz'
# filename = 'dvs-epuck-stereo.npz'
# filename = 'dvs-ball-1ms.npz'

dvs.record(filename, stereo=stereo)

# re-load events, since this scales the time
events = dvs.load(filename)

# plt.figure(1)
# axs = [plt.subplot(1, 2, i+1) for i in range(2)] if stereo else plt.gca()
# ani = dvs.show(events, axs=axs, stereo=stereo)
# plt.show()
Example #3
0
                        vmin=-1,
                        vmax=1,
                        cmap='gray',
                        interpolation='none')
    ax.set_xticks([])
    ax.set_yticks([])
    return plt_img


rng = np.random.RandomState(3)
dt = 0.001

# --- load and filter DVS spikes
filename = 'dvs.npz'
# filename = 'dvs-ball-1ms.npz'
events = dvs.load(filename, dt_round=False)

t0 = 0.1
spikes = dvs.make_video(events, t0=t0, dt_frame=dt, tau=0)
video = dvs.make_video(events, t0=t0, dt_frame=dt, tau=0.005)

if 0:
    plt.ion()
    plt.figure(1)
    ax = plt.gca()
    img = show_image(ax, video[0])
    ax.invert_yaxis()

    for frame in video:
        img.set_data(frame)
        plt.draw()
Example #4
0
"""
Record DVS data using the V-REP simulator.

Since simulation times are not fast with the kind of time-step
we want for DVS events, we use this file to simulate and record
the events, so that they can be processed in another file.

Using 'dvs-epuck.ttt'
"""
import numpy as np
import matplotlib.pyplot as plt

import dvs

stereo = False

filename = 'dvs.npz'
# filename = 'dvs-epuck-stereo.npz'
# filename = 'dvs-ball-1ms.npz'

dvs.record(filename, stereo=stereo)

# re-load events, since this scales the time
events = dvs.load(filename)

# plt.figure(1)
# axs = [plt.subplot(1, 2, i+1) for i in range(2)] if stereo else plt.gca()
# ani = dvs.show(events, axs=axs, stereo=stereo)
# plt.show()
Example #5
0
import numpy as np
import matplotlib.pyplot as plt

plt.ion()

import dvs

filename = 'dvs-epuck-stereo-2.npz'
events0, events1 = dvs.load(filename, dt_round=True)

dvs.stereo(events0, events1, debug=True)
Example #6
0
import numpy as np
import matplotlib.pyplot as plt
plt.ion()

import dvs


filename = 'dvs-epuck-stereo-2.npz'
events0, events1 = dvs.load(filename, dt_round=True)

dvs.stereo(events0, events1, debug=True)