如何使用plt.imshow(image)显示多个图像?

时间:2020-04-22 19:34:44

标签: python matplotlib

    row, col = 0, 0
k = 0
for fn in os.listdir(readimg):
    if fn.endswith('.jpg'):
        list_name.append(fn[:fn.index('_')])
        im = Image.open(os.path.join(readimg, fn))
        im2 = im.resize((200, 200), Image.LANCZOS)
        tkimage = ImageTk.PhotoImage(im2)
        exis_img = Label(topl, image=tkimage)
        exis_img.grid(row = row + 1, column = col + 1, padx=2, pady=2)
        exis_name = Label(topl, text = list_name[k] , font = ("consolas", 16, "bold"))
        exis_name.grid(row=row + 2, column = col + 1, padx=4, pady=4)
        img_dets = cv2.imread(readimg + fn)[:, :, ::-1]
        col += 1
        k +=1
        if col == 5:
            row += 2
            col = 0
        plt.figure()
        plt.imshow(img_dets)

我的结果表明,只有最后处理的图像被有效覆盖了其他图像

0 个答案:

没有答案