Remember the stereo amplifier with all the knobs? The bass knob controlled how much of the signal sent to the speakers came from a low-pass filter, and the treble knob controlled the amount from a high-pass filter.
Bass and Treble controls
Playing a record with dust in the grooves would add a lot of hiss, pops, and crackle to the music. Turning the treble down could make the experience a little better. The impulse noise generated by a spec of dust has a lot of high frequency components. Dolby noise suppression did some sophisticated filtering on cassette tapes to improve signal to noise ratios; the end result was something like turning up the treble while recording and back down during playback, reducing the hiss from the tape.
The FFT (Fast Fourier transform) converts a signal from the time domain (like the data coming off the groove of the record) to the frequency domain (like the dancing bar graph of frequencies on more recent audio devices.)
Audio Bar Graph from Clementine
For a 2D FFT of an image, the equivalent of the bar graph looks like this:
image credit: Kontizas Dimitrios (check out the full size color image.)
source imageFFT of source
The FFT image of the source shows strong (bright white) low frequency components in the center and smaller (dark gray) high frequency components out to the edges. A second application of the FFT can convert the second image back to the first.
Add some noise, and the FFT shows more high frequencies (brighter dots away from center):
Lots of noise added to sourceFFT of noisy image
So, what would happen if all of the outer-most high frequency points were deleted? Would the added noise go away? All of these pictures are of data that codes black as zero and white as one, and gray between, so we could use a mask, like this, and element-wise multiply the FFT data with the mask, and then reverse the FFT to get a low-passed image:
Brick wall filter lets no high frequency throughBrick wall result, notice white stripe down pant leg
That did remove the tiny random dots, but now there is a ringing artifact whenever a dark and light edge happens; notice the white stripe on the pant leg and the black stripe on the nearest building ledge.
Maybe there's a better filter. My Dad was fascinated with filters, built with capacitors, inductors, and resistors, and maybe using op-amps. I remember him talking about Butterworth and Chebyshev filters and trying to explain flatness in the pass band and how different frequencies could be delayed by different amounts in a filter. The names still sound as cool as they did when I was twelve. I found this Paul Bourke article, which is what started this blog post, and this set of class notes by Dave Marshall, describing how to use the 2D Butterworth filter. It looks a lot better:
The Butterworth filter fades awayAnd the reconstituted image has less ringing
The attached JSL makes this GUI with sliders.
Sliders to experiment with filters