Skip to content

Instantly share code, notes, and snippets.

@mocquin
Created July 20, 2023 11:56
Show Gist options
  • Save mocquin/babecc22c45ea9118560d468ba47f41b to your computer and use it in GitHub Desktop.
Save mocquin/babecc22c45ea9118560d468ba47f41b to your computer and use it in GitHub Desktop.
# in order to multiply the fourier transforms, we need to pad
# the kernel to the same size as the image
kernel_padded = np.pad(kernel, ((0, V-N), (0, H-N)))
fft_convolved = np.fft.ifft2(np.fft.fft2(img) * np.fft.fft2(kernel_padded))
p_fft = PeriodicArray(fft_convolved.real)
p_fft.plot()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment