如何制作电影(相对于Matlab)? [英] How to create a movie (in relation to matlab)?

查看:117
本文介绍了如何制作电影(相对于Matlab)?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在matlab中有此代码(在一个函数中):

I have this code in matlab (in one function):

...
m = size(myList, 3);
for k = 1:m
    g = myList(:, :, k);
    image(g + 1)
    axis off
    axis square
    M(k) = getframe;
end;

和另一个文件(另一个功能):

and in another file (another function):

...
M = showGraphs(grids)
movie(M, 1)

我想在matplotlib中制作电影.到目前为止,我还是(对于第一段代码):

I want to do the movie in matplotlib. Until now, I did (for the first piece of code):

m=sc.shape(myList,3)
for k in range(m):
    g=myList[:,:,k]
    plt.axis("False")
    plt.imshow(g+1) -->> i don't know if it's right

我不知道该如何处理M(k)=getframe,然后再处理movie(M,1).

I don't know what to do with M(k)=getframe and then with movie(M,1).

我该如何进行?因为我对matplotlib中的方法感到困惑.

How can I proceed? because I'm confused about the way in matplotlib.

---- UPDATED ------------------------------

----UPDATED------------------------------

我做到了:

 n=sc.shape(data)[2]
    ims=[]
    for i in range(n):
        mydata=data[:,:,i]
        im=plt.imshow(mydata,cmap=plt.get_cmap('jet'))
        ims.append([im])
    return ims

然后:

fig=plt.gcf()
ani=ArtistAnimation(fig,result,interval=10,repeat=False)

推荐答案

有很多不同的方法,请参见以下动画示例:

There's a bunch of different ways, see the animation examples, here: http://matplotlib.sourceforge.net/examples/animation/index.html

这篇关于如何制作电影(相对于Matlab)?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