IPSPECTRUM Function
Estimates the power spectrum (power spectral density) of an image.
Usage
result = IPSPECTRUM(image[, width, height, overlap])
Input Parameters
image—A 2D array of any data type except string containing an image.
width—(optional) The width of the subsections of image. (Default: xdim/5, where xdim is the width of image)
height—(optional) The height of the subsections of image. (Default: ydim/5, where ydim is the height of image)
overlap—(optional) The fraction of the window size that successive subsections of image overlap. (Default: 0.5)
Returned Value
result—A 2D array containing the power spectrum of image.
Keywords
Squared—If set, computes the power spectral density as the magnitude squared of the FFT of image.
note | The Squared keyword cannot be used with any other keyword, or with the optional parameters width, height, and overlap. |
Window_Param—A scalar float used only when computing either the Kaiser or Chebyshev windows.
Window_Type—A scalar value (see the following list) used to specify a window type to use when computing the spectrum of subsections of image.
1—Rectangular
2—Triangular
3—Hanning
4—Hamming
5—Kaiser
6—Blackman
7—Chebyshev
note | For descriptions and equations for the seven window types, see the Discussion section for the IPWIN Function. |
Discussion
IPSPECTRUM computes one of several different power spectrum estimates P(f) depending on the input parameters. Specific estimates available include the periodogram, the modified periodogram, Bartlett’s method, and Welch’s method. In all cases uniform samples of the power spectrum are returned. The equations shown below are for the case of a 1D signal, x, with a length, L. (The derivation of the 2D equations is not shown here, but is found in most Image Processing references.)
The frequency sample values are
fk = k/L , k = 0, 1, ..., M for real data.
where M = [(L + 2)/2] for L even and M = [(L + 1)/2] for L odd for real data.
For complex data, M = L.
The periodogram is defined as:
where the frequency variable f is normalized to the Nyquist frequency of 1.0. To obtain uniform samples of the periodogram using IPSPECTRUM, set length equal to the length of the data x, and set Window_Type to rectangular.
The modified periodogram is defined as:
where w(l) is a data window sequence. To obtain uniform samples of the modified periodogram using IPSPECTRUM, set length equal to the length of the data x and set Window_Type to any of the seven window types.
Bartlett’s method breaks the data into non-overlapping data segments represented as
xi(n) = x(n + iL) n = 0, 1, ... , L – 1 i = 0, 1, ... , I – 1.
A periodogram:
is computed for each data segment and averaged to obtain the Bartlett estimate:
To obtain uniform samples of Bartlett’s estimate using IPSPECTRUM, set length to be less than the data length, set overlap to 0 and set Window_Type to rectangular.
The Welch method breaks the data into length L overlapping data segments represented as (n + iL).
xi(n) = x(n + iQ) n = 0, 1, ... , L – 1 i = 0, 1, ... , I – 1
where Q = (L – overlap).
A modified periodogram is computed for each data segment given by:
where:
The Welch power spectrum estimate is the average of the modified periodogram of each data segment, given by:
To obtain uniform samples of the Welch estimate using IPSPECTRUM, set length less than the data length, set overlap to a nonzero value and set Window_Type to the desired window type.
note | In estimating the power spectrum it is assumed that the input signal is stationary (i.e., the frequency content does not change with time). If the signal is non-stationary, the IPWAVELET function can often provide better results than IPSPECTRUM. |
Example
image = IMAGE_READ(!IP_Data + 'airplane.tif')
; Display the image.
IMAGE_DISPLAY, image
; Compute the power spectrum.
image_spectrum = IPSPECTRUM(image('pixels'), /Squared)
; Display the power spectrum.
TVSCL, image_spectrum
See Also