1

我已将拉普拉斯滤波器应用于图像以检测图像中的边缘。

import matplotlib.pyplot as plt
from skimage import filters

output= filters.laplace(image)
plt.imshow(output, cmap = 'gray')
plt.title('Laplace', size=20)
plt.show()

我需要使用从上面代码中获得的输出来重建原始图像。

我不确定“filters.inverse”是否有效,或者是否有任何其他方法可用。

4

1 回答 1

1

您正在寻找的东西称为反卷积。如果您搜索“scikit-image deconvolution”,您可能会看到Richardson-Lucy deconvolution 函数的文档,或者这个示例用法。注意:理论上并不总是可以重建原始信号(这有点像取消混合油漆),但您可以获得合理的近似值,特别是如果您的卷积是完全已知的。

您可以查看拉普拉斯滤波器的源代码,您可以在其中看到图像与拉普拉斯核卷积。那就是我们需要对图像进行反卷积的内核。(请注意,您始终可以通过对中心仅包含 1 和其他任何地方的 0 的图像进行卷积来重新生成内核。这就是为什么反卷积中的内核被称为点扩展函数的原因。)

因此,要恢复您的图像:

from skimage.restoration.uft import laplacian
from skimage.restoration import richardson_lucy

kernel_size = 3  # default for filters.laplace, increase if needed
kernel = laplacian(output.ndim, (kernel_size,) * output.ndim)
restored = richardson_lucy(output, kernel)
于 2020-03-25T09:07:38.610 回答