minimum mean absolute error stack filtering with ...moncef/publications/min-mean-absolute.pdf ·...

14
IEEE TRANSACTIONS ON ACOUSTICS. SPEECH. ANI) SIGNAL PROCESSING. VOL 3X. NO. 6. JUNE IYYO ‘)ss Minimum Mean Absolute Error Stack Filtering with Structural Constraints and Goals Abstract-Two approaches have been used in the past to design or choose a rank-order based filter to estimate a signal from a noise-cor- rupted observation of that signal: the structural approach and the es- timation approach. In the structural approach, the goal is to find a filter which preserves those shapes that are part of the signal while removing those that are part of the noise. In the estimation approach, the goal is to find a filter which best estimates the desired signal given the noise-corrupted version of the signal as the filter’s input. This paper develops a theory for the structural behavior of stack filters. This theory provides a test which can determine if a given stack filter has any root signals; a method for classifying the root signal be- havior of any stack filter found to have roots; and, perhaps what is most important, a method for designing stack filters with specific root signals or other structural behavior. This theory of root signals for stack filters is then combined with the theory of minimum mean ab- solute error stack filtering. This new, unified theory allows the de- signer to pick a filter which minimizes noise subject to constraints on its structural behavior. I. INTRODUCTION NOWLEDGE of the set of signals or signal structures K which are either invariant to or are eliminated by a particular filtering operation can be helpful in determining if that operation is appropriate for the application at hand. Indeed, the success of some types of filters in certain ap- plications can often be understood in an intuitively satis- fying way with this approach. This is the case, for instance, with median filters. These filters preserve signals, called root signals, whose struc- ture consists of strings of m@notonic “edges” and con- stant-valued regions [ 11, [2]. They eliminate signal struc- tures which are impulsive in nature since repeated filtering of a signal with a median filter will eventually reduce that signal to a root signal [l]. These two facts indicate that the median filter should be very good at removing impul- sive noise from signals and images which are similar to root signals. This, as discussed, for example, in [l] and [2], has led to the use of median filters in many applica- tions in digital image processing. The goal of this paper is to extend the use of these con- cepts of the preservation, removal, and modification of specific signal structures to the set of filters known as stack filters [3]. These filters can be considered a generalization of median filters since each stack filter possesses two of the fundamental properties of the median filter: the weak Manuscript received July 28, 1988: revised July 24. 1989 The authors are with the School of Electrical Engineering, Purdue Uni- versity, West Lafayette, IN 47907. IEEE Log Number 9034979 superposition property known as the threshold decompo- sition [4]; and the ordering property [SI called the stack- ing property in [3]. Since their definition is motivated by the properties of the median filter, it should be possible to characterize stack filters by the signal structures they preserve or delete. This paper shows that it is possible to design a stack filter which minimizes the mean absolute error subject to constraints on, or goals for, its behavior with regard to any list of signal structures specified by the designer. Spe- cifically, it is shown that a linear program can be used to determine if any stack filter of a particular window width has the desired structure-preserving or deleting proper- ties. If some do, then the linear program selects one of these which is the best in the sense that it minimizes the mean absolute error between its output and the desired signal. Thus, this approach unites the structural approach and the estimation approach to the design of stack filters under a single analytical methodology. The results in this paper should be of great interest to workers in the field of mathematical morphology [6]-[8]. Stack filters contain all compositions of the erosion, di- lation, and open and close operations in morphology, and when appropriately generalized [9], [lo], they also con- tain all gray-level morphological operators [8]. The re- sults in this paper thus provide the first precise analytical tools for morphological filter design. Previous efforts in morphology have relied primarily on procedures for the synthesis of complex filters from sim- pler filters, such as erosions and dilations (max and min operations in specific windows called structuring ele- ments) and open and close operations, whose behavior is well understood. As can be seen in the multiple structur- ing element approach developed in [ l l ] and [12], this synthesis approach is quite successful when followed by someone skilled in the art. It does, however, consider only a subset of the set of stack filters and it does not account explicitly for the statistics of any noise process that might be present. The results in this paper should be especially helpful with regard to this last matter. The work in this paper on the characterization of the root signals of stack filters can be considered a general- ization of the work in [ 131, in which a tree structure was developed to describe the set of binary root signals of me- dian filters. An extension of this work to multilevel sig- nals was performed in [14]. A great deal of other work is now available on the root signals of one- and two-dimen- 0096-3518/90/0600-09SS$Ol .OO 0 1990 IEEE

Upload: tranhanh

Post on 15-Mar-2018

214 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: Minimum mean absolute error stack filtering with ...moncef/publications/min-mean-absolute.pdf · signals or other structural behavior. ... NOWLEDGE of the set of signals or signal

IEEE TRANSACTIONS ON ACOUSTICS. SPEECH. ANI) SIGNAL PROCESSING. VOL 3X. NO. 6 . J U N E IYYO ‘)ss

Minimum Mean Absolute Error Stack Filtering with Structural Constraints and Goals

Abstract-Two approaches have been used in the past to design or choose a rank-order based filter to estimate a signal from a noise-cor- rupted observation of that signal: the structural approach and the es- timation approach. In the structural approach, the goal is to find a filter which preserves those shapes that are part of the signal while removing those that are part of the noise. In the estimation approach, the goal is to find a filter which best estimates the desired signal given the noise-corrupted version of the signal as the filter’s input.

This paper develops a theory for the structural behavior of stack filters. This theory provides a test which can determine if a given stack filter has any root signals; a method for classifying the root signal be- havior of any stack filter found to have roots; and, perhaps what is most important, a method for designing stack filters with specific root signals or other structural behavior. This theory of root signals for stack filters is then combined with the theory of minimum mean ab- solute error stack filtering. This new, unified theory allows the de- signer to pick a filter which minimizes noise subject to constraints on its structural behavior.

I. INTRODUCTION NOWLEDGE of the set of signals or signal structures K which are either invariant to or are eliminated by a

particular filtering operation can be helpful in determining if that operation is appropriate for the application at hand. Indeed, the success of some types of filters in certain ap- plications can often be understood in an intuitively satis- fying way with this approach.

This is the case, for instance, with median filters. These filters preserve signals, called root signals, whose struc- ture consists of strings of m@notonic “edges” and con- stant-valued regions [ 11, [2]. They eliminate signal struc- tures which are impulsive in nature since repeated filtering of a signal with a median filter will eventually reduce that signal to a root signal [ l ] . These two facts indicate that the median filter should be very good at removing impul- sive noise from signals and images which are similar to root signals. This, as discussed, for example, in [ l ] and [2], has led to the use of median filters in many applica- tions in digital image processing.

The goal of this paper is to extend the use of these con- cepts of the preservation, removal, and modification of specific signal structures to the set of filters known as stack filters [3]. These filters can be considered a generalization of median filters since each stack filter possesses two of the fundamental properties of the median filter: the weak

Manuscript received July 28, 1988: revised July 24. 1989 The authors are with the School of Electrical Engineering, Purdue Uni-

versity, West Lafayette, IN 47907. IEEE Log Number 9034979

superposition property known as the threshold decompo- sition [4]; and the ordering property [SI called the stack- ing property in [3]. Since their definition is motivated by the properties of the median filter, it should be possible to characterize stack filters by the signal structures they preserve or delete.

This paper shows that it is possible to design a stack filter which minimizes the mean absolute error subject to constraints on, or goals for, its behavior with regard to any list of signal structures specified by the designer. Spe- cifically, it is shown that a linear program can be used to determine if any stack filter of a particular window width has the desired structure-preserving or deleting proper- ties. If some do, then the linear program selects one of these which is the best in the sense that it minimizes the mean absolute error between its output and the desired signal. Thus, this approach unites the structural approach and the estimation approach to the design of stack filters under a single analytical methodology.

The results in this paper should be of great interest to workers in the field of mathematical morphology [6]-[8]. Stack filters contain all compositions of the erosion, di- lation, and open and close operations in morphology, and when appropriately generalized [9], [lo], they also con- tain all gray-level morphological operators [8]. The re- sults in this paper thus provide the first precise analytical tools for morphological filter design.

Previous efforts in morphology have relied primarily on procedures for the synthesis of complex filters from sim- pler filters, such as erosions and dilations (max and min operations in specific windows called structuring ele- ments) and open and close operations, whose behavior is well understood. As can be seen in the multiple structur- ing element approach developed in [ l l ] and [12], this synthesis approach is quite successful when followed by someone skilled in the art. It does, however, consider only a subset of the set of stack filters and it does not account explicitly for the statistics of any noise process that might be present. The results in this paper should be especially helpful with regard to this last matter.

The work in this paper on the characterization of the root signals of stack filters can be considered a general- ization of the work in [ 131, in which a tree structure was developed to describe the set of binary root signals of me- dian filters. An extension of this work to multilevel sig- nals was performed in [14]. A great deal of other work is now available on the root signals of one- and two-dimen-

0096-351 8/90/0600-09SS$Ol .OO 0 1990 IEEE

Page 2: Minimum mean absolute error stack filtering with ...moncef/publications/min-mean-absolute.pdf · signals or other structural behavior. ... NOWLEDGE of the set of signals or signal

sional rank-order filters (see, for instance, [ 1]-[3], [ 131- [18], and the extensive reference list provided in 1191).

This paper is organized as follows. Section I 1 reviews the definition of stack filters and the new estimation the- ory that has been built around them. In Section 111, a gen- eral approach to the definition and properties of binary root signals of stack filters is developed. Specifically, this section leads to a characterization of binary root signals of stack filters as cycles in a directed graph. The theory of root signals is combined, in Section IV, with the esti- mation theory to produce tests for specific structural be- havior and noise minimization. The theory in the previous sections is generalized to the multilevel case in Section V. Section VI contains conclusions and points to some further work that is needed.

11. STACK FILTERS A N D MAE ESTIMATION A . The Dejinition of Stack Filters

Let R ( j ) be the process at the input of a stack filter. Assume R( j ) takes on values in Q = { 0, 1, 2 , . . . , M - 1 } . A window of width n slides, by increments of one sample, across the input process R ( j ). At each time in- stant j , the stack filter S, ( * ) maps the samples in the win- dow, which are

to some integer S, ( R,l ( j ) ) in Q. The mapping Sf ( . ): Q” + Q defining the stack filter is required to have the threshold decomposition structure

M - I

where

decomposition property 131. This is a weak superposition property which is made precise in the second equality in the following equation:

( 2 . 5 )

The class of stack filters and generalized stack filters includes all rank-order operators, all compositions of rank-order operators, and any morphological filters which are compositions of dilation and erosion operators. The number of stack filters of window width n grows faster than 2”’ ’ [ 2 I ] .

B. Optimal Filtering over the Class of Stack Filters The optimal filtering problem over the class of stack

filters can be stated as shown in Fig. 1. The process R ( j ) at the input of a stack filter is as-

sumed to be a corrupted version of some desired process S ( j ). The corruption may be caused either by a noise process N ( j ) or by some intentional operation, such as a modulation scheme.

At each time instant j , the stack filter output is an esti- mate, called s( j ), of the desired process S ( j ). This es- timate is based on the observed sequence z,l ( j ) in the window of the stack filter: thus,

S ( j ) = S / ( K , ( j ) ) . ( 2 . 6 ) The goal is to pick a stack filter from the class of win-

dow width n stack filters such that the average mean ab- solute error per time uni t between the filter’s output and the desired signal is minimized. If S ( j ) and R ( j ) are jointly stationary, then the cost to be minimized is

E [ I S ( j ) - S J ( ~ t l ( j ) ) l ] . (2 .7) The rationale of using the absolute error criterion is that

it nicely reduces the estimation error of the stack filter to the sum of the decision errors incurred by the Boolean filters on each level of the threshold decomposition archi- tecture. To illustrate this fact, let sa( j ) = T k ( S ( j ) ) ; then

in which

andf( ) is the Boolean function used on each level in the architecture. The Boolean function f ( * ) is required to possess the stacking property [3].

The stacking property requires that whenever the Bool- ean function on level 1 puts out a 1, the Boolean functions on every level below level I must also put out 1’s. From this requirement, and the requirement that the same Bool- ean function be used on every level of the filter, it follows that only positive Boolean functions are allowed [20].

Any digital filter that can be realized by (2 .2 ) with f ( * ) being a positive Boolean function possesses the threshold

(by threshold decomposition)

(by the stacking property)

E [ I S I ( ~ ) - - f ( T ~ ( E l l ( j ) ) ) l ] . ( 2 . 8 ) M - I

I = l

Page 3: Minimum mean absolute error stack filtering with ...moncef/publications/min-mean-absolute.pdf · signals or other structural behavior. ... NOWLEDGE of the set of signals or signal

G A B B O U J A N D C O Y L E : M I N I M U M M E A N A B S O L U T E ERROR STACK F I L T E R I N G 957

I t

N ( t ) Sf(.) = S(.) = N e s t Estimate o l S( t )

Fig. I . Structure of the optimal filtering problem

Because of the above reduction, and since a stack filter is completely defined by the Boolean function on each level of its architecture, the cost function to be minimized can be expressed in terms of a linear function of the output variables of the Boolean function f( ) 191, [ 101, [22].

Let the output o f f ( * ) when the length n binary se- quence ;, is at its input be called the decision variable Pf ( 1 I ?,) E { 0, 1 } . This decision variable specifies the probability that the filter output is a 1 when the vector i', appears in the filter's window. The Boolean functionfc ) can therefore be represented as a length 2" vector P, , whose kth entry is Pf ( 1 I zA). With these definitions, the mean absolute error in the last equation in (2.8) can be reformulated as the following cost function:

2"

cost = c c, P f ( 1 I i',). (2.9) J = I

C, can be interpreted as the cost incurred by f( ) for de- ciding a l when seeing i',. Note that this cost function is a linear function of the filter decision variables.

The stacking constraints can be expressed as a set of inequalities in terms of these decision variables; specifi- cally,

Pf(II; ,) I P t ( I l ? , ) i f ? l 5 i', (2.10)

where for any two length n real sequences i' and ?, ? I ? if and only if each entry of i' is less than or equal to the corresponding entry in T .

The optimal filtering problem over the class of stack filters under the mean absolute error criterion can there- fore be formulated as an zero-one integer linear program, the goal being to determine whether each P, ( 1 I ?,) should be 0 or 1.

By exploiting the structure of the constraint matrix, which is totally unimodular (TUM) [23], this zero-one integer linear program can be formulated as the following linear program [22]:

2"

minimize C C, P, ( 1 I 2,) (2.11) , = I

subject to the constraints

p j ( l l i ' l ) 5 P,(lIi',) if ?, I ?, (2.12)

O I ~ , ( l l i ' ~ ) I 1 vi. (2.13) The linear programming formulation of the optimiza-

tion problem has a very nice interpretation in terms of the behavior of the Boolean operatorf( ). The constraint in (2.13) implies that the filter is allowed to randomize its

decision [22]. The quantity P,( 1 I S i ) is the probability the filter puts out a 1 when the binary sequence ?, is ob- served. The filter is thus allowed to make soft decisions.

Even with this extension to soft decisions, there is al- ways an optimal filter which makes hard decisions. This follows from the total unimodularity of the constraint ma- trix consisting of (2.12) and (2.13).

For convenience, the probabilistic stacking constraint will also be referred to in most discussions in this paper as the stacking constraint.

It is worth mentioning here, since it affects the com- plexity of the algorithms developed later in this paper, that the stacking constraint in (2.12) has many redundant equations. This redundancy can be reduced by consider- ing the set of all local stacking constraints [22]; that is, a decision variable Pf ( 1 I Z j ) is subject to a stacking con- straint by another decision variable P, ( 1 I ?;) only if Si 5 ( 2 ) ;; and d H ( ?;, ai) = 1 , where d H ( ?;, ?,i) is the Hamming distance between the binary sequences ?; and zj. This reduces the set of inequalities in (2.12) to a much smaller set of inequality constraints [22].

In the rest of this paper, the above estimation-based ap- proach is united with the structural approach to the design of stack filters. As will be seen after the appropriate ma- chinery is developed, this unification can be achieved by adding constraints to the linear program in (2.1 1)-(2.13) or by modifying the cost function of the linear program.

111. ROOT SIGNALS FOR STACK FILTERS According to (2.5), filtering an M-valued signal by a

stack filter S, ( * ) based on the positive Boolean function f ( e ) reduces to filtering each of its ( M - I ) binary threshold signals by the binary stack filterf( * ).

Consider, for instance, an M;valued signal i. Then, as will be shown in Section V, R is invariant to the stack tlter Sf ( - ) if and only if each binary threshold sig_nal of R is invariant to the filterf( ). Thus, if the signal R is to be preserved by S, ( ), then each of its binary threshold signals must be pres5rved b y f ( * ). On the other hand, if the M-valued signal R must be altered by S, ( ), then the filterf( ) must t t e r at least one threshold signal of the M-valued signal R.

Thus, to study the root signal behavior of a stack filter, it is best to begin with a study of the set of binary roots of the filter. The extension to multilevel root signals will be carried out in Section V .

We start with some definitions and notation from graph theory [23], [24] which will be used throughout the paper.

Definition 3. I : Let 3 = ( V , E ) denote a digraph, or a direcred graph, where V = { o1, U ? , , z i A } is the set of nodes and E is the set of edges in the graph. Each edge is denoted by an ordered pair ( q , v i ) , which indicates that there is an edge originating in node vi and terminating in uj. The vertices which are at the ends of an edge are said to be incident with the edge, and that edge is said to be incident with those vertices. Two vertices (or nodes) which are incident with a common edge are adjacent, as are two edges which are incident with a common vertex.

Page 4: Minimum mean absolute error stack filtering with ...moncef/publications/min-mean-absolute.pdf · signals or other structural behavior. ... NOWLEDGE of the set of signals or signal

958 1t.t.t. ‘TRANSACTIONS ON ACOUSTICS. SPt.t.CH. ANI) SIGNAL. PKOCESSIN(;. VOI. 3 X . NO 6 . JLINE 1440

An edge with identical ends is called a loop. and an edge with distinct ends is called a link. The in-degree of a node 21 is the number of edges of the form ( U , Z J ) E E . The out- degree of a node 21 is the number of edges of the form ( 2 1 ,

U ) E E. De$nition 3.2: A walk is a sequence of nodes w = { ill,

U>, - * , u A } , with k I 1 , such that ( 2 3 , U / + , ) E E for a l l j = 1, * * . , k - 1. If k > 1 and u1 = uL, w is called a closed walk. A path is a walk without repeated nodes. A closed path, a cycle, or a circuit is a closed walk with no repeated nodes other than the first node. This is some- times referred to as elementary cycle or elementary cir- cuit.

Two elementary cycles are said to be equivalent if they share one or more nodes or they can be linked by other elementary cycles sharing one or more nodes. Note that any directed graph can be partitioned into equivalence classes of sets of elementary cycles. Two elementary cycles are identical if they are cyclic permutations of each other.

In the sequel, elementary cycles in a particular type of directed graph will be shown to correspond to root signals with nontrivial long-term behavior. This correspondence relies on the identification of the various binary sequences that appear in the window of a binary stack filter with nodes in a directed graph. We thus need to be precise about our definition of sequences.

Dejnition 3.3: A sequence refers to any finite string of integers. An n-reduced sequence of an original sequence is the original sequence with L n / 2 J samples removed from both ends. A signal is an infinite string of integers.

As an example of an n-reduced binary sequence, con- sider the sequence 11 1001 10; its 5-reduced sequence is 1001.

Throughout the remainder of this section, all sequences and signals are binary unless otherwise specified.

Notation: S, ( ) denotes the stack filter based on the positive Boolean functionf( ). For simplicity, we some- times refer t o f ( * ) as a binary stack filter, or just a stack filter.

A , Root Signals and a Stack Filter’s Digraph Suppose we wish to first determined whether a partic-

ular stack filter has any nontrivial root signals and then, if it has roots, to specify them precisely. Both the exis- tence and nature of the root signals for a stack filter can be determined with the help of the stack filter’s digraph, the construction of which we now address.

The first step in this construction is the development of a digraph which specifies all possible sequences of binary sequences that can be observed as a signal moves through a window of fixed width.

By motion of the signal through a filter window, we mean the legal transitions between sequences observed in the window. For instance, if a window of width 3 slides, one point at a time, from left to right over a signal, then Il+O -+ 101 and 001 -+ 010 are legal transitions, whereas

Fig. 2 . Window width 3 window process digraph

ll+O -+ 010 and 191 + 000 are illegal transitions. The arrow under each sequence indicates the direction in which the filter window advances. The rightmost sample of each new state is the new sample that entered the window. If the input signal is

. . - 0 0 1 1 0 1 0 1 1 ’ * ’

then the observed sequences are w, = 001, w, + I = 01 1, w,+* = 110, w,+? = 101, etc.

Define a window process digraph D,, = ( I/, E ) for a window of width n as follows: Define V to contain 2” nodes and label, without repeats, each node in V with one of the 2” possible binary sequences of length n. The set of edges E is the set of all legal transitions defined as the filter’s window moves from left to right over any signal.

The window process digraph D3 is shown in Fig. 2. It has Z3 nodes and 16 edges. Only connected windows will be considered in this paper; the extension to multiple win- dows which are not connected is not difficult.

Let the sequence which labels nodej in a window pro- cess digraph be called w,. Each w, will be referred to as a “state” of the window process digraph. There is ob- viously a one-to-one correspondence between states and the nodes of the window process digraph.

From the window process digraph D,, for a window of width n , we then construct the stackjlter’s digraph D, for a particular stack filter f ( . ) with window width n . It is this graph which will determine whether the filter f ( ) has roots or not, and which will allow the characteristics of any roots which exist to be determined.

Since f ( . ) is a binary stack filter of window width n, its output, which is binary, is well defined for each of the states of the window digraph. Define ref = L n / 2 J + 1 and ref ( w , ) to be the value of the ref sample of w, from the left. If nodej in ihe window process digraph is labeled with a state w, with ref (w, ) different from f ( w ~ ) , delete this node from the window process digraph. Also delete any edges which were incident upon this node. If the filter output f ( w,) coincides ref (w , ) , then keep node j in the digraph. Carry out this procedure for each node j in the window process graph.

Page 5: Minimum mean absolute error stack filtering with ...moncef/publications/min-mean-absolute.pdf · signals or other structural behavior. ... NOWLEDGE of the set of signals or signal

GABBOUJ A N D COYLE: MINIMUM MEAN ABSOLUTE ERROR STACK FILTERING

Fig. 3 . StacL filter’s digraph for the window width 3 median filter

The graph which results from the above thinning of the window process graph is called the stack filter’s digraph Df for the stack filterf( ).

In the above definition of the window process graph, it is not necessary to assume that the stack filter’s output is to be compared with the ref sample in the window. The output could be assigned any one of the positions in the window. In particular, if the output is assigned the posi- tion corresponding to the rightmost entry in the window, then the filter is causal. For convenience we will always consider the ref position in the window to be the position assigned to the output of the filter. The modifications re- quired for other positions are trivial.

Fig. 3 shows the stack filter’s digraph for the window width 3 median filter. Note that the nodes corresponding to the states “010” and “101” in the window process digraph D3 in Fig. 2 were the only ones deleted to obtain Dmedian. This graph is identical to the one developed in

Dejinirion 3.4: A sequence is said to be a root sequence of the window width n stack filter f( . ) if all samples of its n-reduced version are preserved underf( * ). A signal is said to be a root signal of the stack filter f ( ) if the signal is invariant (a fixed point) to the filter f( e ) . An M-valued root signal is any M-valued signal that is in- variant to Sf ( * ).

The following two lemmas relate root sequences to paths in the filter’s directed graph.

Lemma 1: Any walk in the stack filter’s directed graph Df corresponds to a sequence that is invariant to the filter

, w,,,) be a walk in Of. Following our notation, W,,, can be represented as w I + w * + . . . + w,,,. To find the corresponding sequence, choose w I (and expand it to n samples), say WI = (SI . 1s2. I

sref, IS,,^+ I . I . s,,, I ), where again ref = Ln/2 J + 1. The corresponding sequence looks like sl. I . s,,, I. The next node is w2 = ( s ~ , ~ * . S,<f+I.I - * * s n . I s l i . 2 ) .

Note that w I and w2 have ( n - 1 ) overlapping samples. Now the sequence becomes sI. Is2. I * . * s,,. Is,,.2. Continu- ing this way, the final sequence will be s i . Isz, I - * . s,,,

[131.

f ( * ) . Proofi Let W,,, = ( w l , w2. * .

. . .

. . . s l1~ , , , . Now, we will show that this sequence is in- variant to the filterf( . ); i.e. its n-reduced version is in- variant to f( * ).

First, f ( w I ) = s,.,,: I since s,.,.,, I is the refsample of wI. Then, after the window slides to the right, the next win- dow state will be w2. The filter output at w2 is f( w 2 ) = sr r f+ ,, which is the next sample (to the right) in the se- quence. Proceeding this way, we find that all samples in the n-reduced sequence are preserved under f ( * ); hence, the sequence corresponding to any walk in D, is invariant to the filter f ( * ).

If an original sequence has m samples, its filtered ver- sion will have m - ( n - 1 ) samples. The way the edge effects have been dealt with in the case of median filtering [ 11 is by appending L n / 2 J samples to both ends of the sequence to be filtered. This way, all samples of any orig- inal root sequence will be preserved under f( ); how- ever, this is not the case with stack filters. Therefore, we strictly avoid any notion of repeating the end samples in sequences.

Lemma 2: Any invariant sequence corresponds to a walk in the filter’s dir_ected graph D f .

s ~ + , , , - ~ ) . m > n , is a root sequence for the stack filter f ( * ). To show that the corresponding walk is in D, = (,V, E ), it suffices to show that any n-sample sequence in RI,, is a node in V and any two overlapping n-sarnple sequences (the overlap being ( n - 1 ) samples) in RI,, form an edge that belongs to E. Starting from the left, let wi = ( s i * s i+, , - I ) be the current positen of th_e window. Since wi is an n-sample sequence in R,,, and RI,, is invariant to the filter, f( w i ) = ref( w , ) , which implies that w, E V. The next window state is w i + I = ( s i + I - - * si +,,). Again, by the same argument, w i + I E V . Moreover, wi and wi+ I have ( n - 1 ) overlap- ping samples; hence, ( w i , wi + I ) E E. Continuing this way, we find that all window states are nodes in V and each individual transition (i.e., any tyo adjacent window states) is an edge in E. Therefore, RI,, corresponds to a walk in O f .

The preceding two lemmas show the correspondence between root signals for a stack filter and that filter’s di- graph. One would then expect that the existence of non- trivial root signals-invariant signals of infinite length- would correspond to elementary cycles in the filter’s di- graph. This is the case, as will be shown below after ac- counting for short-term and long-term behavior.

Any root signal is a combination of short-term behavior and long-term behavior segments. The short-term behav- ior of root signals is defined as follows:

Dejnition 3.5: A transient root sequence is a short- term behavior exhibited by a root signal. It (i) must be invariant to the filter and ( i i ) must correspond to a path (i.e., a walk with no repeated nodes) in the filter’s di- rected graph that does not share any edge with any ele- mentary cycle.

By part (ii) of the definition, a transient root sequence must be finite in length since any path in Of will at most

Proof: Suppose RI,, = ( s i *

Page 6: Minimum mean absolute error stack filtering with ...moncef/publications/min-mean-absolute.pdf · signals or other structural behavior. ... NOWLEDGE of the set of signals or signal

960 IEEE TRANSACTIONS ON ACOLIS’IICS. SPEECH. AND SIGNAI- PROCESSING. VOL. 3X. N O 6. JUNE 1990

span all nodes in D , , in which case the path will have length 2” - 1. An equivalence class of transient root se- quences is a set of transient root sequences which are ad- jacent (i.e., share one or more nodes or can be linked by other adjacent transient root sequences).

The second and most important characteristic of root signals is their long-term behavior. Some trivial long-term behavior of root signals occurs when the filter enters the states of all 1’s or all 0’s and stays there indefinitely. By convention, these signals correspond to elementary cycles of unit length. The nontrivial long-term behavior of root signals is characterized by the following definition.

Dejinition 3.6: A nontrivial cyclic root sequence is a long-term behavior exhibited by a root signal and must correspond to an elementary cycle of length greater than 1 in the filter’s directed graph.

Again, note that a cyclic root sequence is a finite string since any elementary cycle in D, has a finite length. Also, note that elementary cycles of unit length correspond to trivial cyclic root sequences. We shall refer to both of these types of behavior as cyclic root sequences. Fig. 4 illustrates these types of behavior for a window width 3 stack filter. Parts (a) and (b) of Fig. 4 show the trivial and nontrivial long-term behavior of root signals, respec- tively, while part (c) shows the short-term behavior of a root signal.

According to the definitions above, transient root se- quences are those paths that link (with no return) equiv- alence classes of sets of elementary cycles (or cyclic root sequences) defined earlier.

We next relate root signals to paths and cycles in di- rected graphs by the following theorem.

Theorem 1: A stack filter f( . ) preserves nonconstant signals if and only if its directed graph Dt contains one or more of the following: (i) a nontrivial elementary cycle; (ii) a path that starts with one of the trivial elementary cycles and ends with the other.

Pro08 See the Appendix. Remarks: Note that (1 ) not every node in Df belongs to

an elementary cycle and (2) some stack filters’ digraphs contain disjoint cycles (two or more cycles which are pairwise disjoint); i.e., they do not share any nodes. This will be particularly interesting when we consider cycle breaking and cycle preserving.

B. Characteristics of Root Sequences Certain patterns (i.e., n-sample sequences) cannot be

part of any root sequence of some particular stack filters. Consider, for instance, the window width 5 optimal stack filter found in an example from [21]:

f(xl , x27 x37 x43 Xg) == xIx3x4 $- x?x’3x4 + x ? x 3 x 5 .

Consider the state w, = (01010); w, belongs to V since f( w,) = ref (w,) (both are zeros). However, if w, + , is the next state, then f (w, + I ) = 0 while the ref ( w , + I ) is 1 (why? Because w , + ~ = 00101 or 10101 andf(0 , 0, I, 0, 1 ) = f( 1, 0, I, 0, 1 ) = 0). Conclusion: no sequence should exhibit the pattern 01010 if it is to be a root se-

(a) (b) (c) Fig. 4. (a) A trivial long-term behavior of a root signal. (b) A nontrivial

long-term behavior of a root signal. ( c ) A short-term behavior of a root signal.

quence for this particular stack filter. In the following, we present some consequences of Theorem 1 pertaining to the characteristics of root sequences.

Consequence I : A root signal cannot contain any pat- tern (i.e., n-sample sequence) whose in-degree is zero. A root signal cannot contain any pattern whose out-degree is zero.

To prove this, suppose that wi E V (so f( wi) = ref ( w ; ) ) and that the in-degree of wi is zero. Hence, wi is not reachable from any other node wj E V and thus wi does not belong to any root signal. Now, suppose that the filter is in state wi which has zero out-degree. The next state of the filter is wi + ,, which is not in V . Therefore, wi cannot be part of a root signal in the first place.

Consequence 2: Any single node wi E V which is com- pletely disjoint from the rest of the digraph and which has no loop represents a pattern that is not allowed in a root signal for that stack filter.

This follows directly from Consequence I . Such a node wi has zero in-degree and zero out-degree; hence, wi can- not be part of any root signal.

C. Disjoint Cycles in Digraphs An interesting characteristic of directed graphs is that

sometimes they contain disjoint elementary cycles. This will prove important in a stack filter design example pro- vided later in this paper.

An important question one might ask, For what window width, if any, is there a stack filter whose directed graph contains disjoint cycles? By enumerating all stack filters of window width less than or equal to 4 and investigating their corresponding directed graphs, we found the follow- ing result.

Theorem 2: No stack filter’s directed graph of any stack filter of window width less than 5 contains disjoint cycles.

On the other hand, there exist stack filters of higher window widths whose digraphs contain completely dis- joint cycles.

Example 3. I : The following is the Boolean expression of a stack filter of window width 5 which is the MMAE filter for a particular filtering problem:

f (x , , x27 x3, x47 xs)

= ~ 1 ~ 3 x 5 + ~ 1 x 4 + ~ 2 x 3 + ~ 2 x 5 + ~ 3 x 4 .

The filter’s digraph contains two cycles which are dis- joint:

Page 7: Minimum mean absolute error stack filtering with ...moncef/publications/min-mean-absolute.pdf · signals or other structural behavior. ... NOWLEDGE of the set of signals or signal

GABBOUJ A N D COYLE: MINIMUM MEAN ABSOLUTE ERROR STACK FILTERING 96 I

Cycle I: 01010 + 10101 + 01010 Root signal: 0101010101010 *

Cycle2: 01100 --t I1000 + I0001 -+ 00011 -P

001 10 -+ 01 100 Root signal: . * * 01 loo01 10001 1 - * * .

D. Enumerating Elementary Cycles in a Digraph Counting the number of elementary cycles in a stack

filter’s digraph was performed by enumerating these cycles using Berztiss’s algorithm [25]. Loops were elim- inated from the graph to give an accurate count of the lengths of the cycles. However, one should note that if the states of all 1’s or all 0’s are among the nodes of a cycle, then that particular sample ( 1 or 0, respectively) can be repeated indefinitely and the resulting signal will still be an invariant signal. The algorithm in [25] has been coded in Fortran and is available at Purdue University, West Lafayette, IN.

E. Bounds on the Number of Elementary Cycles in Df We discussed earlier an algorithm to construct a stack

filter’s digraph for a particular stack filter. Each time, we start with D,, the window process graph displaying the sequence of vectors observed in the filter window as the window slides along the signal, which depends only on the window width of the filter. It contains 2” nodes and 2(2“ - 1 ) edges. Any particular window width n stack filterf( - ) may cause the removal of some nodes and edges from D,. Therefore, D, will contain at least as many el- ementary cycles as the stack filter’s directed graph, Of, corresponding to f( * ). We next tabulate the number of elementary cycles in D, as a function of n (Table I). For fixed n, these numbers are upper bounds on the number of elementary cycles in any stack filter’s directed graph Df with the same window width.

As seen earlier, each elementary cycle corresponds to a root signal, and different cycles correspond to different root signals. One way to characterize elementary cycles for a fixed window width is by cycle length. We next tab- ulate the number of elementary cycles as a function of cycle length k and window width n (Table 11).

The above characterization of elementary cycles by their length raises an interesting question: Can two different cycles span the same set of nodes, and if so, what effects will this phenomenon have on the filter window width re- quired to discriminate between such cycles?

The answer to the first part of this question is clearly yes-different cycles can span the same set of nodes. The last entry on each column of Table I1 proves that such a phenomenon exists. Each entry gives the number of Euler tours (elementary cycles which visit every one of the 2” vertices) present in D,. These tours obviously span the same set of nodes, but each one visits the nodes in a dif- ferent order. This phenomenon is not restricted to Euler tours; different cycles of length less than 2“ may traverse the same set of nodes.

As for the effect this has on the window width of the filter required to discriminate between such cycles, we cite the following.

TABLE I NUMBER OF ELEMENTARY CYCLES AS A FUNCTION OF n

W i n 1 # Eleme;; Cycles

30,174 16,777,216

TABLE 11

WINDOW WIDTH n NUMBER OF ELEMENTARY CYCLES AS A FUNCTION OF CYCLE LENGTH k AND

- - k 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32-

- - n=5

0 1 2 3 6 9 12 20 32 57 78 113 154 208 300 406 538 703 842

1,085 1,310 1,465 1,544 1,570 1.968 2,132

2,480 2,176 2,816 4,096 2948

2,000

- - n=4

0 1 2 3 6 7 8 12 14 17 14 13 12 20 32 16

-

__ - n=3

0 1 2 3 2 3 4 2

- - n=2

0 1 2 1

__

Theorem 3: For any two signals corrcsponding to two elementary cycles in D, which span the same set of nodes, there does not exist a stack filter of window width less than or equal to n that will preserve one signal and alter the other.

The proof of the theorem is straightforward; it is based on the fact that any n-sample sequence (i.e., n adjacent samples) contained in one signal is also contained in the other. Hence, any ( n - k)-sample sequence (k 1 0) contained in one signal is also contained in the other. Therefore, any window width ( n - k) filter that preserves one signal will automatically preserve the other.

The next question is, What is the minimum window width required for a filter to distinguish between any two given signals? Again, we are assuming here that these sig- nals correspond to two different elementary cycles which span the same set of nodes in D,. The following algorithm determines this minimum window width.

Suppose that we have two sequences SI and S, corre- sponding to two elementary cycles CI and C, in D,l. Sup- pose that SI is to be preserved by a window width b filter and S, is to be rejected by the same filter.

Page 8: Minimum mean absolute error stack filtering with ...moncef/publications/min-mean-absolute.pdf · signals or other structural behavior. ... NOWLEDGE of the set of signals or signal

962 lt,t.t .TKANSAC"I IONS O N ACOUSTICS. SPFF.CH. AND SIGNAI. PKOCFSSING. V O L 3X. N O 0. J U N E IW(1

Algorithm I : start: b = ri + 1 rep: Fill out the truth table o f f ( - ) as follows:

l-f(w,) = ref ( w , ) , where w, is any adjacent se-

2-if re f (w, ) = 0 and w, is a subsequence of SI , then for all b-sample sequences u such that u I w,,

quence of b samples in S I .

f (u)=O.

else

for all b-sample sequences v such that U I w,,

Let D = { b-sample sequences w: f ( w ) has not been

if ( { D = 0 } OR { kv nut U subsequence of S2 for any w

f ( v ) = l .

determined by steps 1 and 2 ) .

E D}) then b t b t - 1 goto rep

else stop, b is the minimum window width required

Remark: The algorithm described above is guaranteed to finish in a finite number of iterations since we are as- suming that C, and Cz are elementary cycles in D,, and that they therefore correspond to finite root sequences. Therefore, the worst-case window width is the length of the cycle; if the cycles have length k , then "rep" will be executed at most ( k - n ) times.

IV. MMAE STACK FILTERING WITH STRUCTURAL CONSTRAINTS A N D GOALS

When the LP in Section I1 is used to find a stack filter which minimizes the MAE between its output and a de- sired input signal, it is possible that the resulting filter may possess structural behavior that is not desirable.

For instance, the filter discussed in Example 3.1 is op- timal for a certain noise reduction problem, but it pos- sesses root signals which contain oscillatory structures; specifically, binary oscillations of period 2 are roots of the filter. The designer may, however, consider preser- vation of such binary oscillations to be undesirable struc- tural behavior. This will be the case if it is known that the desired input signal never contains any oscillatory struc- tures.

Alternatively, suppose it is known that the signal to be recovered from the noise has specific structural character- istics. It might, for instance be known that any realization of the desired signal is one of the root signals of the me- dian filter of a certain window width. It could thus be characterized in terms of sequences of structures such as edges and constant-valued regions [ 11, 121, [ 131-[ 181. It would be reasonable in some situations, such as high SNR situations, to specify that these structures be root signals or root sequences of the stack filter.

Of course, the structural constraints or goals may con- sist of a list of different structures to be preserved, de- leted, or modified. The list might appear as follows:

1 ) No oscillations of period 2 shall be preserved by

2) The filter should not alter positive-going edges in

3) Negative-going impulses are to be preserved. 4) A specific set of sequences must be preserved by the

To account for these structural constraints and goals, the LP in (2 . I 1)-(2.13) for finding a stack filter which is best in the MAE sense must be modified. Two approaches are possible: either modify the objective function of the LP or append more constraints. The advantages and dis- advantages of these two methods will be discussed as the methods are presented.

Throughout this section, all sequences and signals are binary unless otherwise specified. The extension to mul- tilevel signals is carried out in Section V.

A . Modihing the Constraints of the LP I ) Preserving Root Signals: In order to preserve any

particular root signal, the elementary cycle (or the com- pound cycle) corresponding to this root signal must re- main in the stack filter's digraph; that is, all nodes in- volved must be in V .

, u k ) make up the cycle we wish to preserve. Since ui belongs to V for i = 1, 2,

, k , Pf ( 1 I ui) is known for i = 1 , * . . , k. It is assigned the value 0 if ref ( U,) = 0; otherwise, it is as- signed the value 1. These k new constraints are then added to the set of constraints in (2.12) and (2.13) of the original LP problem formulated in Section 11-B.

Example 4. I: Suppose that, in addition to minimizing noise, a window width 3 stack filterf( - ) is to preserve oscillations in the signal wherever they occur. This im- plies that we want f ( . ) to preserve the following signal: . . . 010101 . * . . The corresponding elementary cycle is 010 -, 101 + 010. Hence, the following constraints are appended to the LP in (2.11) to (2.13):

( a ) P , ( ~ ( o ~ o ) = 1

(b ) P f ( l ( l O 1 ) = 0.

These new constraints ensure that nodes 010 and 101 will appear in Dfand that oscillations of period 2 are preserved under f ( . ). Alternatively, we can group these two new constraints in one equation as follows:

f ( . ) ( f ( * ) in our binary filter).

the signal.

filter.

Suppose that ( u I , U?, *

. . .

(c ) ( 1 - P / ( 1 ( 0 1 0 ) ) + P / ( l l l O l ) = 0.

Equation (c) above is equivalent to equations (a) and (b) whenever the filter's decisions are hard decisions. This can be generalized'to any k-node cycle. Thus, only one additional constraint per cycle is needed to preserve any set of cycles.

Alternatively, we can use the new constraints to reduce the size of the LP. Let C = { ui: z i i E Cycle} and K = { i : u j E C } . Then P, ( 1 I vi) = r e f ( z i j ) for all 21; E C. This in turn will determine the values of at least I K I un- known probabilities and we are left with at most 2" - I K I

Page 9: Minimum mean absolute error stack filtering with ...moncef/publications/min-mean-absolute.pdf · signals or other structural behavior. ... NOWLEDGE of the set of signals or signal

GABBOUJ A N D COYLE: M I N I M U M M E A N ABSOLUTE ERROR S T A C K FILTERING

_____

963

unknowns for which we must solve. Using the stacking property, more variables may be determined once these 1 K I variables become known. If, for example, P, ( 1 I 110) was set to be 1, then Pf ( 1 I 11 1 ) must also be 1 since 110 stacks on top of 11 1 . We next present a step-by-step al- gorithm to preserve cycle C with 1 K 1 nodes.

Algorithm 2: Step 1- Set Pf ( 1 1 U , ) = ref( U , ) for all U , E C Step 2- If Pf (1 I U , ) = 1 then

for any uJ such that 2.; > U , , set Pf (1 1 uJ) = 1

else

for any vk such that v A < U , , set P f ( l tuA) = 0. Step 3- Solve the reduced LP problem to compute the

remaining unknowns.

2) Removing Cycles: As discussed previously, elimi- nating sequences or signals is equivalent to breaking the corresponding cycles in the stack filter’s digraph. A cycle can be broken by deleting one or more nodes in that cycle.

Assume that vJ is, for some reason, the node to be re- moved from the cycle. Then we must have Pj ( 1 I uJ) = 1 - ref( 2;) . This additional constraint is added to the LP as in the previous subsection.

Note that choosing which node is to be removed is ar- bitrary and might or might not interfere with other fea- tures of the optimal filter (computed based only on the stacking constraints, with minimizing the MAE as the goal). Hence, it would be better if, somehow, this oper- ation of cycle breaking could be introduced to the LP as an additional constraint in such a way that the LP is given the freedom to decide which of the nodes in the cycle is to be removed. The result will be a filter which breaks the cycle in those spots which contribute the most to mini- mizing the mean absolute error.

To illustrate how this can be done, suppose we have a k-node cycle v l , v2, - * , uA that we want to break. Somewhere along the path of the cycle an edge must be removed or, equivalently, an error must be made at one or more nodes (by error, we mean f ( U , ) f ref ( U , ) for some i = 1, 2, * - . , k ) . Consider the following exam- ples.

Example 4.2: Suppose we wish to break the window width 3 cycle 100 -+ 001 -+ 010 --* 100 in the digraph of the stack filter whose Boolean expression is given byf(x, , x2, x3) = x2 + ~ 1 x 3 . Then, one or more of the following must hold:

a )

b)

c )

P/ (1 ) o ~ o ) = 0 -+ Pf(0)OIO) = 1

Pf(l(OO1) = 1 + Pf (O(OO1) = 0

P f ( l ( 1 0 0 ) = 1 -+ Pf(OI100) = 0.

If we wish to break the cycle in all three nodes, we simply require that

Pf(O(O10) + P f ( l ( 0 0 1 ) + P f ( l ( 1 0 0 ) = 3.

If we wish it to be broken only at one or more nodes, then we could require

P,(11010) + P / ( 1 ) 0 0 1 ) + P f ( l ~ l o o ) 2 1.

The addition of this constraint will break the cycle pro- vided the linear program still has a solution in which each of the filter decision probabilities in the inequality is in- teger valued. If they are not integer valued, then the re- sulting filter is difficult to interpret since it randomizes its outputs. The filter may sometimes preserve the cycle; at other times it may delete it. In the MMAE filtering prob- lem which yielded the filter above, the addition of this inequality constraint still results in an integer solution. The new optimal stack filter i s f (x l , x2, x3) = XI + x2,

which has no nontrivial roots. If the cycle to be broken is completely disjoint from the

rest of the digraph, the designer can get rid of it without affecting the rest of the graph. On the other hand, there are situations where the removal of one cycle causes the destruction of other cycles, as the following example shows.

Example 4.3: Recall the filter discussed in Example 3.1. The Boolean expression of the filter is

fbl, x2, x39 x4, x5)

= xIx3x5 + xIx4 + x2x3 + x2x5 + x3x4.

The filter preserves (among other cycles) cycle 1 and cycle 2 (shown in Example 3.1). In fact, Of contains 13 ele- mentary cycles. Here, we will try to break cycle 1 first, then cycle 2, and, finally, cycle 1 and cycle 2.

Since cycle 1 consists of oscillations, it will be elimi- nated by requiring that

( a ) ~ ~ ( 1 JOIO~O) + ~ ~ ( o J 1 0 1 0 1 ) 2 1.

The new optimal filter has the following Boolean expres- sion:

f ( x l , x27 x3, x4, x5) xIx4 + x2x3 + x2x5 + x3x4.

The new Dfcontains 12 cycles; i.e., only cycle 1 has been removed.

To break cycle 2, the following must hold:

(b ) P f ( l lOOOll) + Pf(O~OO1lO) + Pf(OIO1lOO)

+Pf (1 (10001) + P f ( l ) l l o O O ) 2 1.

The new optimal filter has the following Boolean expres- sion:

f ( x l , x 2 9 x3, x47 x5) = xIx3 + xIx4 + x2x5 + x3x4.

The new Of contains ten cycles. Two extra cycles were destroyed as a result.

Finally, to break cycle 1 and cycle 2, both (a) and (b) must hold. The new optimal filter has the following expression:

f ( x 1 , x27 x3, x4, x5)

= ~ 1 x 2 + ~1x4 + ~ 2 x 4 + ~ 2 x 5 + ~3x4.

Page 10: Minimum mean absolute error stack filtering with ...moncef/publications/min-mean-absolute.pdf · signals or other structural behavior. ... NOWLEDGE of the set of signals or signal

963 Il-,l-l-, TKANSAC'TIONS O N ACOIIS~IICS. SPEFCH. ANI) S IGKAI . PKOCFSSIKG. V O I . 1X. \O 0. JlIKl- , I Y Y O

The new stack filter's digraph o f f ( ) contains only nine cycles. The above operation caused two extra cycles to be removed. It is interesting to note that in all the cases con- sidered above, the LP with the additional constraint still yielded an integer solution. This will be discussed in more detail later.

3) Simultaneously Removing and Preserving Cycles; Randomization: Designing stack filters to preserve cer- tain cycles or to remove certain cycles by modifying the constraints is done as described in Sections IV-A-I and IV-A-2, respectively. However, when we attempt to de- sign a dual-purpose stack filter, which is a stack filter de- signed to preserve some cycles and to not preserve others, it is possible that the resulting set of constraints may be infeasible.

Proposirion 4. I : If the additional constraints resulting from preserving cycles and removing cycles make the set of constraints infeasible, then there exists no stack filter with the prescribed structural behavior for that particular window width.

The proof of this proposition is trivial. One case of interest which yields infeasible constraints

has already been discussed in Section 111-E. It is the case in which one cycle to be preserved and one to be removed both span the same set of nodes. Although this is a dis- advantage of this design procedure, it is an important re- sult concerning the filter window width. Theorem 3 , Sec- tion 111-E, tells us that a higher window width is required in order to accomplish the desired task.

In general, checking the constraints on the LP for fea- sibility after the desired structural constraints have been added is a very good technique for determining if a large enough window is being used.

A serious disadvantage of the above approach of adding constraints is the fact that the resulting LP may no longer have an integer solution. Previously, before adding any structural constraints, an integer solution to the LP was guaranteed by the fact that the constraint matrix defined by (2.12) and (2.13) was TUM [23]. The addition of new constraints may distort the constraint matrix and may re- sult in randomization of one or more variables at the out- put of the resulting optimal filter.

As can be seen from the examples considered in the previous subsections, though, it appears that the problem of randomization does not always arise. Indeed, we had to purposely search for cases in which randomization was necessary before we found one. Determining when ran- domization is required and when it is not is an interesting open problem in this research area.

Furthermore, even if the optimal filter must randomize, one of the deterministic filters among the set over which it randomizes can be used. Although the resulting filter is not optimal, it will be nearly optimal, and probably ac- ceptable.

B. ModiJLing the Objective In the previous subsection, it was shown how a stack

filter which is optimal for noise reduction while satisfying

constraints on its structural behavior could be obtained by adding these constraints to the original LP used to find a MMAE stack filter. It was noted, however, that this method may sometimes cause the optimal solution to be a filter which randomizes some of its output decisions. If this is the case or if none of the filters over which the randomization takes place is acceptable, an alternative ap- proach can be taken.

This alternative method is based on an iterative process which may take more time to perform, but which, if suc- cessful, ensures that the filter which is finally chosen is a deterministic filter.

This process consists of changing the cost coefficients associated with certain decision variables in the objective function of the linear program in a systematic way until the desired output is obtained. Before making any changes in the objective, we run the LP with the current objective and check the resulting optimal filter it yields to determine if it has the desired structural behavior. This is accom- plished by examining the filter's digraph to determine if it has the cycles which are desired and does not have the cycles which are not desired.

If it does not have the desired behavior, the next step is to perform a cost ranging analysis [26] on each cost coefficient associated with every node in the desired and undesired cycle(s). Cost ranging is usually used in sen- sitivity analysis to determine the range within which each cost coefficient is allowed to vary without changing the optimal point, but in this case it tells us the minimal change to a cost coefficient that will ensure a change in the optimal filter.

Now, suppose a certain cycle is to be preserved and that one of its nodes is not in Of. The designer will attempt to vary the cost coefficient associated with that decision variable so that this node will appear in the new Df . Cost ranging will provide the minimal amount by which that cost coefficient must be updated to make the desired change. Similarly, if a certain cycle is to be removed from Dt , a cost ranging will be performed on each node (ac- tually, on each cost coefficient associated with each node) in the cycle, and the optimal solution with the minimal objective will be selected.

By preserving the structure of the constraint matrix, the above method overcomes the worst drawback of the pre- vious design procedure by ensuring that the resulting filter does not randomize. This method might require, how- ever, a lengthy iterative process which involves scores of tedious computations. Therefore, it is not recommended and no examples using this method are provided. A sim- pler alternative to designing a filter with the desired struc- tural behavior by mddifying the objective function can be found in [ 191.

v. EXTENSIONS TO MULTIPLE LEVELS The results obtained in the previous sections all concern

the characterization of binary roots of stack filters and the design of binary stack filters with desired structural be- havior. In this section, we extend these results to the case

Page 11: Minimum mean absolute error stack filtering with ...moncef/publications/min-mean-absolute.pdf · signals or other structural behavior. ... NOWLEDGE of the set of signals or signal

GABBOUJ A N D COYLE. MINIMUM MEAN ABSOLUl t: k.KKOK SrACK FILTEKING 965

of multilevel signals. The tools needed for these exten- follows that sions are the threshold decomposition and the results in M - I

141. Recall that (see Section 11-A) the definition of stack fil-

This contradicts (5 .3 ) , so (5.2) cannot occur if R ( j ) is a root of the filter. The case in which

ters requires that the same Boolean functionf( * ) be used on every level of the threshold decomposition architecture of the stack filter Sf ( * ). The output of a stack filter with M-valued input is given, as in (2:2), by

The output of the stack filter is thus the sum, over all levels, of the binary output of the filter on each level. Note that each of these filters sees a binary input signal. The binary signal seen at the input of the filter on level k of ihe architecture is the binary threshold signal

From the above definition of stack filters, it is obvious that a sufficient condition for an M-valued signal to be a root signal of the stack filter is that each of its binary threshold signals be a root signal of the binary stack filter f( * ). That this condition is also necessary is proven in the following proposition.

Proposition 5.1: An M-valued signal is invariant to a stack filter Sf ( * ) iff each of its M - 1 binary threshold signals is a root signal of the binary stack filterf( ).

Proofi As mentioned previously, the sufficient con- dition is obvious. To show that the condition is necessary, suppose that it is violated; that is, suppose that there is some M-valued signal R( j ) which is invariant to the stack filter S' ( - ) and that at least one of its binary threshold signals is not invariant to the positive Boolean function f( - ). There mug then be a level k a_nd a time instant j such that f ( Tk (R,, ( j ) ) ) # ref ( TL ( R , , ( j ) ) ). Consider first the case

Tk(R,l(j)).

f ( T k ( i , , ( j ) ) ) = 0 while r e f ( T L ( i f I ( j ) ) ) = 1 .

(5 .2)

Note that we must have R ( j ) 1 k since the binary thresh- old signals must stack:

T k ( i f 1 ( j ) ) 2 T , l l ( ~ , l ( j ) ) for all k I m.

Furthermore, we must have

S f ( k ( j ) ) 2 k (5.3)

since R( j ) is a root signal of the stack filter. Sincef( . ) obeys the stacking property,

f ( T k ( Z , i ( j ) ) ) L f ( T r i ( i , i ( . j ) ) ) foral lk 5 m.

Therefore,f( T,,,( if, ( j ) ) ) = 0 for all m 1 k . From (5.1) and the fact that the output o f f ( . ) is always binary, i t

f ( T k ( i , l ( j ) ) ) = 1 while r e f ( T t ( ~ , l ( j ) ) ) = 0

( 5 . 5 )

is shown to lead to a contradiction by the same reasoning. Since neither (5.2) nor (5 .5) is allowed, there are no val- ues of j and k for which

f ( T L ( i , , ( j ) ) ) f r e f ( 7 d ~ l l ( j ) ) )

if the signal R( j ) is a root signal of the filter. Thus, every binary threshold signal of R ( j ) must be a binary root of f ( - ) i f R ( j ) i s a r o o t s i g n a l o f S f ( * ) .

The above proposition reduces the study of multilevel root signals to the study of binary root signals of stack filters and shows how these binary root signals can be "stacked" on top of each other to produce a multilevel root signal. To this end, define any set of M - 1 binary signals s i ( j ) , i = I , - * * , M - 1 , in which s k ( j ) L

sf,,( j ) for all k I m to be a stacking sef of binary signals. Then the characterization of multilevel roots is summa- rized in the following corollary to Proposition 5.1.

Corollary: Let s, ( j ), i = 1 , * * - , M - 1 , be a stack- ing set of (binary) roots of the binary fi l terf( . ). Then the M-valued signal S ( j ) = Cf"=l' s i ( j ) is a multilevel root signal. Furthermore, any multilevel signal which is a root signal of s, ( ) is the sum of some stacking set of binary root signals o f f ( . ).

This approach to the construction of multilevel root sig- nals for stack filters is tedious since one must determine all possible sets of binary roots which stack on top of each other. A graphical approach to this task has been used in [ 141 for the median filter. It can be extended to cover the case in this paper as well, but the resulting graphs are very complex. Since this extension is very tedious and is not likely to be very tractable in practice, we do not pursue it here.

We turn instead to the problem of designing stack filters with desired multilevel structural behavior. This is an ex- tension of the work done in Section IV, which dealt with structural constraints for binary signals.

First, it must be stated that it is very simple to deter- mine multilevel structural constraints which cannot be met by any stack filter. This follows from the fact that the same binary filter is used on each threshold level of a stack filter and that each of these binary filters has an input ex- actly one of the binary threshold signals obtained from the input signal. Any structural constraint which requires dif- ferent filters on different levels of the architecture or re- quires a filter on one level to be aware of the binary threshold signal on another level cannot be met.

Page 12: Minimum mean absolute error stack filtering with ...moncef/publications/min-mean-absolute.pdf · signals or other structural behavior. ... NOWLEDGE of the set of signals or signal

It is, for instance, impossible for a stack filter to “am- plify” a signal or increase the height of an edge. This follows from the structure of the filter: its output can in- crease by at most 1 for an increase of size one in any of the input samples. In this sense, stack filters can not “add” something to a signal.

As another example of an infeasible constraint for a stack filter, suppose that a stack filter with a window of width 3 is required to make the following multilevel trans- formation:

0 0 0 1 1 0 0 1 1 1

0 0 0 1 1 0 0 1 1 1

0 1 1 1 1 0 0 1 1 1

0 1 1 1 1 0 0 1 1 1

+

Remurk: I n this section and in Section IV, when we talked about removing multilevel structures and breaking elementary cycles we were considering only partial de- struction of the cycles. For instance, when a single node is removed from a cycle, only part of that cycle is de- stroyed. If this cycle represents a special feature in the input signal, the complete feature will not be seen at the output, but part of it may. Therefore, how much of a fea- ture must be removed is up to the designer to decide.

Finally, we consider the case where we have multilevel structures to be preserved and others to be removed. In this situation, we proceed (as described in the above two paragraphs) by collecting all the constraints that must be met. If this set of additional constraints does not satisfy the hypothesis of Proposition 4.1, then the task will be achieved. Otherwise, a higher window width must be se- lected.

VI. CONCLUSION A N D FUTURE RESEARCH If we use a binary filter of window width 3 on each level of the stack filter, then it is clear from the above threshold signals that we must havef(0, 0. 1 ) = 1 on the third and fourth threshold levels andf( 0. 1 , 1 ) = 0 on the first and second threshold levels. This functionf( ) is not a stack filter since a stack filter must satisfy f ( 0, 0, 1 ) 5 f ( 0, 1, 1 ) .

This last example shows how constraints on different levels of the decomposition architecture can conflict with each other. It also shows that in the design of stack filters to satisfy multilevel structural constraints the task is to specify the constraints to be satisfied on a level-by-level basis. These constraints are then concatenated to form the set of constraints that is used to design the binary stack filter f ( . ). This is the case because the same function f ( * ) is used on every level of the architecture-it must therefore satisfy the constraints of every level.

We shall distinguish three cases:

1) preserving multilevel structures; 2) removing multilevel structures; 3) a combination of the previous two tasks.

Multilevel structures that are to be preserved can be de- scribed by M-valued signals. These signals must be M-valued root signals of the optimal stack filter S, ( . ) we are seeking. Therefore, by Proposition 5.1, each of their corresponding binary threshold signals must be invariant to the binary stack filter f( . ). Since the same Boolean function is used on every level, D, must contain all cycles and paths needed to make each binary threshold signal invariant to f( . ).

On the other hand, in order to remove a multilevel structure described by an M-valued signal, it is enough to make one of the binary threshold signals (of the M-valued signal) vary under f ( - ). This will force the multilevel signal describing the structural constraint to vary under S, ( ). However, we shall make the following important remark.

In this paper, we combined two filtering approaches: a root signal approach and an MAE estimation approach. In Section 111, we developed a means to extract root signals for any stack filter by manipulating its directed graph. We showed that a stack filter will preserve nonconstant sig- nals if and only if its directed graph contains either a non- trivial elementary cycle or a path that starts with one of the trivial elementary cycles and ends with the other. The number of roots corresponding to nontrivial elemen- tary cycles were upper bounded by enumerating these cycles for window widths 2 through 6.

In Section IV, we presented two alternatives for de- signing stack filters which will preserve and/or remove certain signals. The first method modifies the constraints while the second method alters the objective without changing the constraints. Advantages and disadvantages of each method were presented: it is up to the designer to choose the appropriate method for the application at hand.

Section V extended the results obtained in the previous sections to multilevel signals.

The extension of this paper to two dimensions can be found in [ 191.

As for future research, our efforts are presently devoted to the convergence properties of stack filters. We would like to be able to determine if and when an arbitrary input signal will be filtered to a root signal of a particular stack filter in a finite number of passes. An equally important topic is to find a way to determine the optimal window width for any stack filtering problem.

APPENDIX

Proof of Theorem 1

Suppose S is a nonconstant binary input signal that is invariant to the filterf’ . ) whose directed graph is D, = ( I/, E ). Then either S contains two identical n-sample

Page 13: Minimum mean absolute error stack filtering with ...moncef/publications/min-mean-absolute.pdf · signals or other structural behavior. ... NOWLEDGE of the set of signals or signal

GABBOUJ A N D COYLE: M I N I M U M MEAN ABSOLUTE E R R O R STACK FILTERING 967

sequences separated by a nonconstant region or it does not.

Case I : Suppose that there exists such an n-sample se- quence, wo, th_t repea? and suppose w, is the first time wo repeats in S. Since S is invariant t o f ( ), all samples in the sequence enclosed by wo and wi must be preserved underf( * ). This implies that any n-sample sequence be- tween wo and wi belongs to V; and any two adjacent n-sample sequences (with n - 1 overlapping samples) be- tween wo and w, correspond to an edge in E. Clearly, this describes a walk in 0,. Recall that wo and y, are identical; hence, this walk is a closed walk which may or may not contain any repeated nodes (other than wo) . If it does not, then it is an elementary cycle (as defined earlier); if it does, then it must contain an elementary cycle. In either case, Of contains at least one nytrivial elementary cycle.

Case 2: Now suppose that S does not contain any pair of identical n-sample sequ2nces which are separated by a nonconstant region. Then S must contain at least one non- constant region separating two ConstantJegions of differ- ent values. This is easy to prove. First, S contains akleast one nonconstant region because we assumed that S is a non_constant signal. Now, the longest nonconstant region in S would be 2” + n - 1 samples (that is, starting at an n-sarflple sequence, visit each of the 2” - 1 nodes once). But S is infinite and contains no pairs of identical n-sample yquences separated by a nonconstant region. Therefore, S mustzontain at least one n-sample sequence that repeats (since S is infinite), and this sequence must repeat indef- initely. The only possible nodes that can do this are the node of all 1’s and the node of all 0’s. Finally, th2 two constant regions must be of different values or else S will not satisfy the hypothesis.

The rest of the proof is straightforward. The noncon- stant region corresponds to a walk with no repeated nodes (so it is a path in or), while each of the constant regions corresponds to a different trivial elementary cycle (i .e. , the constant region of all 1’s corresponds to the trivial elementary cycle 1 - . * 1 -+ 1 . . . 1 whereas the con- stant region of all 0’s corresponds to the trivial elementary c y c l e 0 . * * 0 -+ 0 . . 0).

On the other hand, suppose that Ofcontains a nontrivial elementary cycle, that is, a cycle of length greater than 1 . By definition, a nontrivial elementary cycle corresponds to a nontrivial cyclic root sequence. Concatenate an infi- nite number of copies of this root sequence to get a root signal. (The reason we can do this is that, in a cycle, the first and last nodes are identical.) Finally, suppose that Of contains a path that starts with one of the trivial elemen- tary cycles and ends with the other. Then, by Lemma 1, this path corresponds to a sequence (call this the original sequence) that is invariant to f ( * ); i.e., all samples of the n-reduced version of the original sequence are preserved underf( . ). Since the path starts and ends with a node of all 1’s or all O’s, extend the original sequence by repeat- ing its end samples indefinitely. This will correspond to a root signal.

REFERENCES [ I ] N. C . Gallagher. Jr., and G. L. Wise. “A theoretical analysis of the

properties of median filters.” lEEE Trun.\. Acousr., Speech, S i g i i d Processing. vol. ASSP-29, Dec. 1981.

121 S . G. Tyan. “Median filtering: Deterministic properties,“ in T11.o- Dirnensionul Digircrl Sigiiul P rocessirig I / : Trunsforrns and Median Filters. T. S . Huang, Ed.

131 P. D. Wendt. E. J . Coyle, and N . C. Gallagher. Jr.. “Stack filters.” lEEE Trans. Acoust. , Spcvcli. Signul Processing. vol. ASSP-34, pp. 898-91 I, Aug. 1986.

[4] 1 . P. Fitch. E. J. Coyle, and N. C. Gallagher. Jr.. “Median filtering by threshold decomposition,” lEEE Truns. Acoust., Speech, Signul Proces.sirig, vol. ASSP-32, pp. 1183-1 189, Dec. 1984.

151 Y . Nakagawa and A . Rosenfeld, “A note on the use of local min and max operations in digital picture processing.” lEEE Trans. Syst., Mrrri. Cybernetics. vol. SMC-8. pp. 632-635. Aug. 1978.

161 P. A. Maragos, “A unified theory of translation-invariant systems with applications to morphological analysis and coding of images,” Tech. Rep. DSPL-85-1. School of Electrical Engineering. Georgia Institute of Technology, Atlanta. CA. July 1985.

171 J . Serra. Imujie Anulysis und Mutheinurical Morphology. New York, Academic Press. 1982.

[8] S . R. Sternberg. “Grayscale morphology.” Coinput. Vis ion, Gruph- ics. linuge Processing, vol. CVGIP-35. pp. 3 3 3 - 3 5 5 , 1986.

[9] J.-H. Lin and E. J . Coyle, “Optimal nonlinear filtering under the mean absolute error criterion.” in Proc. lEEE lnr. Conf. Acoust., Speech. Signul Processing (New York, N Y ) . Apr. 1988.

[ I O ] J.-H. Lin and E. J . Coyle, “Minimum mean absolute error estimation over the class of generalized stack filters.” lEEE Trans. Acousr., Speech, Signcrl Processing, vol. 3 8 . no. 4 , pp. 663-678, Apr. 1990.

[I I ] J. Song and E. J. Delp. “The analysis of morphological filters with multiple structuring elements,” Coniput. Vision, Gruphics. Image Processing, to be published.

[ 121 J . Song and E. J. Delp. “A generalization of morphological filters using multiple structuring elements,” in Proc. 1989 IEEE Synip. Cir- cuits Sysr. (Portland, OR). May 1989.

[ 131 G. R. Arce and N . C. Gallagher. Jr.. “State description for the root- signal set of median filters,’’ lEEE Truns. Acoust., Speech, Signul Processing, vol. ASSP-30, pp. 894-902, Dec. 1982.

[ 141 D. H. Yom and S . Ann, “Directed graph representation for root-signal set of median filters,” Proc. IEEE, vol. 75. Nov. 1987.

[ 151 P. D. Wendt. E. J . Coyle. and N. C. Gallagher. Jr., “Some conver- gence properties of median filters.” lEEE Truns. Circuits Syst.. vol. CAS-33. pp. 276-286, Mar. 1986.

[ 161 T. A. Nodes. and N. C . Gallagher. Jr.. “Median filters: some mod- ifications and their properties,” lEEE Truns. Acoust., Speech, Signal Processing. vol. ASSP-30, Oct. 1982.

1171 J. P. Fitch. E. J . Coyle. and N . C. Gallagher. J r . . “Root properties and convergence rates of median filters,” lEEE Truns. Acoust., Sperc,h. Signul Proc,essirig. vol. ASSP-33. Feb. 1985.

[ 181 T. A. Nodes and N . C. Gallagher, Jr.. “Two-dimensional root struc- tures and convergence properties of the separable median filter.” lEEE Truns. Acousr. , Speedr, Signul Procx,s.sing. vol. ASSP-3 1 . Dec. 1983.

[ 191 E. J. Coyle. J.-H. Lin, and M. Gabbouj. “Optimal stack filtering and the estimation and structural approaches to image processing.” lEEE Truns. Acoust., Speech, Signal Processing. vol. 37, pp. 2037-2066. Dec. 1989.

1201 E. N . Gilbert. “Lattice theoretic properties of frontal switching func- tions,” J . Muth. Phys., vol. 3 3 . Apr. 1954.

1211 M. Gabbouj. “Optimal stack filter examples and positive Boolean functions,” M.S. thesis, Purduc University, West Lafayette. IN. Dec. 1986.

1221 E. J . Coyle and J.-H. Lin. ”Stack filters and the mean absolute error criterion,” lEEE Truns. Amiist., Speech. Sijinul Processing. vol. 36. Aug. 1988.

1231 C. H . Papadimitriou and K. Steiglitz. Conibirirrtoriul Optirnixtion: Aljiorithlms und Coinplexify. Englewood Cliffs. NJ: Prentice-Hall. 1982.

1241 J . A. Bondy and U . S . R. Murty, Gruph Theory ivitli Applicutioris. New York: American Elsevier. 1976.

1251 A. T. Berztiss. “A K-tree algorithm for simple cycles of a directed graph.” Tech. Rep. 73-6. Department of Computer Science. Univer- sity of Pittsburgh, Pittsburgh. PA. May 14. 1973.

1261 L. Cooper and D. Steinberg. Merhods tincl Applicutions of Linetrr Progrurnming.

New York: Springer-Verlag. 1981.

Philadelphia: W. B. Saunders. 1974.

Page 14: Minimum mean absolute error stack filtering with ...moncef/publications/min-mean-absolute.pdf · signals or other structural behavior. ... NOWLEDGE of the set of signals or signal

Yh8

Moncef Gabbouj (S.85) WJ\ born in Mon,i\tir. Tunisia. i n 1962 He recci\cd the B S degree in electriccl1 engineering i n 1985 Irom Olldhoma State University, Stillwdter He received the M S degree in electrical engineering in 1986 t r i m Pur- due Univer\ity. Wr\t L'ildqette. I N Currentl). he I\ with the School ot Electricdl Engineering dt Purdue Univer\itq. where he I\ uorking toward the Ph D degree His rese'irch intrre\ts include nonlinear \ igni l and iindge proce\\ing. nuthe- maticdl morphology. neural networhs. dnd ar t ih-

c id l intelligence

Edward .I . Cojle (S'79-M'82) %a \ born in Phil,idelphid PA on April 22 1956 He received the bdchelor 01 electricdl engineering degree Iron1 the Univer\ity ol Deldudre in 1978 dnd the iihi\-

ter's dnd Ph D degrees in electricdl engineering and computer x i e n c e Irom Princeton Univer\ity in 1980dnd 1982

Since 1982. he has been with the School of Electrical Engineering dt Purduc Uni\eni ty . We\t Ldldyettc, I N . where he I\ currently dn Aswcidte Proleswr Hi\ research intere\t\ lie i n the area\ ot

nonlinear \ i g d 'ind image proces\ing dnd performdnce dndlysi\ of com- puter communication network\

Dr Coylc is d member 01 the Operdtion\ Resedrch Society ot Americd, the A\\ociation tor Computing Machinery. Phi Kdppd Phi. Tau Beta Pi. dnd Etd Kdppd N u He I \ currently the 4s\ocidte Editor tor Digitdl Signal Proces\ing for the IEEE TRA~\ACTION\ 01, C I K C L J I T ~ ZLI) S Y S T F M ~ Dr J P Fitch and Dr Coyle were corecipient\ ot the 1986 Best Paper Award lor author\ under the age of 30 from the Acou\tic\. Speech. and Signdl Proce\sing Society 01 the IEkE