10
60 IEEE TRANSACTIONS ON ACOUSTICS, SPEECH, AND SIGNAL PROCESSING, VOL. ASSP-35, NO. 1, JANUARY 1987 Theoretical Analysis of the Max/Median Filter Abstract-Median filtering has been used successfully for extracting features from noisy one-dimensional signals; however, the extension of the one-dimensional case to higher dimensions has not always yielded satisfactory results. Although noise suppression is obtained, too much signal distortion is introduced and many features of interest are lost. In this paper, we introduce a multidimensional filter based on a com- bination of one-dimensional median estimates. It is shown that thresh- old decomposition holds for this class of filters, making the determin- istic analysis simpler. Invariant signals to the filter, called root signals, consist of very low resolution features making this filter much more attractive than conventional median filters. M I. INTRODUCTION EDIAN filtering is a simple andeffective technique for extracting features from noisy signals. The me- dian is a relatively efficient nonparametric point esti- mator. Although more robust estimators exist, running medians have the virtue of being very simple and having the edge preserving property. Because of the nonlinear nature of the filter, new approaches to the study and un- derstanding of these filters have been undertaken. These efforts have been very successful, especially in the un- derstanding of one-dimensional median filters and also rank order filters, where the jth largest sample in the win- dow instead of the median is set as the output of the filter. Although some questions remain unanswered, one-di- mensional median and ranked order filters are rather well understood, and their performance is, if not optimal, sat- isfactory in most cases. Median filters have been extensively used in multidi- mensional signal processing. Unfortunately, the exten- sion of use of the median filter from the one-dimensional case to higher dimensions has not always yielded satis- factory results. Although noise suppression is obtained, too much signal distortion is introduced and many fea- tures of interest are lost, such as thin lines and sharp cor- ners. In a recent publication [8], four different filters were compared under a mean squared error and a visual sub- jective criteria; the author concluded that theperformance of the median filter is not better than that of the others. These shortcomings of the median filter have motivated the study of generalizations of ranked order smoothers [2], [7], [9]. In this paper, we introduce the class madmedian Manuscript received January 31, 1985; revised June 28, 1986. This work was supported by the National Science Foundation under the Grant ECS 830-7764. G. R. Arce is with the Department of Electrical Engineering, University of Delaware, Newark, DE 19716. M. P. McLoughlin is with the Johns Hopkins Applied Physics Labora- tory, Laurel, MD 20707. IEEE Log Number 8610876. of ranked order filters. This class of filters effectively re- moves out noise as well as it preserves geometrical fea- tures of signals; hence, more emphasis is directed toward structural information. Before we define the mmhedian filter, we will review two-dimensional implementations of the median filter as well as introduce common termi- nology. To implement a nonrecursive median filter, an odd number of sample values spanned by a window are sorted, and the mid, or median, value is used as the filter output. If we let (a( e)] and { y( - )) be the input and output, re- spectively, of the median filter with window size 2N + 1, then y( e ) is given by y(m) = median [a(m - N), - * 7 ah - I), 44, a(m + l), - - , a(m + N)]. The recursive median filter is another useful form of median filtering. As the name implies, in recursive filter- ing the filter output is fed back into the filter. The follow- ing expression defines this operation: y(m) = median [y(m - N), * * , y(m - 2), a(m), a(m + l), - - , a(m + N)]. It is important to point out that invariant signals to the median filter, denoted as root signals, are obtained with a single pass of the recursive median filter. On the other hand, many passes of the nonrecursive median filter are needed, in general, to obtain a root. In two or more dimensions, similar median and ranked order filters have been proposed in the literature [2]-[4], [9]. The output of the multidimensional ranked order filter at a given point is the rth largest sample from a specified set of points. The set of points as well as the parameter Y can change as the window moves across the signal. In two dimensions, for instance, a square window is commonly used. In general, signal features are distorted or deleted by these multidimensional ranked order filters. Separable median filters presented by Narenda [9] yield somewhat better results in preserving signal structure; however, this method is not entirely satisfactory. Separable median fil- ters consist of two one-dimensional filters-one oriented in the horizontal direction and the other in the vertical. More explicitly, the output value, y(m, n), at position m, n is given by y(m, n) = median [z(m - N, n), - * . , z(m + N, n)], where z is defined as z(p, q) = median [a(p, ple values of the input signal. A rough measure of the signal distortion introduced by median-type filters is given q-N), ..* , a(p, q + N)], and {a(m, n)] are the sam- 0096-3518/87/0100-0060$01.00 O 1987 IEEE

Theoretical analysis of the max/Median filter

Embed Size (px)

Citation preview

60 IEEE TRANSACTIONS ON ACOUSTICS, SPEECH, AND SIGNAL PROCESSING, VOL. ASSP-35, NO. 1 , JANUARY 1987

Theoretical Analysis of the Max/Median Filter

Abstract-Median filtering has been used successfully for extracting features from noisy one-dimensional signals; however, the extension of the one-dimensional case to higher dimensions has not always yielded satisfactory results. Although noise suppression is obtained, too much signal distortion is introduced and many features of interest are lost. In this paper, we introduce a multidimensional filter based on a com- bination of one-dimensional median estimates. It is shown that thresh- old decomposition holds for this class of filters, making the determin- istic analysis simpler. Invariant signals to the filter, called root signals, consist of very low resolution features making this filter much more attractive than conventional median filters.

