median input output xwindow ywindow
input
List of input images.
output
List of filtered images. The number of input images must be the same as
the number of output images. If the input image name is the same as the
output image name the original image is replaced by the filtered image.
xwindow, ywindow
The size of the median filter where both xwindow and ywindow are
odd integers. If either x window or ywindow are even they will be rounded
up to the nearest odd integer. The filter kernel must be less than
65 * 65 pixels in length.
boundary = nearest
The type of boundary extension. The options are:
nearest
Use the value of the nearest boundary pixel.
constant
Use a constant value.
reflect
Reflect pixel values around the boundary.
wrap
Wrap pixel values around the boundary.
constant = 0.
The value for constant value boundary extension.
MEDIAN takes a set of IRAF images input and produces a set of filtered images output. The median filter consists of a sliding rectangular window of dimensions xwindow by ywindow in which the center pixel of the window is replaced by the median of all the pixels in the window. The median of a sequence of numbers is defined to be that member of the sequence for which (n - 1) / 2 of the elements are equal or smaller in value and (n - 1) / 2 elements are equal or larger in value. The window dimensions are resticted to odd integers. Out of bounds pixel references are handled by setting the parameter boundary.
4 1.
Median process an image using a 5 by 5 window and nearest pixel boundary
extension.
cl> median m74 m74.5by5 5 5
4 2.
Median process an image using a 3 by 3 window and constant boundary extension.
cl> median m74 m74.5by5 3 3 boun=const const=0.
Median requires approximately 330 and 600 cpu seconds to filter a 512 by 512 real image using a 5 by 5 and 7 by 7 filter window respectively (Vax 11/750 fpa).
The filter kernel has been restricted to 65 by 65 pixels. This permits the use of static arrays and improves the running time of the program by approximately 30%.
The sort routine for the smaller kernels has been optimized. It may be desirable to optimize higher order kernels in future.
The IRAF task FMEDIAN is significantly more efficient than MEDIAN and should be used if the data can be quantized.