The MEDIAN function returns the median value (element n /2) of Array if one parameter is present, or applies a one- or two-dimensional median filter of the specified width to Array and returns the result. In an ordered set of values, the median is a value with an equal number of values above and below it. Median smoothing replaces each point with the median of the one- or two-dimensional neighborhood of a given width. It is similar to smoothing with a boxcar or average filter but does not blur edges larger than the neighborhood.
In addition, median filtering is effective in removing "salt and pepper" noise, (isolated high or low values). The scalar median is simply the middle value, which should not be confused with the average value (e.g., the median of the array [1,10,4] is 4, while the average is 5.)
The array to be processed. If Width is also supplied, and Array is of byte type, the result is of byte type. All other types are converted to single-precision floating-point, and the result is floating-point. Array can have only one or two dimensions.
If the EVEN keyword is set when Array contains an even number of points (i.e. there is no middle number), MEDIAN returns the average of the two middle numbers. The returned value may not be an element of Array . If Array contains an odd number of points, MEDIAN returns the median value. The returned value will always be an element of Array --even if the EVEN keyword is set--since an odd number of points will always have a single middle value.