在python中并排绘制两个图像

时间:2016-04-08 20:23:02

标签: python matplotlib plot computer-vision

我想使用matplotlib在Python中并排绘制两个图像。但是我不想创建单独的子图。我想在同一个图中绘制两个图像,以便我可以在两个图像之间绘制对应关系。见下图。

enter image description here

在Matlab中我相信这可以使用imshow([I1,I2])完成,但是matplotlib的python API不接受图像数组。有没有办法在python中执行此操作?

1 个答案:

答案 0 :(得分:3)

如果你使用numpy,你可以使用numpy连接函数简单地创建一个代表两个图像的大数组:

import numpy as np
import matplotlib.pyplot as plt

img_A = np.ones((10,10))
img_B = np.ones((10,10))

plot_image = np.concatenate((img_A, img_B), axis=1)

plt.imshow(plot_image)
相关问题