Ejemplo n.º 1
0
def display_image_sequence(image_stack, cmap_name):
    stack_len = len(image_stack)
    #print(image_stack.shape)
    img = None

    for i in range(stack_len):
        im = image_stack[i]
        if img is None:
            img = pylab.figimage(im, cmap=cmap_name)
        else:
            img.set_data(im)
        pylab.pause(.1)
        pylab.draw()
    plt.close()
Ejemplo n.º 2
0
def plainImage2(var, imageFile):
    M.clf()
    M.figimage(var)
    M.savefig(imageFile)
Ejemplo n.º 3
0
        with open('tmp/' + name + '_etf.pickle', 'wb') as f:
            pickle.dump(t, f)

    texture = np.random.rand(size[0], size[1]).astype(np.float32)
    kernellen = 31
    kernel = np.sin(np.arange(kernellen) * np.pi / kernellen)
    kernel = kernel.astype(np.float32)

    for h in range(size[0]):
        for w in range(size[1]):
            if (t[h][w][0] == 0):
                t[h][w][0] = np.random.rand() * 0.01
            if (t[h][w][1] == 0):
                t[h][w][1] = np.random.rand() * 0.01

    tnorm = np.linalg.norm(t, axis=2)
    np.place(tnorm, tnorm == 0, [1])
    t = np.divide(t, np.stack([tnorm, tnorm], axis=2))

    etf_lic = lic_internal.line_integral_convolution(t.astype(np.float32),
                                                     texture, kernel)

    dpi = 100
    plt.bone()
    plt.clf()
    plt.axis('off')
    plt.figimage(etf_lic)
    plt.gcf().set_size_inches((size[0] / float(dpi), size[1] / float(dpi)))
    plt.savefig("output/" + name + "_flow.png", dpi=dpi)