Median Filtering: Review and a New F/K Analogue Design
Total Page:16
File Type:pdf, Size:1020Kb
JOURNAL OF THE CANADIAN SOCIETY OF EXPLOR&TillON OEOPH”SICISTS “a 21. N’3 I ,OEC~ 1985). P, 54~63 MEDIAN FILTERING: REVIEW AND A NEW F/K ANALOGUE DESIGN ROBERT R. STEWART present. There also could be several numbers that are ABSTRACT repeated an equal number of times in the sequence. Median tilters operate by selecting the middle valve of an Thus the mode, if it exists, may not be unique. The ascending-ordered scqucncc of numbers. These numbers are median is the middle point of a sequence ordered in taken from a moving window on the data to be processed. The ascending value. If there is an even number of points in operation can be used in seismic data processing to reject the sequence, then the median is generally taken to be glitches on data as well as enhance disconbnuiries in the dara. the average of the two middle numbers. This paper reviews the definibons and some of the properties of median filters. The median filter is very useful in Vertical Often these statistical descriptors are roughly similar. Seismic Profile (VSP) data processing and automatic editing of However, for some sequences these three values can be sulface seismic data. It is also used in seismic processing to radically different. enhance linear events. A new mrdian filter design is discussed Consider the sequence here which uses a box of numbers (2-D arrayl and weights to (IO”, -.S, -5. 8.0. 8.5, 9.0, 7.5, 7.0, 9. I, 9.2, 7.1, achieve some of the properties of an f/k filter while retaining 7.3, 8.2) median tiller characreristics. Early tests indicate that this new tiller rejects spikes, smears discontinuities less than standard Neither the mean (76929.2) nor the mode (-,5) is f/k filters. and passes a range of dipping evcots. very representative of what might be the perceived nature of this sequence -a value somewhere near the INTRODUCTION median value of 8.0. If the negative values and the large value are considered to be errors, then the median Seismic data processing has been concerned for many would be a more robust estimate. That is, it is less years with extracting or enhancing particular events on sensitive to these errors. Thus, there is acertain motiva- recorded seismic traces. One of the most powerful and tion to investigate filtering operations based on the commonly used techniques is stacking, or the summing median sample as opposed to other statistics. together of adjacent traces to produce another trace Median filters (or running median selections) do not which, hopefully, has undesirable effects excluded or appear to have been used a great deal in seismic minim&d. processing, but have been known for some time (Tukey, The output “stacked” trace or mean trace is, however, 1971). In fact, the least absolute value criterion (which onlyoneofanumberofpossibleestimatesofthestatisti- is shown later in this paper to select the median) was cal properties of a set of traces (Naess and Bruland, apparently introduced by Boscovitch in 1757, some- 1985). The reader may recall the three fundamental what before the first reports on least-square methods estimates or descriptions of a sequence of numbers - (Denoel and Solvay, 1985). More recently, Claerbout the mean, mode and median. Let us first summarize and Muir (1973) discussed the properties of medians these estimates. arId absolute error minimiration (some of these proper- The mean a is the familiar average of a sequence of ties are summarired in the next section). They also numbers ai proposed the use of medians in anumberofgeophysical problems, including first-break analysis and magnetic mapping. Nonetheless, as late as 1979. it was stated (Huangeral., 1979) that while “. it is well-known that where N is the number of points in the sequence. median filtering is useful for reducing random noise The mode is the most common number(most repeated (especially when the noise amplitude probability den- value) in the sequence. The mode may or may not be sity has large tails) and periodic patterns, theoretical ‘Verilas Soflware Ltd.. 61s 3rd Avenue S.W., Calgary. Alberta T2P OG6 Numerous discussions with Dan Hampson and B&n Russell on digital filtering have been insightful and useful. Kim Andersen assisted in testing the computer code and in data processing. Ben Dickson of BP Canada Inc. provided helpful suggestions on the manuscripr. 54 MEDIAN FILTERING 55 results on its behavior are non-existent in the open ant under further median filtering. These root traces literature.“Themedianfilteriscurrentlyenjoyinggreater can be recombined togive the response ofmedianfilter- theoreticalattention(LeeandKassam, 1985)andpracti- ingthe original signal. They suggested that thisapproach cal application. Nonetheless, there are yet relatively may lead to faster algorithms. few papers published on median filter behaviour. Some M.J. Woodward of the Stanford Exploration Project of these papers are briefly discussed below. has discussed median “stacked” sections and median- Taylor (1981) wrote a thorough article on the uses of based velocity analyses @ers. comm., 1985). R.L. Kirlin the L, norm in seismic processing. Again, the L, norm and others associzated with the University of Wyoming (or absolute value) minimization of a sequence of num- Volcanic Reflection Research Project have also consid- bers selects the median sample. In particular, he con- ered median filters in some detail (Kirlin ef ul., 1985). sideredtheproblemsofstatisticalerrors,deconvolution They used dipping linear constant weights in 2-D arrays and sparse spike processing. One of the interesting to enhance dipping events on the seismic data. Hardage aspects of L, deconvolution that he discussed is that it (1985) discussed using “dip-steered” median selection resultsinasparsespikerepresentationofthereflectivity. toenhancedippingevents. Inthistypeoffilter,amedian Evans (1982) considered the approximate frequency is extracted for various selected dips. The median sam- domain behaviourofmedianfilters as well as their spike ple associated with the smallest variance for the range removal (deglitching) characteristics. He showed that of dips is selected as the appropriate filtered point. the median filters under consideration had roughly the A process that displays properties of both the median same frequency pass behaviour as mean filters of sim- and the mean is called the alpha-trimmed mean (Watt ilar length. Frequency domain analysis is somewhat and Bednar, 1983). In this type of selection, the data qualitative, however, as the median tiltcr is nonlinear. points are ordered but a range of values around the He found that the median filter performed more resil- median are averaged. Equivalently, this process dis- iently than mean filters in the face of spiky noise, and cards outlying points but smooths (averages) the inte- was very useful for filtering coded square-wave data rior points. This type of filtering shows considerable (WWVB signals). promise in seismic data processing (Farmer and Hal- In another article concerned with median filter appli- down, 1985). cations, Bednar (1983) compared the acoustic log edit- The median filter also has been used extensively ing performance of Markov processes, running means outside geophysics in image processing (Hung et al., and median filters. He suggested that, at least for cer- 1979: Nodes and Gallagher, 1982). The edge enhance- tain cases, the median filter was the preferred choice. ment (step-function pass) properties of the median fil- Healsoconsideredmedianiilteringinthecepstraldomain ters are of fundamental importance in this application. as a way to enhance a deconvolution process. He con- After this brief overview, the next section discusses cluded that there is some potential in this approach. some of the properties of median filters in more detail. Hardage (1983) gave considerable emphasis to the use of median filters in Vertical Seismic Profiling (VSP) data processing. He showed how they could be used to MEDIAN PROPERTIES considerable advantage to enhance events of interest. One method of coherent noise rejection and thus signal As noted previously, the median is the middle point enhancement proceeds by first aligning the event con- of an ascending-value sequence. For example, sidered to be noise. This event is enhanced via a median (5, 1000, 6, - I, -I, 7, 9) filter. The enhanced event is then subtracted from the when ordered, becomes aligned raw data (the pre-enhancement data). These (-I,-1,5,6,7,9,1000) raw aligned data with the coherent noise subtracted are The median is 6. Several aspects of this selection are then shifted back to their original position. They now notable. First, the median is an actual value of the have the coherent noise removed. In fact, median filter- odd-numbered sequence (as opposed to, say, the aver- ing of flat or linearly aligned events has become a stan- age, which is a combination of the input numbers and dard practice in VSPprocessing (Hardage, 1983: DiSiena has a value of 146.42). Second, the inclusion of a very and Stewart, 1985). aberrant number, 1000, disturbs the median selection Fitch er al. (1984) described a decomposition tech- very little. If 1000 were dropped from the sequence, the nique that would allow a more simplified analysis of median would change only slightly. These particular median filters. They reduce a sequence of numbers (or properties may or may not be desirable. depending on traces) to binary signals (rectangular waves) via given the application. thresholds. This is accomplished by constructing a set If a sequence is symmetric about some point (for of rectangular waves (zero values if the raw trace ampli- example, an event has a symmetric noise distribution), tudeis below agiven threshold, and avalue ofone ifthe then the median and mean selections will be the same. amplitude is above the threshold) from the input trace. For example, the sequence These binary signals are repeatedly median filtered to (0. 5, 6, 7, 8, 9, 14) arrive at a “root trace” -that is, a trace that is invari- has a median and mean equal to 7 (there is no mode).