【发布时间】:2018-11-03 23:18:29
【问题描述】:
我有两张灰度图像有轻微的偏移(约 80% 重叠),我需要将其平均为一张图像。图像周围有填充,因此图像中已经考虑了重叠(即每个图像的 x 和 y 起始位置不同)。图像以其当前偏移对齐,类似于全景图像。
我目前的方法(见下文)是使用嵌套的 for 循环,比较每个位置的像素强度,将它们相加,然后除以非零计数。
combined_image=np.empty((image1.shape))
for row in range(image1.shape[0]):
for pixel in range(image2.shape[1]):
temp_array = np.array((image1[row][pixel], image2[row][pixel]))
combined_image[row][pixel] = np.sum(temp_array)/np.count_nonzero(temp_array)
我相信它可以工作,但是它相当慢,因为这些图像是 1000 x 1000 像素。想知道是否有更有效的方法
【问题讨论】: