def prepare_n_mnist(filename, is_filter, num_spikes, step_factor=1):
"""Creates images from the specified n mnist recording
filename: path to the recording
is_filter: True if median filtering should be applied to the constructed image
num_spikes: number of unique spikes per image
step_factor: proportional amount to shift before generating the next image
1 would result in no overlapping events between images
0.6 would result in the next image overlapping with 40% of the previous image
returns: list of images, where each image is a 2d numpy array (height, width)
"""
td = ev.read_dataset(filename)
#td.show_td(100)
td.data = stabilize(td)
td.data = td.extract_roi([3, 3], [28, 28], True)
images = make_td_images(td, num_spikes, step_factor)
if is_filter:
images = ndimage.median_filter(images, 3)
#for image in images:
# cv2.imshow('img', image)
# cv2.waitKey(70)
return images
评论列表
文章目录