Smooths anarray with a boxcar average of a specified width.
NOTE: Use the Intleave keyword to specify interleaving for 2D and 3D arrays.
'copy'
) Valid strings are:
'zero'
Sets the border of the output image to zero.
'copy'
Copies the border of the input image to the output image. (Default)
'signal'
Indicates that a mxn array is to be treated as n signals of length m; each signal is smoothed independently.
'image'
Indicates that a mxnxp array is to be treated as p mxn images; each image is smoothed independently.
The default behavior for SMOOTH is to operate on the input array as a single piece of data.
SMOOTH is used to selectively average the elements in an array within a moving window of a given width. The result smooths out spikes or rapid transitions in the data and is usually called a boxcar average. The window is a box that traverses the input array, element by element. As the window moves through the array, all values within the window are averaged. The average value is then placed at the center of the window in the output array, while the original array is kept intact.
Conceptually, the algorithm used by SMOOTH is shown below for the 1D case (n is the number of elements in A and w is the width of the smoothing window, and w/2 is to be interpreted as the greatest integer less than or equal to w/2).
Otherwise, Ri = Ai.
The 2D case of an n0xn1 array is handled similarly:
when
The extension of these equations to higher dimensional arrays is obvious.
NOTE: Rather than explicitly summing over the entire window each time the window is moved, the sum over each new window is computed as the sum over the old window plus the sum over the leading edge of the new window minus the sum over the trailing edge of the old window. This method is computationally efficient, but due to numerical roundoff it may give slightly different results than the explicit method. Double precision input virtually eliminates these differences.
Figure 2-117 The SMOOTH function has been used to soften the sharp contrasts in this 512-by-512 mandrill image.
Figure 2-118 The SMOOTH function has been used to soften the sharp contrasts in this 512-by-512 mandrill image.
For more information, see Image Smoothing in Chapter 6 of the PV-WAVE User's Guide.