我需要将 HPF 和 LPF 应用于傅里叶图像并执行逆变换,然后比较它们。我执行以下算法,但没有结果:
img = cv2.imread('pic.png')
f = np.fft.fft2(img)
fshift = np.fft.fftshift(f)
magnitude_spectrum = 20 * np.log(np.abs(fshift))
# need to add HPF and LPF
hpf = ...
lpf = ... # maybe 1 - hpf ?
# inverse
result = (lpf + (1 + alpha) * hpf)
Run Code Online (Sandbox Code Playgroud)
你能告诉我该怎么做吗?