如何使用IPython显示器连续显示图像? [英] How to display images in a row with IPython display?
本文介绍了如何使用IPython显示器连续显示图像?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
如果我执行以下命令:
for file in files:
display(Image(filename=os.path.join(folder,file)))
我在一列中得到一张图像列表:
I get a list of images in a column:
如何(水平)将它们连续放置?
How to put them in a row (horizontally)?
推荐答案
这对我有用:
from matplotlib.pyplot import figure, imshow, axis
from matplotlib.image import imread
def showImagesHorizontally(list_of_files):
fig = figure()
number_of_files = len(list_of_files)
for i in range(number_of_files):
a=fig.add_subplot(1,number_of_files,i+1)
image = imread(list_of_files[i])
imshow(image,cmap='Greys_r')
axis('off')
这篇关于如何使用IPython显示器连续显示图像?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文