M I. INTRODUCTION

EDIAN filtering is a simple and effective technique for extracting features from noisy signals. The me-

dian is a relatively efficient nonparametric point esti- mator. Although more robust estimators exist, running medians have the virtue of being very simple and having the edge preserving property. Because of the nonlinear nature of the filter, new approaches to the study and un- derstanding of these filters have been undertaken. These efforts have been very successful, especially in the un- derstanding of one-dimensional median filters and also rank order filters, where the jth largest sample in the win- dow instead of the median is set as the output of the filter. Although some questions remain unanswered, one-di- mensional median and ranked order filters are rather well understood, and their performance is, if not optimal, sat- isfactory in most cases.

Median filters have been extensively used in multidi- mensional signal processing. Unfortunately, the exten- sion of use of the median filter from the one-dimensional case to higher dimensions has not always yielded satis- factory results. Although noise suppression is obtained, too much signal distortion is introduced and many fea- tures of interest are lost, such as thin lines and sharp cor- ners. In a recent publication [8], four different filters were compared under a mean squared error and a visual sub- jective criteria; the author concluded that the performance of the median filter is not better than that of the others. These shortcomings of the median filter have motivated the study of generalizations of ranked order smoothers [2], [7], [9]. In this paper, we introduce the class madmedian

Manuscript received January 31, 1985; revised June 28, 1986. This work was supported by the National Science Foundation under the Grant ECS 830-7764.

G . R. Arce is with the Department of Electrical Engineering, University of Delaware, Newark, DE 19716. M. P. McLoughlin is with the Johns Hopkins Applied Physics Labora-

tory, Laurel, MD 20707. IEEE Log Number 8610876.

of ranked order filters. This class of filters effectively re- moves out noise as well as it preserves geometrical fea- tures of signals; hence, more emphasis is directed toward structural information. Before we define the mmhedian filter, we will review two-dimensional implementations of the median filter as well as introduce common termi- nology.

To implement a nonrecursive median filter, an odd number of sample values spanned by a window are sorted, and the mid, or median, value is used as the filter output. If we let (a( e)] and { y( - )) be the input and output, re- spectively, of the median filter with window size 2N + 1, then y( e ) is given by

y(m) = median [a(m - N ) , - * 7 a h - I), 4 4 ,

a(m + l), - - , a(m + N ) ] .

The recursive median filter is another useful form of median filtering. As the name implies, in recursive filter- ing the filter output is fed back into the filter. The follow- ing expression defines this operation:

y(m) = median [y(m - N ) , * * , y(m - 2), a(m),

a(m + l), - - , a(m + N ) ] .

It is important to point out that invariant signals to the median filter, denoted as root signals, are obtained with a single pass of the recursive median filter. On the other hand, many passes of the nonrecursive median filter are needed, in general, to obtain a root.

In two or more dimensions, similar median and ranked order filters have been proposed in the literature [2]-[4], [9]. The output of the multidimensional ranked order filter at a given point is the r th largest sample from a specified set of points. The set of points as well as the parameter Y can change as the window moves across the signal. In two dimensions, for instance, a square window is commonly used. In general, signal features are distorted or deleted by these multidimensional ranked order filters. Separable median filters presented by Narenda [9] yield somewhat better results in preserving signal structure; however, this method is not entirely satisfactory. Separable median fil- ters consist of two one-dimensional filters-one oriented in the horizontal direction and the other in the vertical. More explicitly, the output value, y(m, n), at position m, n is given by y(m, n) = median [z(m - N , n), - * . , z(m + N , n)] , where z is defined as z ( p , q) = median [ a ( p ,

ple values of the input signal. A rough measure of the signal distortion introduced by median-type filters is given

q - N ) , . . * , a(p , q + N)], and {a(m, n ) ] are the sam-

0096-3518/87/0100-0060$01.00 O 1987 IEEE

ARCE AND MC LOUGHLIN: THEORETICAL ANALYSIS OF MAXlMEDIAN FILTER 61

