def plot_image_edges(image): edges = bedges(image) P.subplot(331) p = P.imshow(image, cmap=P.cm.gray) p.set_interpolation('nearest') for i in range(8): P.subplot(332+i) p = P.imshow(edges[:,:,i], cmap=P.cm.gray) p.set_interpolation('nearest') P.show()
def main(): #all_edges = [] #d = range(9) d = [9] images, _ = read('training', '../../mnist', d) #images = images[:100] all_edges = bedges(images) #cProfile.runctx("all_edges = amitedges(images)", globals(), locals(), "Profile.prof") #s = pstats.Stats("Profile.prof") #s.strip_dirs().sort_stats("time").print_stats() print all_edges[0, 0, 0, 0] platonic_edges = all_edges.mean(axis=0) plot_edges(platonic_edges)