Reconstructing the final image

The following code block shows how to reconstruct the image with IFFT from the filtered Fourier coefficients:

# Reconstruct the denoised image from the filtered spectrum, keep only the real part for display.im_new = fp.ifft2(im_fft2).realpylab.figure(figsize=(10,10)), pylab.imshow(im_new, pylab.cm.gray),pylab.axis('off')pylab.title('Reconstructed Image', size=20)

The following screenshot shows the output of the preceding code—a much cleaner output image obtained from the original noisy image with filtering in the frequency domain:

Get Hands-On Image Processing with Python now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.