ipython notebook 读取多个图像并在 CELL 中显示

标签 ipython display

我如何做到以上几点?这是我的代码,但它不起作用没有显示任何内容

from PIL import Image
import glob
image_list = []
for filename in glob.glob('<my directory>.pgm'):
    im=Image.open(filename)
    image_list.append(im)

import matplotlib.pyplot as plt

for i in range(10):
    plt.figure()
    plt.imshow(image_list[i])

我希望它显示在单元格中

最佳答案

如果您对更简单、更快速的图像显示方式感兴趣,我推荐 IPyPlot package :

import ipyplot

ipyplot.plot_images(images_list, max_images=20, img_width=150)
它能够在 60-70 毫秒内以类似网格的格式显示数百张图像
你会得到一个类似于这样的情节:
enter image description here

关于ipython notebook 读取多个图像并在 CELL 中显示,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/38055384/

相关文章:

python - Ipython raw_input 变通了吗?

c++ - 如何在 QT 中使用 DEBUG 对齐日志文件中的数据?

java - 分割长文本以进行分页显示

python - 使用 slider 小部件以交互方式更改图像内容

python - 如何修复 ipython 中的 "DistributionNotFound: The ' jsonschema' distribution ...”

python - 从 ipython 解释器而不是命令行运行模块

javascript - img onClick ""doesn' 工作吗?

html - 是否可以使用 `display: -webkit-box;` 垂直对齐 div 中的文本

JavaScript - 在显示 :none and display:block 之间添加转换

python - IPython 笔记本 : Plotting with LaTeX?