| median | images.imfilter | median |
median -- median filter a list of images
median input output xwindow ywindow
MEDIAN takes a list of input images input and produces a set of filtered output images output . The median filter consists of a sliding rectangular window of dimensions xwindow by ywindow . The center pixel in the window is replaced by the median of all the pixels in the window, where the median of a sequence of numbers is defined to be the value of the (n + 1) /2 pixel. If even the window dimensions are rounded up to odd integers. Out of bounds pixel references are handled by setting the parameter boundary .
The zloreject and zhireject parameters may be used to reject bad data from the median filtering box. If no good data is left in the filtering box, the median is set to zloreject if the majority of the pixels are less than zloreject, or to zhireject if the majority of pixels are greater than zhireject.
1. Median filter an image using a 5 by 5 window and nearest pixel boundary extension.
im> median m74 m74.5by5 5 5
2. Median filter an image using a 3 by 3 window and constant boundary extension.
im> median m74 m74.5by5 3 3 boun=const const=0.
3. Median filter the test image dev$pix, removing all pixels less than 5 or greater than 19935 from the filtering box.
im> median dev$pix pix77 7 7 zlo=5 zhi=19935
Median requires approximately 11 and 19 CPU seconds to filter a 512 by 512 integer image using a 5 by 5 and 7 by 7 filter window respectively (SPARCStation2).
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 image is integer or can be quantized without significant loss of precision.