如何在 Python 中将图像列表显示为动画电影播放器​​?

问题描述

from matplotlib import rc
import matplotlib.animation as animation
import matplotlib.pyplot as plt

fig,ax = plt.subplots()

def ShowFrame(i):
    ax.clear()
    ax.axis('off')
    fig.tight_layout()
    plot=ax.imshow(results[i])
    return plot

anim = animation.FuncAnimation(fig,ShowFrame)
plt.close()
anim

我在 results 列表变量中有 1749 张图片,我尝试在 Google Colab 中将该列表中的所有图片显示为动画视频。

当我运行上面的代码片段时,会显示一个视频播放器,而当我播放它时,只显示前 250 帧。

视频没有播放所有帧

如何使用 matplotlib.animation 显示 anim 变量中的所有帧?

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)