Display multiple images in one IPython Notebook cell?

后端 未结 10 1448
面向向阳花
面向向阳花 2020-12-12 12:26

If I have multiple images (loaded as NumPy arrays) how can I display the in one IPython Notebook cell?

I know that I can use plt.imshow(ima) to display

10条回答
  •  旧巷少年郎
    2020-12-12 13:12

    Somehow related to this question (and since I was directed to this answer when I was trying to solve it), I was able to solve a similar problem by simply typing the full file-path when calling Image(). In my case, I had to choose a random image from different folder paths stored in a list your_folder and display them.

    import random, os 
    for i in range(len(your_folder)):
       ra1 = "../"+your_folder[i]+"/"+random.choice(os.listdir(your_folder[i]))
       image = Image(ra1)
       display(image)
    

提交回复
热议问题