How to use the moviepy.video.io.bindings.mplfig_to_npimage function in moviepy

To help you get started, we’ve selected a few moviepy examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github micmelesse / 3D-reconstruction-with-Neural-Networks / lib / vis.py View on Github external
vox = vox.transpose(2, 0, 1)
    color = color.transpose(2, 0, 1)
    if color is None or len(np.unique(color)) <= 2:
        color = 'red'
    else:
        color_map = plt.get_cmap('coolwarm')
        color = color_map(color)

    fig = plt.figure()
    ax = fig.gca(projection='3d')
    ax.voxels(vox, facecolors=color, edgecolor='k')
    ax.view_init(view[0], view[1])

    if npimage:
        return mplfig_to_npimage(fig)

    if f_name is not None:
        params = utils.read_params()
        f_name = os.path.join(params["DIRS"]["OUTPUT"], f_name)
        utils.make_prev_dirs(f_name)
        fig.savefig(f_name, bbox_inches='tight', dpi=2400)
        fig.clf()
        plt.close()
        return

    return fig.show()
github baccuslab / deep-retina / deepretina / toolbox.py View on Github external
def animate(t):
        for X, img, ax in zip(xs, imgs, axs):
            i = np.mod(int(t / dt), T)
            ax.set_title(f't={i*0.01:2.2f} s')
            img.set_data(X[i])
        return mplfig_to_npimage(fig)
github jaimeliew1 / Mandelbrot / mandlebrot.py View on Github external
def make_frame(t):
            fig = self.iterate(t)
            return mplfig_to_npimage(fig)
github NMGRL / pychron / pychron / lasers / pattern / seek_pattern.py View on Github external
ts.append(time.time() - st)
        # print z
        z /= 3716625.0
        z += 0.1 * random.random()

        pattern.set_point(z, x, y)
        zs.append(z)
        # print zs
        tvint.set_data(ts, zs)

        tcs.append(f.time_constant)
        rcs.append(f.cradius)
        tc.set_data(ts, tcs)

        rs.set_data(ts, rcs)
        return mplfig_to_npimage(fig)
        # raw_input()
github pascalxia / driver_attention_prediction / visualization_prediction.py View on Github external
def make_frame_for_heatmap(t, maps, cmap, fps, fig, ax, global_vmax): 
    ind = np.floor(t*fps).astype(np.int)
    if ind>=len(maps):
        return bindings.mplfig_to_npimage(fig) 
    local_vmax = maps[ind].max()
    
    ax.clear()
    ax.imshow(maps[ind], cmap=cmap, vmax=max(local_vmax, 0.5*global_vmax))
    ax.axis('off')
    return bindings.mplfig_to_npimage(fig)
github dhiana / pretty_tsne / pretty_tsne.py View on Github external
def make_frame_mpl(t):
    i = int(t * 40)
    x = X_iter[..., i]
    sc.set_offsets(x)
    return mplfig_to_npimage(f)
github salu133445 / lakh-pianoroll-dataset / src / pypianoroll / plot.py View on Github external
xticks_major = np.arange(next_major_idx, window, beat_resolution)
            xticks_minor = np.arange(next_minor_idx, window, beat_resolution)
            if end % beat_resolution < beat_resolution//2:
                last_minor_idx = beat_resolution//2 - end % beat_resolution
            else:
                last_minor_idx = (beat_resolution//2 - end % beat_resolution
                                  + beat_resolution)
            xtick_labels = np.arange((start + next_minor_idx)//beat_resolution,
                                     (end + last_minor_idx)//beat_resolution)
            ax.set_xticks(xticks_major)
            ax.set_xticklabels('')
            ax.set_xticks(xticks_minor, minor=True)
            ax.set_xticklabels(xtick_labels, minor=True)
            ax.tick_params(axis='x', which='minor', width=0)

        return mplfig_to_npimage(fig)
github mattjj / pyhsmm-autoregressive / examples / animation.py View on Github external
def make_frame_mpl(t):
    model.resample_model()
    model.plot(fig=fig,update=True,draw=False,plot_slice=plot_slice)
    plt.tight_layout()
    return mplfig_to_npimage(fig)