## Exploring Frequency Space

The fundamental idea behind frequency-domain image processing is that every image can be decomposed into a unique spectrum of spatial frequencies. We can apply this concept by altering the spectrum and then transforming it back to a new image that has changed characteristics. With appropriate alterations to the spectrum, we can enhance image detail, alter the energy distribution in the image, and remove noise—just to name a few of the many applications.

### 17.1.1 Spatial Frequency

When we speak of frequency, we normally mean a signal that varies with time, such as sound waves carried in air or the varying voltages in electrical signals. However, suppose that you map the intensity of light across an image—you see a signal that changes in space. Just as a sound wave varies in time, the intensity of the image varies in space. And just as the sound can be characterized by a frequency in cycles per second, a spatial frequency can be expressed as a frequency in cycles per pixel.

The fundamental similarity between functions that vary in time and those Figure 17.1 Variations in image brightness have a spatial frequency spectrum—although few images so strongly resemble a square-wave pattern as this one of a fence. In this image, 27 cycles span 114 millimeters—giving a fundamental frequency of 0.237 cycles per millimeter (with lots of overtones).

Figure 17.1 Variations in image brightness have a spatial frequency spectrum—although few images so strongly resemble a square-wave pattern as this one of a fence. In this image, 27 cycles span 114 millimeters—giving a fundamental frequency of 0.237 cycles per millimeter (with lots of overtones).

that vary in space is the key to understanding the meaning of spatial frequency. We know that the frequency of a sound wave is the number of times that the air pressure peaks in a specific interval of time. When we hear the musical note A struck on a tuning fork, for example, we know that the sound pressure on our eardrum is rising and falling 440 times per second. Spatial frequencies are analogously defined as the number of cycles in a specific interval in space. A spatial frequency of 64 cycles per millimeter means that the function rises and falls 64 times across the distance of 1 millimeter.

Visually, single spatial frequencies in an image look like stripes or bars. It is easy to imagine assigning a spatial frequency to a picket fence, a Venetian blind, a window screen, or the stripes on a zebra. You can easily take a ruler and count how many times a feature repeats in a given interval—roughly 5 cycles per meter for a picket fence, 60 cycles per meter for Venetian blinds, and 1200 cycles per meter for a window screen. The irregular stripes on a zebra hint at the real complexities found in frequency space.

### 17.1.2 The Frequency Spectrum

Most of us feel comfortable dealing with musical frequencies because we have experienced them all of our lives. When we hear a pure tone, we recognize that someone has struck a harmonic oscillator such as a tuning fork. We know that chords are several notes sounded at the same time, so we intuitively grasp that many different frequencies can be present simultaneously. When we look at a graph of the frequencies in a piano note, it comes as no surprise that there is one high peak for the fundamental and many smaller peaks for the overtones and harmonics.

For a single tone, the graph of air pressure at the eardrum is obvious: it is a simple sine wave rising and falling smoothly. Less obvious is the graph of the air pressure for a note with overtones and harmonics. Clearly it must be the sum of the air pressures of the different frequencies, but the shape of the resulting wave does not immediately resemble its constituents: the sum of multiple sine waves is a new function of considerably greater complexity.

Just as sounds are rarely a single pure tone, and therefore composed of a single frequency, a pattern of light in an image rarely consists of a single spatial frequency. Instead, the signal contains many frequencies, from the low ones that make up the gross features of the image to high frequency overtones and harmonics that comprise the fine detail.

Of course, time-based frequencies are plotted on a single axis (time), whereas those in an image exist in the two spatial dimensions of the image. By their very nature, images are two dimensional. To simplify the initial stages of understanding the Fourier transform, however, we shall consider a one-dimensional slice through a two-dimensional image. When we graph this slice, we treat it as a function that varies along a single spatial dimension. The graph rises and falls as the intensity of the light along the slice varies. The graph of an image slice is similar to that of a sound wave that varies along the single axis of time; indeed, as far as the math is concerned, there is no difference at all. If the graph were a sound wave, it would represent air pressure rising and falling as we progress through time; as a slice from an image, it represents light intensity rising and falling as we traverse the image in space.

The mathematical basis of frequency analysis was formulated by the French mathematician Jean Baptiste Joseph Fourier in 1822. What he did was to postulate and prove mathematically that it is possible to break down any periodic function into simple sinusoids; and that by combining simple sine waves, it is possible to recreate virtually any periodic function. This applies to music, speech, electronic signals, and of course, astronomical images.

The power of Fourier's theorem is not immediately obvious. It is clear that combining a few sinusoids can produce a few generic wiggly functions, but the imagination usually initially balks at the idea of breaking down or producing any periodic function using sinusoids. As we shall see, though, with enough sinusoids you can synthesize square waves, triangular waves, and pictures of Jupiter.

### 17.1.3 Sinusoid Basics

To understand how versatile sinusoids really are, recall that three parameters are necessary to describe a sinusoid: period, amplitude, and phase. On a graph, we    Figure 17.2 Sinusoids have three associated properties: period, amplitude, and phase.

The sine function at upper left has a period of 2n, an amplitude of 1, and a phase of 0. At upper right, the amplitude is changed to 0.6; at lower left, the period is changed to 1.2n, and at the lower right, the phase is shifted by represent the frequency by the number of peaks in some interval of time or space. The amplitude is the height of the sinusoid from top to bottom, and the phase is the starting point of the sinusoid. Figure 17.2 shows one period for four sinusoids with different frequencies, amplitudes, and phases. 