Low-Pass and High-Pass Filtering of Images

This Demonstration shows the results of applying two different types of filters to images. To apply the filters, the discrete Fourier transform of the image is taken and then changed through a series of steps. The filter is then applied by performing pointwise multiplication with the transform matrix and the rectangular filter that cancels out high frequencies if it is a high-pass filter or low frequencies if a low-pass filter. The steps are then done in inverse, and then the inverse discrete Fourier transform is taken to give the result. Notice that when low frequencies closer to the center are filtered out, there is more blurring at areas of rapidly changing pixel intensity, and when high frequencies closer to the edges are filtered, the areas of rapidly changing intensity are emphasized to show an outline of the image.



  • [Snapshot]
  • [Snapshot]
  • [Snapshot]


These are the steps that the program conducts to output the results:
1. Read in the image as a pixel intensity matrix.
2. Take the fast Fourier transform of the matrix. To obtain a power spectrum, multiply each element of the transform matrix by its complex conjugate.
3. Take the base-2 logarithm of each element of the power spectrum in order to improve its brightness and contrast settings in the display.
4. Shift the result's zero-frequency component from the top-left corner to the center by splitting the matrix into four equally sized quadrants and swapping them across the center.
5. Create a low-pass filter by making a rectangle of 1's, with the dimensions specified by the manipulated variables, at the center of a matrix of 0's with the same dimensions as the image. To make a high-pass filter, make the rectangle full of 0's among a matrix of 1's.
6. Multiply the shifted logarithm of the power spectrum by each filter pointwise.
7. Apply all the steps to change the power spectrum inversely to the filtered results. Then divide them by the complex conjugate matrix of the Fourier transform of the image.
8. Perform a fast inverse Fourier transform on the results.
9. Output the absolute value of the inverse transforms as images.
    • Share:

Embed Interactive Demonstration New!

Just copy and paste this snippet of JavaScript code into your website or blog to put the live Demonstration on your site. More details »

Files require Wolfram CDF Player or Mathematica.

Mathematica »
The #1 tool for creating Demonstrations
and anything technical.
Wolfram|Alpha »
Explore anything with the first
computational knowledge engine.
MathWorld »
The web's most extensive
mathematics resource.
Course Assistant Apps »
An app for every course—
right in the palm of your hand.
Wolfram Blog »
Read our views on math,
science, and technology.
Computable Document Format »
The format that makes Demonstrations
(and any information) easy to share and
interact with.
STEM Initiative »
Programs & resources for
educators, schools & students.
Computerbasedmath.org »
Join the initiative for modernizing
math education.
Step-by-Step Solutions »
Walk through homework problems one step at a time, with hints to help along the way.
Wolfram Problem Generator »
Unlimited random practice problems and answers with built-in step-by-step solutions. Practice online or make a printable study sheet.
Wolfram Language »
Knowledge-based programming for everyone.
Powered by Wolfram Mathematica © 2018 Wolfram Demonstrations Project & Contributors  |  Terms of Use  |  Privacy Policy  |  RSS Give us your feedback
Note: To run this Demonstration you need Mathematica 7+ or the free Mathematica Player 7EX
Download or upgrade to Mathematica Player 7EX
I already have Mathematica Player or Mathematica 7+