by the resolution of the root signals of these filters. Al- though separable median filters yield better results than other two-dimensional median filters, root structures of these filters have very poor resolution. In fact, the mini- mum root feature width grows as the square of the param- eter N [ 101.

Because of the nonlinear nature of the class of max/ median filters, the analysis of these filters is approached from a deterministic and statistical sense. The determin- istic analysis shows the effects of the filter on the geo- metrical signal structure. On the other hand, the statistical analysis shows how effective the filter is in removing dif- ferent types of noise. This approach for the analysis of ranked filters has proved effective for median filters. Here we show that this approach also yields an effective ana- lytical description of the max/median filter.

The primary contributions of this paper are the intro- duction of the max/median filter class, and the develop- ment of basic deterministic properties, as well as of sta- tistical properties. Section I1 introduces the maxlmedian filtering process, and Sections I11 and IV give the deter- ministic and statistical analysis, respectively. These prop- erties provide a solid analytical understanding of these fil- ters and also show that max/median filters have many desirable properties for multidimensional signal process- ing.

11. MAX/MEDIAN FILTERING The class of max/ranked filters emphasizes the preser-

vation of multidimensional structural information based on the fact that, in most cases, the desired features are of lower dimensionality than the observation space. Con- sider the estimation of a sample a(m, n) in a two-dimen- sional sampled space {a( - , * )) from a neighborhood around the point of interest. The approach of the max/ ranked filtering is that of estimating one-dimensional fea- tures embedded in the multidimensional space. In fact, we trace all possible lines through the center sample and make a ranked operation on the samples lying along each line, separately. Combining all one-dimensional estimates, we make the multidimensional estimate. The advantage of this approach is the preservation of signal features that have lower dimensionality than the observation space, such as lines in a two-dimensional space and lines and planes in a three-dimensional space. Hence, in general, the max/ranked filter output in an N-dimensional space is defined as

y m l , m 2 ; . . ,mN = max ( z l , ~ 7 . 7 . . * 9 ZK),

where the zi's are the ranked feature estimates

zj = cp[all a's spanned by the jth subset]. Here, K is finite and depends on the dimension of the ob- servation space and the size of the one-dimensional win- dow, and cp is a ranked operation such as the median or any other point estimator. The maximum operation is chosen with criteria to preserve edges and discontinuities in the filtered signals. If other ranks are chosen rather than the maximum, it can be easily shown that the filter will

tend to blur edges of the original signal. In many appli- cations, all the zj's estimates may not be needed. In this paper we treat the two-dimensional case only, and a sub- class of these filters, where we only take into account samples in lines separated by 45" and the ranked opera- tion is a median filter. Hence, denoting the input and out- put of the 2N + 1' maxlmedian filter as am, and ym+, respectively, the output of the nonrecursive max/median filter at the m, n position is defined as

yS(m, n) = max [ z , , ~ , z , , ~ , z,,3, z, ,~I , (2.1) where

z,, = median (a,,, - N , - * 2 a m , n , ' " * 7 a m , n + N ) ,

z , , ~ = median * - - 9 a m , n , * ' * 9 a m + N , n ) ,

z,,3 = median ( a m + N , n - N , * - 3 a m , , , ' ' ? a r n - N , n + N ) ,

z , , ~ = median - N , * * - 9 am,n , ' ' > a m + N , n + N ) *

(2.2) Hence, this max/median filter of window size 2N + 1 spans 8N + 1 sample points, and is moved from left to right and from top to bottom. Moreover, when filtering the samples at the edges, we append points to the edges equal to the value of the edge points. Similarly, the output of the recursive maxlmedian filter is

Y r ( m , n) = max [ Z r , 1 , Zr ,2 , z , 3 , Zr,41, where in this case

z , 1 = median (y, , , - N , *. - 7 Y m , n - 1 , a m , n , ' * 7

a m , n + N ) ,

zr,4 = median ( y m - N , n - N , * * * 9 Y m - l , n - l , a m , w ' * 7

a m + N , n + N ) .

(2.3)

The next figures will illustrate the feature preserving properties of this filter; a comparison is also made to other frequently used two-dimensional median filtering tech- niques. Fig. l(a) and (b) shows an original and a noisy signal, respectively. The noise is additive, white, nor- mally distributed. The signals are designed to best illus- trate the feature preservation property of the max/median filter for any window size and signal resolution. Fig. 2(a) and (b) shows the separable nonrecursive median filter of size 3 and the max/median filter of size 3, respectively. If we increase the window size of the filter, we can expect rapid deterioration of the results obtained with the sepa- rable filter as shown in Fig. 3(a); however, the features

62 IEEE TRANSACTIONS ON ACOUSTICS, SPEECH, AND SIGNAL PROCESSING, VOL. ASSP-35, NO. 1, JANUARY 1987

(a) (b)

Fig. 1. (a) Input image. (b) Noisy image.

(a) (b) Fig. 2. Filtered images: (a) separable median, (b) max median ( N = 1).

( 4 (b)

Fig. 3. Filtered images: (a) separable median, (b) maxlmedian ( N = 2).

in the max/median filtered signal in Fig. 3(b) are not lost and, as expected, the noise is more effectively reduced.

It is interesting to realize that the class of max/median filters is a subclass of morphological filters which were recently introduced by Maragos and Schafer [7 ] . Mor- phological filters are based on the combination of a few morphological operations which must satisfy several prin- ciples including translation invariance [7] . These opera- tions extract information from image objects by trans- forming input images with a structuring element. Mathematical morphology gives a very useful quantita- tive description of the filtering of geometrical structures. Moreover, it has the advantage that these operations com- mute with thresholding; hence, they possess the threshold decomposition property [ S I .

The two basic mathematical morphology transforma- tions of a by B are erosion and dilation, where in a two-

dimensional space {a( - , * ) > is the input signal, and B is the structuring element. The erosion and dilation of a by B are denoted as a 0 B and a 0 E , respectively. In a discrete domain, the output of the erosion operator at the (m, n) position is

[a 0 B](m, n) = min {a(r + m, s + n ) } . (r,S)cB

In short, the erosion represents the minimum sample in- side the window B centered at the (m, n) position. Simi- larly, the dilation is

[a 0 B](m, n) = min {a(. + m, s + n)} . (r, s) E B

It has been shown that any order statistic can be rep- resented by the maximum of erosions [7]. In the frame-

ARCE AND MC LOUGHLIN: THEORETICAL ANALYSIS OF MAXlMEDIAN FILTER 63

work of the max/median operation, this is stated as &(m, n) = median [tb(m - N , n), * - - , tb(m, n),

zs,j = median {a samples in the jth window) * * , tb(m + N , A)], (3.4)

= max ([a Q B,,jI(m, n)) xj,3(m, n) = median [tb(m + N , n - N ) , * * - , tb(m, n), 1

r 1

- - max min a(r + m, s + n) , (2.4) 1 I 1 s @++,I) (r,s)€Bl,; 1

where B1,j is a structuring element that specifies a collec- tion of positions in the input sequence. The parameter j indicates the direction of the window, and E refers to a specific permutation of selecting N + 1 locations inside the 2N + 1 long window.

Using (2.4), the max/median operation can be written as the maximum of several minimum terms as shown next:

r 1

- - - , tA(m - N , n + N ) ] , (3 5 )

x;Jm, n) = median [tb(rn - N , n - N ) , * - , tb(m, n), - - , tb(m + N , n + N ) ] , (3 -6)

are the one-dimensional medians on each direction. The multilevel max/median output { ys( - , . )> can be obtained from a concatenation of the binary filtered planes { x i ( e ,

.)} by the threshold decomposition property, as shown in the following theorem.

Theorem 3. I : If we threshold the signal as described in (3.1) and apply the nonrecursive max/median filter to each of the threshold binary planes, we can relate the multi-

zs, 3(hz, n), zs, 4(m, A)), to the. filtered binary sequences in level output, Y s @ , 4 = max {zs, I @ , n), zs,z(m, n),

(3.2) by k - 1

Y h , n> = ,x x h , n). t = o

For a max/median of window size 2N f 1 , we will have 4(iN21’) minimum terms, with each minimum taken over N -+ 1 points. The relation of the ranked order operations

Proofi This proof follows the proof of the one-di- mensional threshold decomposition for median filters by Fitch et ul. [5 ] . The variable zs,j is defined by

to morphological operations gives a different perspective z, , j(m, n) = median {a( - , -) samples in jth window}, to analysis and design to each filtering class. For instance, the morphological decomposition of the max/median op- eration into the union of erosions of a by gives valu- zs, j(m, n) = max (0, i: I(at least N able geometrical insight.

which can be expressed as

+ 1 a’s in window are 1 i) = l), (3.6) 111. DETERMINISTIC PROPERTIES where Z(A) is the indicator function

Threshold decomposition is a property of the max/me- dian operation that is extensively used in the deterministic Z(A) = 1, if A is true; analysis of the filter. As it will be proved in this section, 0, if A is false. threshold decomposition states that one pass of the max/ We can then write (3.3) as median filter is equivalent to decomposing the signal into binary planes, filtering each binary plane with a binary . max/median filter, and then reversing the,decomposition. X:,j(m, n) =

1, if tk’s in jth window 2 N + J

We define a multilevel signal (a( - , .)> as being discrete 0, , if t i ’ s in jth window I N

and consisting of k levels. The thresholding signal is de- fined by = Z(c t i’s in jth window 2 N + 1)

I I

&(my n) = I 1, if a(m, n) 1 i 0, if a(m, n) < i, (3.1)

where 1 I i I k - 1 is the level being thresholded, and (m, n) is the point under consideration. By max/median filtering each binary thresholded plane { tb ( , a ) } , we ob- tain the binary signal

‘ /

= Z(at least N + 1 t i ’ s injth window = 1)

= &at least N + 1 a’s in jth window are 2 i).

(3.7) Notice that by using (3.7) we can express (3.6) as

z,,j(m, n) = max (0, i: ~ f , ~ ( m , n) = 1 ) .

Moreover, from the stacking property of threshold de- composition [ 5 ] , we can write

k - 1

~ , , ~ ( m , n) = ,X x:,j(m, n), for 1 I j I 4. 1 = 1

64 IEEE TRANSACTIONS ON ACOUSTICS, SPEECH, AND SIGNAL PROCESSING, VOL. ASSP-35, NO. 1, JANUARY 1987

We can now relate the output to each filtered sequence as

y ~ m , n) = max [ ~ , , ~ ( m , n)] = max C ~ : , ~ ( m , n) ; ; r - l i = l 1

k - 1 k - 1

= C max [xf,;(m, n)] = C x:(m, n). 0

Similar results hold for recursive max/median opera-

i = l j i = 1

tions, Letting

xi (m, n) = max ~ ! , ~ ( m , n), l s ; s 4

where

xi,; = median [ti and x: samples in jth window],

then threshold decomposition is proved next for recursive operations.

Theorem 3.2: If a k-level signal is thresholded as de- scribed in (3. l), and the binary sequences are filtered with the recursive max/median filter, then the output

Y r ( m , n)

max C Z r , l ( m , n) , z r , 2 ( m , n ) , zr.S(m, n), ~ r , 4 ( m , n)> can also be expressed as the concatenation

k - 1

Y r b , n) = x x m , n), i = l

where x: are the recursively max/median filtered binary planes.

Proofi It is shown in [5], that k - 1

z,;(m, n) = ,E x:,,(m, n), for I I j 5 4.

The output of the multilevel max/median filter is written as

I = 1

k - I

Y r ( m , n> = max [zr,;(m, n ) ~ = max [izl xf, j(m, n>

k - 1 k - 1

j ; 1 = C max ~ x f , ~ ( m , n)] = C xf(m, n).

In order to investigate the effects of the max/median filter on two-dimensional signals, we first define a set of binary signal structures. Binary filtered signals are then described in terms of the defined structure set. By the threshold decomposition property, we then extend these results to multilevel signals. Let us define some important signal structures for binary signals.

A binary constant neighborhood (BCN) is a region where samples of value one in the (BCN) are attached to at least N points of value one along the same direction.

A binary impulse (BI ) is a grouping of ones surrounded by zeros where each one in the (BI) is connected to less than N points of value one along the same direction. Moreover, any zero bordering the ones of the (BI) must have at least N zeros attached to it along all directions.

i = l ; i= 1

0 0 0 0 0 0 0 0 0 1 1 1 1 1 0 0 0 0 1 1 1 1 1 0 0 0 0 1 1 1 0 0 0 0 0 1 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0

0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 1 0 0 0 0 0 1 0 0 0 0 0 0 1 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0

0 0 0 0 0 0 0 0 l l O l 0 1 0 1 1 0 0 0 0 0 0 1 1 1 0 1 0 1 0 1 1 0 0 0 0 0 0 1 1 1 0 1 0 1 0 1 0 0 0 0 0 0 0 0

( 4 (b) (cj Fig. 4. Signal structures for N = 2: (a) BCN, (b) BI, and (c) BO.

Fig. 5. Root for N = 2, (BO) held between two BCN’s.

Binary Oscillations (BO) is a grouping of ones where each one in the (BO) is connected to less than N points of value one along the same direction; however, each one in the (BO) must belong to a median filter root on at least one direction [ 11.

A binary root is a binary signal which is invariant to max/median filtering.

Fig. 4 shows examples of (BCN), (BI), and (BO), for N = 2. It is easy to see that samples of value one in a (BCN) are not modified by the max/median operation; however, samples of value one in (BI) are removed after a single filtering operation. Before looking at the nature of a binary root, let us first consider a (BO). By definition, a (BO) contains no (BCN’s). If the (BO) is surrounded by a region of zeros, then a one on the edge of the (BO) will be deleted since there are less than N + 1 ones in the window centered at such sample. It is possible, however, that a one in a (BO) is a median root in at least one direc- tion and, therefore, it will not be added. This implies that this sample is within N spaces from a one belonging to a (BCN). In other words, the (BO) is supported by points in the (BCN). The above observation allows us to state the following property of oscillations.

Property 3. I : In a root signal, it is necessary for any (BO) to be within N points of a (BCN).

Fig. 5 illustrates property 3.1. Let us now consider the root structure of max/median filters and assume that the binary sample to(m, n) is invariant. If this point is a zero, then there can be no more than N ones along any filter direction. If there were more than this, the output of the max/median filter would increase the signal at this point. This implies that a sample of value one in a (BCN) must be separated by at least N zeros from another one in a different (BCN). So we can see that for a zero to be in- variant to max/median filtering, it is a necessary and suf- ficient condition that the median value of each of the four windows be zero.

Next assume that the sample to(m, n) is a one. If the output of the max/median filter at this point is to be a one then there must be at least N + 1 ones in at least one of the window directions, and thus, the point to@, n) can be part of either a (BCN) or a (BO). If the point is part of a (BO), the (BO) must be attached to at least one (BCN) since by property 3.1 a (BO) cannot exist by itself. Thus, we have proved the following theorem.

ARCE AND MC LOUGHLIN: THEORETICAL ANALYSIS OF MAXIMEDIAN FILTER 65

Theorem 3.3: For a binary signal to be a binary root to the max/median filter, it is sufficient that it be composed of (BCN) and (BO) structures. Moreover, samples of value one in different (BCN) must be separated by at least N zero samples.

Let a k-level signal be a root to the max/median filter, then the threshold decomposition property of the max/me- dian operation implies that the thresholded sequences ob- tained from (3.1) are also invariant. Thus, we can con- struct a k-level root by combining binary roots in a manner consistent with the stacking property of threshold decom- position [ 5 ] .

Let (BCN)i, (BO)' , and denote the binary struc- tures at the ith thresholding level. From the stacking prop- erty of threshold decomposition and theorems 3.1-3.3, we can analyze the geometrical structure of multilevel root signals of the max/median signals. The next property fol- lows directly from the definitions of the binary structures and defines k-level root signal structures based on the stacking of the binary structures.

Property 3.2: Let {a( * , .)> be a multilevel root signal of the max/median filter, and {tb( e , e ) > be the ith thresh- olded binary plane, then the following relations hold.

a) &(m, n) E (BCN)' tb+'(m, n) E (BCN) '+ ' , or

b) tb(m, n) E (BO)' * ( B O ) ' + ' . c) &(m, n> (BZ)' . From the previous property, if a signal is constructed

by the concatenation of binary root signals preserving the stacking property, then this resultant signal is a root.

Let us now address the convergence of input signals to roots, and also the effect of increasing the window size, on the root signal set. First, we treat nonrecursive oper- ations. It has been shown [l 11 that in the case of the one- dimensional median filter, a root signal for a window size of 2N + 1 points is also a root for any smaller window size. However, the signal shown in Fig. 6 is not a root for a maxlmedian filter of window size 3 even though it is a root for a window size of 5 or 7.

If Qr denotes all the nonrecursive 2N + 1 max/median filter roots, then 3 0: and Qf 3 0;". Hence, a signal which is a root signal for a window length 2N + 1 is not necessarily a root signal for a filter of smaller win- dow size. As in the case of median filters, by repeatedly max/median filtering a signal, we obtain a root signal. This is stated in the next theorem for a window of size 3 and the proof is shown in Appendix A.

Theorem 3.4: If a k-level signal is repeatedly max/me- dian filtered with a window of size 3, the filtered signal will converge to a root.

While we have not shown that a two-dimensional signal will converge to a root for any window size, we speculate that theorem 3.4 will hold in general. After running many simulations, we have not yet discovered a signal that would not converge. Indeed, if such a signal does exist, it must be highly structured and is not of practical interest.

The root signal set properties are now considered for recursive operations. The recursive max/median filter,

tb+'(m, n) E (BO) '+ l .

0 0 0 0 0 0 0 0 2 0 0 0 0 3 0 3 0 0 3 3 0 3 0 3

0 0 0 0 3 0 0 0

0 0 0 0 0 0

0 0 0 100 3 3 0 0 0 0

0 0 0 3 0 0

Fig. 6 . Root signal for window size 5 or 7.

defined in (3.2), replaces the point a(i, j ) with the output of the max/median filter before shifting the window to the next point. It is straightforward to see that any invariant signal to the standard max/median filtering is also in- variant to the recursive max/median filter. In short, Q; z Q; and Q," 2 Q ;, where Q is the set of all roots to the recursive max/median filter with parameter N . Also, as in the nonrecursive case, O F + ' 3 0; and 0; 3 Q N + 1

Property 3.3: By repeatedly recursively maxlmedian filtering a signal with a window of size 3 or 5 , once a point (i, j ) is increased by the max/median filter, it may never be decreased again.

Pro08 First let us consider the thresholded binary signal. For a point located at to(m, n) to change from a zero to a one, there must be at least N + 1 ones running in at least one direction. For a window size of 3 or 5 , this means that the output point must be a part of N + 1 ones running in the same direction. Thus, we see that once a point in the binary plane undergoes a zero to one trans- formation, it becomes invariant.

For the k-level signal to increase from i to i + I at point a(m, n ) , the thresholded signals from i + 1 to i + 1 must undergo a zero-to-one transformation. Since by the above argument these points are invariant, the point a(m, n) can- not decrease from this level.

The next theorem follows from property 3.3. Theorem 3.5: An arbitrary signal will converge to a

root signal after repeated passes of the recursive max/me- dian filter of window size 3 or 5 .

Pro08 By property 3.3 we see that it is not possible for any point a(m, n) to temporally oscillate. Hence, the signal must eventually become invariant to further filtering. 0

As with the standard max/median filter, we again spec- ulate that theorem 3.5 will hold for any window size (2N + 1). We have found in our simulations that the recursive maxlmedian filter, in general, will converge to a root sig- nal faster than in the standard case. In addition, as we have seen in the examples of the previous section, the recursive operation tends to produce a smoother signal. Recall that for the one-dimensional recursive median fil- ter, a root signal is produced by one filter pass [l l]; on the other hand, the recursive max/median filter will, in general, require more than one pass over the data to pro- duce a root signal.

r .

IV. STATISTICAL PROPERTIES OF THE MAX/MEDIAN FILTER

The smoothing performance of a filter can be described by the output statistics of the filter. To accomplish this,

66 IEEE TRANSACTIONS ON ACOUSTICS, SPEECH, AND SIGNAL PROCESSING, VOL. ASSP-35, NO. 1, JANUARY 1987

we need an accurate statistical description of the input sig- nal. Although in many applications this may be possible, in image processing this has proven to be most difficult since images are nonstationary signals with many discon- tinuities (edges). Due to this structural characteristic of images, a global accurate image source model cannot be obtained. It is possible, however, to statistically describe the effect of the filter on homogeneous regions. The effect of the filter on discontinuities is best described by the de- terministic analysis of Section 111.

In this section we will determine the output distribution function for the output of the max/median filter with pa- rameter N (window size 2N + l), when the input consists of independent samples from a random variable X with distribution function Fx(x) = P(X I x) (this assumption is valid in the smooth areas of images). The output of the maxlmedian filter is yi,j = max (Z , , Z2, 5 , Z,), where the variables Z’s are defined in (2.2). Define the Ml set as

M I = (samples generating 2, and excluding xi , j ) ,

for 1 I I I 4. The first-order output distribution function of the max/ median output is

FY(Y) = FZ,,Z2,Z,,,(Y> Y ? Y , Y )

P(Yi,; I Y ) = fYZ, 5 Y , 2 2 5 Y ? Z3 I Y , Z4 5 Y ) .

or

Define the event

B(K, 0, y ) = (at least K samples in the set 0 are I y),

then the output distribution function can be written as

P(Yi.j 5 y ) = P(B(N + 1, M1 u Xi,] 2 Y > , B(N + 1,

M2 U xi,;7 Y ) , B(N + 1, M3 U xi,j7 Y ) ,

B(N + 1, M4 ‘J xi.j > Y)).

Using the law of total probability, we can write this func- tion as

P(yi,; 5 y ) = [P(B(N + 1, M1 U xi,j > Y ) 9 B(N + 17

M2 U xi,j, Y ) , B(N + 1, M3 U Xi , j> Y ) ,

B(N + 1, M4 U xi,j, Y)/xi,j I Y> P(xi,j

5 y)] + [P(B(N + 1 7 MI U xi,j > Y>,

B(N + 1, M2 u xi,j, B(N + 1 ,

M3 U xi,j 3 Y ) , B(N + 1 3 M4 U xi,j 3 Y )

/xi,j > Y> P(xi,j > Y ) or P(Yi,j I y ) = P(B(N, MI, Y ) , W N , M2. Y ) , B(N, M3, Y ) ,

B(N, M4, y ) ) Fx(Y) + P(B(N + 17 MI, Y ) >

B(N + 1, M2, Y > , B(N + 1 7 M3, Y ) , B(N

+ 1, M4, y>> [1 - Fx(Y)l.

0.00 ,125 ,250 3 7 5 ,500 .625 ,750 ,875 1.00

(a)

300

,150

0.00 0.00 375 .750 1.125 1.50 1.875 2.250 2.625 3.00

(b)

Fig. 7. (a) Density functions for median and maximedian filtered signals when input noise is: (a) uniform (0, l), (b) exponential.

Since samples from different sets M ’ s are mutually exclu- sive, then the first-order distribution for i.i.d. inputs is

+ I : (”) F&y) [1 - F x ( y ) 1 2 q 4

= N + l , j

As an example, consider the filtering of i.i.d. uniformly distributed noise. Fig. 7(a) shows the density of the fil- tered variables using a cross median filter of window 3 and a max/median filter of the same size. Clearly, the max/median filter produces asymmetry in the density on the filtered variates. Fig. 7(b) shows the same filtering operations on exponentially distributed noise.

Because of the maximum operator applied on the 2 vari- ables, we expect the output to be a biased estimator of the signal. This is shown in the following property.

ARCE AND MC LOUGHLIN: THEORETICAL ANALYSIS OF MAXIMEDIAN FILTER 67

Property 4. I : The output of the max/median filter is a median biased estimator.

Proof: Recall that the i.i.d. input samples have a dis- tribution function Fx(x) = P(X I x), Let the median of the input samples be x"; hence, Fx(x") = 0.5. Then the output distribution at the median X is

j = N j = N + 1

Since 2N

j = O ( y ) = 22N, and (7) = ( 2N ), 2 N - j

then

(4 .2)

Expanding the terms, we have 8 N f 1

Fy(x") = (:) b8N-3 + 324N-2 ( N ) 2N

+ 2-3 (:TI. But

* (2N - 1) . (2N - 3) * *

N!

Replacing the above inequality in (4.2), we get

F y ( 9 < i. 0

The bias introduced by the estimator can be subtracted from the filtered signals. The mean of the output variates gives a measure of the bias. In most cases, finding the mean of the output of the filter by use of (4 .1) can be computationally very tedious and, in many cases, it can only be tabulated since closed-form expressions are not obtained. However, bounds on the mean of the output can be obtained.

Property 4.2: Let p,, py, pz be, the expected values of the input, output, and 2 variables, respectively. If we de- fine the standard deviation of the 2 variables as uz, then

pz I py I p z + .,A.

p, I py I px + a, A. Moreover, if the input samples have a symmetric distri- bution, then

Proof: It is shown in [12] that if Zi (i = 1, 2 , * - , k) are possible dependent variates, each with mean p z and variance 02 , then for any constants ai,

where Z(i ) are the ordered variates. Letting pZ(,) be the ex- pected value of the ith ordered variate Z(i ) , and noticing that

r

P Z ( i ) 5 rpqi,, i = 1

and k

c PZ(i, 2 (k - r + l)Pqi), i = r

then combining (4.3) with k

we get

In the max/median filter case, r = k = 4 ; hence, property 4.2 follows.

In particular, we next show the bounds for some im- portant distribution functions. These expressions are de- rived from expected values of order statistics in [6]. These populations are selected for a wide range of the spread of the probability mean (kurtosis).

Uniform Distribution: U( -;, 1) with kurtosis 1.8

where B(r, s) is the beta function defined as [r(r) I'(s)]/ r(r + s)] and r(r) is the gamma function.

Normal Distribution: N ( 0 , 1) with kurtosis 3.0

3a B(N + I ,$) 0 I PLY I [- (1 + Al(N + 4 )

2 B(N + 1, i) 39 23 1 72 252

+ - n2A2(N + 4 ) + - a3A3(N + 4 )

+ . . . ) ] ' I 2 ,

where = [x(x + 2 ) (x + 4 ) * - (x + 2k - 211 Laplace Distribution: f ( x ) = 0.5e- lX1, with kurtosis 6.0

3B(N + 1, 3) B(N + 1, 4) B(N + 1 , ;)

B(N + 1, $) + + . . . ) ] l i 2 . B(N + 1, $)

68 IEEE TRANSACTIONS ON ACOUSTICS, SPEECH, AND SIGNAL PROCESSING, VOL. ASSP-35, NO. 1, JANUARY 1987

TABLE I

UPPER BOUND FOR THE NORMALIZED BIAS - PY

0.r

Distribution N = 1 N = 2 N = 3 N = 5

Uniform 0.387 0.324 0.288 0.240 Gaussian 1.159 0.926 0.794 0.641 Laplace 1.383 1.026 0.832 0.741

Exponential 1.870 1.583 1.430 1.267

Exponential Distribution: f (x) = e-', x 2 0, with kur- tosis 9.0

( ) I p,

I ( ) +

1 k = l 2 N + 2 - k

1 k = l 2 N + 2 - k 2 N + 2 - k

Table I shows these bounds for diiferent values of N . For larger window sizes, tighter bounds can be obtained by use of asymptotic results. However, in most filtering applications, these large values of N are seldom used.

In order to subjectively (visually) evaluate the perfor- mance of several median-type filters, these filters were applied to a real image. Fig. 8(a) and (b) shows the results of a 9 and a 25 point estimator. Fig. 8(a) shows the clock- wise original image, the image filtered with a nonrecur- sive separable median filter, a cross median filter, and the maxlmedian filter. Fig. 8(b) shows the same sequence when the original is corrupted with additive impulsive noise. Clearly, the max/median filter preserves the image features better than the other filters.

V. CONCLUSIONS In this paper, we introduced a class of max/median fil-

ters. This class of filters belongs to the wide class of gen- eralized ranked order filters. The design criterion for these filters is the preservation of geometrical information in images. By developing theoretical results for the deter- ministic properties of max/median filtered signals, we can understand the filtering effects on signal structures. More- over, the noise smoothing characteristics of the filter can be described statistically. Max/median filtering commutes with thresholding; hence, we showed that this class of filters has the threshold decomposition property, which makes the analysis of the filter simpler. From the theo- retical analysis and the filtering of real data, we have shown that this class of filters is very effective for remov- ing noise as well as for preserving geometrical signal in- formation.

APPENDIX A PROOF OF THEOREM 3.4

From the threshold decomposition property, it is suffi- cient to prove the convergence of binary root signals.

In the max/median filtering process, if the first point to be modified by the filter consists of a zero-to-one trans-

(b) Fig. 8. (a) Noiseless filtering (9 point estimators). Upper left: original.

Upper right: separable. Lower left: max/median. Lower right: Cross me- dian. (b) Impulsive noise filtering (25 point estimators). Upper left: noisy signal. Upper right: separable. Lower left: maximedian. Lower right: cross median.

formation, then the point becomes invariant. This follows from the fact that for a point to(m, n) to make a zero-to- one transformation, there must be two ones running in at least one direction. For a window of size three, this means that both of these points must be adjacent to the point (m, n). Because no points up until now have made a one-to- zero transformation, the point (m, n) must become inva- riant since it will have at least one neighbor that equals one on the next pass. Since all ones are invariant on the edges of the signals, after repeated rnax/median filtering, binary signals will be bordered by an invariant region. If we consider the first nonedge point in the two-dimen- sional signal, then, by the above argument, this point can- not oscillate indefinitely. Thus, it will converge to a zero

ARCE AND MC LOUGHLIN: THEORETICAL ANALYSIS OF MAXIMEDIAN FILTER 69

Or a one. BY applying an inductive argument, it can be [ l l ] T. A. Nodes and N. C. Gallagher, “Median filters: Some modifica-

Seen that all points must become invariant. C] tions and their properties,” IEEE Trans. Acoust., Speech, Signal Processinp. vol. ASSP-30. Oct. 1982.

[12] H. A. Davvid, Order Statistics, 2nd ed. New York: Wiley, 1981. ACKNOWLEDGMENT

The authors would like to thank P. J. Warter for some very illuminating discussions.

REFERENCES G. R. Arce and N. C . Gallagher, “State description of the root signal set of median filters,” ZEEE Trans. Acoust., Speech, Signal Process- ing, vol. ASSP-30, pp. 894-902, Dec. 1982. J. P. Fitch, E. J. Coyle, and N. C. Gallagher, “Threshold decom- position of multidimensional ranked order operations,” IEEE Trans. Circuits Syst., vol. CAS-32, pp. 445-50, May 1985. T. S. Huang, Ed., Two Dimensional Signal Processing II. Topics in Auvlied Physics, Vol. 43. Berlin, Germany: Springer-Verlag, 1981.

Gonzalo R. Arce (S’82-M’82) was born in La Paz, Bolivia, on September 20, 1957. He received the B.S.E.E. degree from the University of Ar- kansas, Fayetteville, in 1979, and the M.S. and Ph.D. degrees in electrical engineering from Pur- due University, West Lafayette, IN, in 1980 and 1982, respectively.

Since 1982 he has been an Assistant Professor in the Department of Electrical Engineering at the University of Delaware, Newark. His research in- terests include statistical and multidimensional signal processing.

Michael P. McLoughlin (”85) was born in Bryn Mawr, PA. He received the B.S. and M.S. de- grees in electrical engineering from the University of Delaware, Newark, in 1983 and 1984, respec- tively.

In 1985 he joined the Staff of the Johns Hop- kins Applied Physics Laboratory in Laurel, MD. He is currently working in the area of underwater acoustics, signal processing, and detection the- ory.

Mr. McLoughlin is a member of Eta Kappa Nu and Tau Beta Pi.