Root properties of morphological filters

Root properties of morphological filters

Signal Processing 34 (1993) 131-148 Elsevier 131 Root properties of morphological filters Qiaofei Wang, Moncef Gabbouj and Yrjo Neuvo Signal Proc...

1MB Sizes 0 Downloads 83 Views



Signal Processing 34 (1993) 131-148 Elsevier

131

Root properties of morphological filters Qiaofei Wang, Moncef Gabbouj and Yrjo Neuvo Signal Processing Laboratory, Tampere University of Technology . P.O. Box 553, SF33101, Tampere, Finland

Received 6 January 1992 Revised 24 August 1992 and 8 January 1993

Abstract. The characterization of the root signal sets of the most common digital morphological filters is presented in this paper . This has proven very crucial in understanding the utility and usefulness of these nonlinear operators . Important deterministic properties of root signals of morphological opening, closing, open-closing and clos-opening are derived leading to a complete characterization of output signals. Recall that the output signals of these morphological filters are root signals since the filters are idempotent . A system of difference equations is then derived to compute the number of root signals for these morphological filters by a structuring element of width k and for signals of length n with m quantization levels. The derivation is based on the state description for these root signals . Simplified recursive equations have been obtained for binary root signals . An application example where the root signals arc used in block truncation coding (BTC) for image compression is discussed . Zusammenfassung. In dieser Arbeit wird eine Charakterisierung von Root Signal Sets von sehr allgemeinen morphologischen Filtern gegeben . Dieses hat sich als sehr hilfreich far das Verstehen der Eigenschaften and Brauchbarkeit dieser nichtlinearen Operatoren herausgestellt . Wichtige deterministische Eigenschaften der Root-Signale von morphologischem Opening, Closing, Open-Closing and Clos-Opening werden entwickelt, was zu einer kompletten Charakterisiemng der Ausgangssignale ftihrt . Man mull sich in Erinnemng mfen, daa die Ausgangssignale der morphologischen Filter Root-Signale sind, da these Filter idempotent rind . Es wind darn ein System von Differenzen-gleichungen hergeleitet, um die Anzahl von Root-Signalen fur diese morphologischcn Filter zu berechnen durch Strukturelemente der Breite k and fur Signale der Lange n mit m Quantisiemngsstufen . Diese Herleitung basiert auf der Zustandsbeschreibung dieser Root-Signale . Man erhalt vereinfachte rekursive Cleichungen fur binare Root-signale . Er wird ein Anwendungsbeispiel diskutiert, in dem RootSignale zum Block-Truncation Coding (BTC) benutzt werden . Resume. La caracterisation des ensembles de signaux de base de Ia plupart des filtres morphologiques et digitals est presence dans cet article . Le caractere crucial de la comprehension de l'utilite et de la fonctionnalite de ces opemteurs non lineaires a ere prouve . D'importantes proprietes deterministes des signaux de base d'ouverture, de fermeture, d'ouverture-fermeture et de fermeture-ouverture de la morphologic sent etudiees de maniere a obtenir one caracterisation complete des signaux dc sortie . Rappelons que les signaux de sortie de ces filtres morphologiques sent des signaux de base tant que les fillies sont idempotents . tin systdme d'equations de difference est alors derive pour calculer Ic nomhre de signaux de base de ces filues morphologiques en utilisant on element structurant de largeur k et pour des signaux de longeur n avec m niveaux de quantification . La derivation est basee sur Petal de description de ces signaux de base . Des equations recursives simplifiees ont etc obtenues pour des signaux de base binaires . Un exemple d'application pour lequel les signaux de base sont utilises pour la compression d'images en utilisant le codage par runcation dc blocks (BTC) est decrit Keywords. Morphological filters ; state model ; root signal set ; median filters ; BTC image coding .

Correspondence to: Moncef Gabbouj, Signal Processing Laboratory, Tampere University of Technology, P.O. Box 553, SF-33101, Tampere, Finland. Tel : 358-31-161967, Telex : 22-313 ttktr-sf, Fax : 358-31-161857, e -mail : [email protected] .f i

0165-1684/93/$06 .00 8 1993 Elsevier Science Publishers B .V . All rights reserved SSDI 0165-1654(93)E002l-C

132

Q. Wang et aL /Roof properties

1 . Introduction When linear filters fail to produce satisfactory results, which they often do in image processing applications, the alternative would be to pick a nonlinear filter . Which one to pick depends largely on the nature of the task to be performed . Several guide-lines and look-up tables exist, but only provide the designer with information on what filter class or classes would be potential candidates . Which filter to choose among a whole class of filters is usually not such a trivial task . Optimality results based on certain criteria do exist for several nonlinear filter classes, see for instance [ 3, 4, 6, 22, 25, 261 . Another major criterion which is often used in certain nonlinear filter classes is the root signal set of an operator (a signal invariant to the filtering is called a root signal), see for instance [5, 10, 21, 27, 29] . This is an analysis tool which has recently been used to analyze the behavior of several classes of nonlinear filters . This tool analyzes the deterministic behavior of these nonlinear operators by characterizing their root signal sets which constitute the 'passbands' of these operators . Knowledge of these signals for each operator determines which one must be used for a particular task. Among the nonlinear filter classes which are becoming increasingly popular is the class of morphological filters . Morphological filters are based on the theory of mathematical morphology developed by Matheron [ 16] and Serra [ 17, 18] . The filters exploit the geometric rather than the analytic features of signals to achieve certain tasks such as filtering . They were first defined in terms of the basic set operations and then extended to grayscale or function operations [ 12, 15] . Fundamentally, mathematical morphology represents signals as sets and a morphological operation consists of a set transformation which transforms a set into another set. In practice, a signal is more accustomedly represented by A function defined on a finite or infinite support region, although it can be alternatively represented by a set in an Euclidean space . According to the representation of a signal by a set or Signal Pmu sting

logical fillers

a function, filters are classified into set-processing filters and function-processing filters ] 15 ] . Morphological filters have been widely used in digital signal processing for a number of years . They found extensive applications in several areas including biomedical image processing, shape recognition, edge detection, image restoration and image enhancement . The basic morphological operations are dilation, erosion, opening and closing . Morphological opening and closing are important algorithms in signal processing . They eliminate specific signal structures smaller than some structuring element without distorting the global features of the signal . Of particular significance is the fact that morphological opening and closing possess the idempotency property, i .e ., further iterations by the same filter on previous outputs do not cause further changes in the output produced by the first filter pass . In other words, one pass of opening or closing yields a root signal which is invariant to further passes of the same filter . Furthermore, morphological operations employing iteratively applied openings and closings are also idempotent . Idempotency is so important that Serra [ 17, 18] uses it as part of the definition of morphological filters . Morphological filters used in this paper do not have to be idempotent, this is to include, among others, dilation and erosion filters . From a filtering point of view, idempotent filters do not only possess the convergence property but have a unit rate of convergence . General nonlinear digital filters do not necessarily possess the convergence property ; and those that do may not converge with unit rate [9, 10, 27, 291 . Idempotent morphological filters include open-closing (an opening followed by a closing by the same structuring element) and clos-opening (a closing followed by an opening by the same structuring element) . Therefore, it is of particular importance to study the root signal sets of these morphological filters . The structure of the root signal sets has been generally discussed by Matheron 118, Chapter 6 . Filters and Lattices, pp. 115-1401, where the root signal set is called invariance domain . The closest, in many respects, nonlinear digital filters



Q. Wang et al. /Rant properties ofmorphotagicalfilters

to these morphological filters are rank order operations, among which the median filter is the most popular. Several studies on the convergence behavior and root signal sets of median filters have led to a deeper understanding of the median operation and to the application areas where it excels [2, 8, 20] . Of particular importance is the result found by Maragos and Schafer [ 14] that relates the roots of the median operator to those of open-closing and clos-opening . They showed that any root signal of the median filter is bounded from below by the output of the corresponding open-closing and from above by the output of the corresponding closopening' . Furthermore, they showedthat roots of openclosing and clos-opening are roots of the corresponding median filter. These results were generalized to stack filters in 1101 . By defining a state model to describe the finite length binary root signals of the median filter, Arce and Gallagher [2] characterized its root signal set and computed the cardinality of this set for different window width median filters . The multilevel case was studied by Fitch et al . [ 8 ] . The main feature of their state model is that each state in a median root produces other states in the state model as the signal length increases . Summing over all these states at a certain stage gives the total number of roots of the median filter for the specified window width and signal length . Any attempt to duplicate the above state model for these morphological filters will produce an incomplete set of states which cannot describe all possible states in the roots . The problem has been solved for binary signals in [ 23, 24] by taking the root number as a special state ; and recursive equations have been obtained for finding the number of binary roots of opening, closing, open-closing and dos-opening . In this paper, we will develop state models for multilevel signals by incorporating virtual states in the state models . A complete system of equa-

'Assume the window for the median filter is a convex symmetric (with respect to the origin) set W and the window width is W1 -2k- I, where k is a positive integer . Then the corresponding structuring element for morphological filters is a convex set K with length IKI=k .

133

Lions will be established to compute the cardinality of the root signal sets . This paper is organized as follows . Section 2 presents some useful properties of morphological filters . Based on these properties, a state model for the root signal sets is developed for opening in Section 3, and for open-closing and clos-opening in Section 4 . Systems of difference equations are derived based on these state models to count the number of root signals of these morphological filters with any specified length structuring element and for any specified quantization level . Section 5 describes one application example where binary root signals of morphological filters are used in a BTC image coding scheme . Section 6 presents some conclusions . 2. Some properties of root signals 2.1 . Definitions

In this paper, morphological operations are considered as function-processing filters . In a function-processing system, it is convenient to define the signal length which is a key parameter in the analysis of root signals. Definitions are given as follows [ 15] : dilation : (f(Dk)(x)=sup(f(y) :)EK,], erosion : (feK)(x)=inf(f(y) :yEK,), opening : f o K=(fe K) OK, closing : f • K=(f©K) eK,

(1)

where k= } - z :zE K} denotes the symmetric set of K with respect to the origin, and K,=1z+x :zEK} denotes the translation of K by x . For sampled signals, the structuring element K is a discrete and finite set which is viewed as a moving window . Hence, erosion (dilation) of a sampled function by a finite set K is equal to the moving local minimum (maximum) . 2 .2 . Threshold decomposition property and PBF expressions

Let X= [X, XL ] be a multilevel, nonnegative signal vector . Without loss of generality, we require Vol . 34, No.2 November 1993



134

Q . Wang ei al./ Root properties of morphological fillers

that X,E {0, 1, . . ., in-1} . This signal vector can be decomposed into m- 1 binary vectors x', t= I , . . ., m- 1, by thresholding. This thresholding operation is T `, so that 1,

if X;>t; otherwise .

x, -T'( .!(.) Q

(2)

we can find their PBFs expressions . Let g o ( • ), g,( • ), g oo ( •) and g, o ( •) denote the PBF of opening, closing, open-closing and clos-opening by structuring element K, respectively . Then we have [ 13] go(x)=VaEK(A&e oxb), gc(x) = Aasg( V beK„xb),

(7)

Note that

g«(x) = Aaet( V be(K®K> a ( A ceKnxc)) ,

in -I

m-t

X= y T`(X)=

E x`.

(3)

gea(x) = Vaek( Abe(K(BK)a( VCEK,x . )) .

It is important to note that g o ( •) is a dual function of ge ( •) and gam ,( •) is a dual function of g, o ( • ), DEFINITION 1 . An ordered set of sequences X,, . . ., X,,

is said to obey the stacking property if X, %X2 > -

3X, .

EXAMPLE . Consider the morphological opening by (4)

structuring element K={-1, 0, I) .

DEFINITION 2. A binary function g( •) is said to possess the stacking property [3] if g(x),>g(y)

wheneverx3y .

Then the corresponding Boolean function is g„(x)=(x_2Ax 1 Axo)V(x_ 1 Axa Ax,)

(5) V (xo Ax r Ax2 ) .

This is the same as the increasing property used to define morphological filters [17, 18] . It has been shown that a necessary and sufficient condition for a binary function to possess the stacking property is that it is a Positive Boolean Function (PBF) [II] . DEFINITION 3 . A stack filter Sg based on the PBF g( •) is defined as follows : -1 S8(X)

SW)

=

L g(xr) .

(6)

5'g is said to obey the threshold decomposition [7] which is a weak superposition property . Therefore, a stack filter Sg is completely determined and, hence, represented by the PBF g ( • ) . The threshold decomposition property reduces the operation and the analysis of all stack filters to the analysis of the effects of these filters on binary signals . This simplifies a great deal the theoretical analysis lof these highly nonlinear filters . Since digital morphological filters are stack filters, Signal Processing

(8)

(9)

2 .3. Appending strategy

According to binary morphology, l's represent the `object' and 0's form the `background' from the viewpoint of opening . By the duality of opening and closing, we can say that for closing, 0's are taken as the `object' and I's are viewed as the `background' . Obviously, any finite binary signal can be extended by its 'background' . Therefore, we append each binary input signal at both ends with 0's for opening and l's for closing . In multilevel signals, this is equivalent to appending 0's for opening and (m -1) 's for closing . This is called the constant value carry-on strategy [ 10] . 2 .4.

Properties of binary root signals

In 1D case, assume the structuring element K is a convex set and

IKI =k, kEZ„

(10)

where 7L, is the set of positive integers . Some important ID structures are defined as follows :



Q. Wang et al. /Root properties of morphologica{filters

Constant neighborhood. It consists of at least k consecutive identically valued points . Impulse. A set of at most k - l points situated between two identically valued constant neighborhoods . The values of the two boundary points in an impulse differ from that of the adjacent constant neighborhoods . If all the points in an impulse are above the constant neighborhoods, we call it a positive impulse . If all the points in an impulse are below the constant neighborhoods, we call it a negative impulse . There are impulses which are neither positive nor negative . Impulses which, along with their adjacent constant neighborhoods, form unimodular sequences (convex or concave sequences) are called simple impulses . Note that only positive or negative impulses may be simple impulses . Some examples of impulses are given in Fig . 1 .

135

2 . The complement of a binary root opening is a root of closing, and vice versa . PROPERTY

of

This property has a major consequence concerning the number of root signals of opening and closing . In effect, the number of roots of opening is equal to that of closing for a given signal length . 2 .4 .2 . Binary open-closing and clos-opening The root signal sets of open-closing and clos-opening behave in a similar manner, as described by the following property. binary root of open-closing is a root and vice versa . Hence, the number of roots of open-closing is equal to that of clos-opening for a given signal length . PROPERTY 3. A of clos-opening,

2 .4.1 . Binary opening and closing Several important properties of binary root signals found in [ 12, 14-18] are reformulated here using the above root structures [23, 24] . binary root of opening (respectively closing) is composed of constant neighborhoods and negative (respectively positive) impulses .

Note, however, that the same signal will not in general reduce to the same root by open-closing and closopening . An example of morphological filtering of a binary signal is given in Fig . 2 . We see that in a binary root of open-closing or clos-opening there are only constant neighborhoods . This is formally expressed in the following property [ 19] .

Since opening and closing are dual operators, their mot signals are related by the following property .

PROPERTY 4 . A binary root of open-closing or closopening consists of only constant neighborhoods .

PROPERTY 1 . A

• 000

0000

0000

(a)

• 000

0000

(b)

• • 0

0000

0

0090

• (c)

(d)



(e)

Fig . 1, Examples of impulses for k=4 . (a) Positive impulse ; (b) positive simple impulse ; (c) negative impulse ; (d) negative simple impulse; (e) impulse which is neither positive nor negative . V A. 34. Na 2, N .,,,a 1,1993



136

Q. Wang el at IRoot properties of morphologicalfillers

input

110001110011110001001110110

opening

000001110011110000001 1 10000

closing

110001111111110001111111111

open-closing

000001111111110000001 1 10000

clos-opening

000001111111110001111111111

Fig .

2.

Signal filtering by four different morphological filters length-3 structuring element .

by

a

Propertiesrl-4 deal with morphological filters with the same structuring element. Now suppose a given signal is a root of some morphological filter with some structuring element. Is the signal also a root of the same filter with a smaller structuring element, like in the median filter case? PROPERTY 5 . A binary root of opening, closing, openclosing and clos-opening by a particular .structuring element is a root of opening, closing, open-closing and clos-opening by a smaller structuring element, respeclively. 2.5. Properties of multilevel root signals

Properties 1-5 will next be extended to multilevel signals, but first one additional structure (not found in binary signals) must be defined . Edge . A monotonic region containing no constant neighborhoods . If the region is monotonically nondecreasing (respectively non-increasing), it is called a positive edge (respectively negative edge) . Note that an 'edge' as defined above differs from an 'edge' in a median root signal since our 'edge' is not required to be bounded by two constant neighborhoods of different values . In fact, with constant neighborhoods and edges, one can construct any arbitrary signal . For instance, an impulse can be formed by positive and negative edges . This leads to an alternative definition of a simple impulse . DEFINITION4. An impulse composed of two edges is called a simple impulse .

Figures 1(b) and 1(d) illustrate a positive simple impulse and a negative simple impulse, respectively . SignalRoce..sing

2 .5.1 . Multilevel opening and closing

With all the structures defined, the root signals of morphological filters are characterizedby the following properties . PROPERTY 6. A root of opening (respectively closing) is composed of constant neighborhoods and edges, where no positive (respectively negative) edge may be immediately followed by a negative (respectively positive) edge .

The proof of this property follows immediately from Property I and the threshold decomposition property . The latter causes any edge point in a multilevel root of opening to fall into a binary constant neighborhood or a binary negative impulse, both of which are invariant to opening, see Property 1 . This is illustrated in Fig . 3 . Similar reasoning can be used for closing . Property 6 tells us how to construct arbitrary root signals of opening and closing . However, since opening and closing are both idempotent, all possible filtering outputs of opening and closing have been characterized . Of particular interest, in filtering, is the effect of opening and closing on impulses, which is given by the following consequence. CONSEQUENCE 1 . Any positive (respectively negative) simple impulse will be removed by opening (respectively closing); whereas, any negative (respectively positive) simple impulse will be preserved by opening (respectively closing) .

Recall that in an opening root, a negative edge is allowed to be followed immediately by a positive edge by Property 6. Therefore, an opening root may contain negative simple impulses, Similarly, a closing root may contain positive simple impulses . When counting the number of binary root signals, it was noted in Property 2 that opening and closing have exactly the same number of roots due to the duality property of the two operations . The following property states that the sane also holds for multilevel root signals .



137

Q. Wang et al. / Root properties of morphological filters

0

0000

0 0

00**

0000

(a) 160000

o

00000000000

s o

0000000000 (b) Fig . 3 . Thresholding an opening root at t . (a) X; (b) s'.

PROPERTY 7. If an arbitrary signal R = [R„ . . ., Rj T is a root signal of opening, where R; E {0, then its complement P= (in- 1)1-R is a root of closing by the same structuring element. Hence, for a given signal length, the number of roots of opening is equal to that of closing by the same structuring element . PROOF . Decompose R into m- 1 binary vectors r', t=1, 2, . . ., m-1, by thresholding. Obviously, r' is a binary root of opening for any tE 11, . . ., m- I ) . The complement of r' is a root of closing by the same structuring element by Property 2 . The complement of r' is written as p' - '=1 -r ',

(11)

where 1= ) 1, 1, . . ., 1 IT . If t, < t2 , from the thresholding structure, we have r" > . r'2 . For/, =m-t, > 12 =m-t2 , by (11) we obtain 12 P %P ° .

(12)

that is, the (p')'s, l=m-1, m-2, . . ., 1, possess the stacking property, see Definition 1 . Therefore, summing over all p' from 1=1 to m - 1 results in a multi-

level root signal P for closing . By (3) and ( I I ), P= , 7"(P)=

=(m-1)1-R .

E P'= L p "-

t

(13)

Suppose P, is an element of P . Obviously, P i C {0, 1, . . ., in - 1) . This means that P is also an m-level signal which takes on values in {0, 1, . . ., m- 1) . Therefore, for any root of opening, one can find a corresponding root of closing in the same signal space . Hence, the number of roots of opening is equal to that of closing for a given signal length . 0 2 .5 .2. Multilevel open-closing and clos-opening Before characterizing the root signal structures of open--closing.and clos-opening, we shall extend the result in Property 3 concerning root signals of these two operators, again using the threshold decomposition property . V .) 34 . N . 2, November 1993

13S

Q. Wang

of

al . / Root properties of morphological fillers

PROPERTY 8. A multilevel root signal ofopen-closing is a root of clos-opening by the same structuring element and vice versa . Hence, the number of multilevel root signals of open-closing is equal to that of closopening for a given signal length and quantization level. Property 8 above says that one needs to characterize the root structures of only one of the two operators . Note, however, that the same signal will not in general reduce to the same root by open-closing and closopening, see the example in Fig . 2. In the rest of the section, we shall identify the root structures of open-closing (and clos-opening) . We already know that binary roots of open-closing and clos-opening are solely composed of constant neighborhoods ; and these roots have the same structures as median roots, except for the end points . The difference at the end points is due to the different appending strategies used for median and morphological filtering . For multilevel signals, the root structures of open-closing and clos-opening have been described in [ 19) . They have proved to be the same as those of median filters . In our definitions, open-closing and clos-opening roots are characterized by the following property .

PROPERTY 9. A root of open-closing and clos-opening is composed ofconstant neighborhoods and edges, where no edge may be immediately followed or preceded by another edge with different sign . Thiss means that a positive edge and a negative edge must be separated by at least one constant neighborhood . This is a much tighter restriction than that in Property 6. Specifically, the root structures in Property 9 are a proper subset of those in Property 6 ; therefore we get the following .

CONSEQUENCE 2 [14]. Roots of open-closing and clos-opening are also roots of opening and closing . Finally, Property 5 concerning the ordering of the binary root signal sets of opening and closing with Signal p,vcessmg

structuring elements of different lengths is naturally extended to multilevel signals .

PROPERTY 10. A

root of opening, closing, open-closing and clos-opening by a particular structuring element is a root of opening, closing, openclosing and clos-opening by a smaller structuring element, respectively . The proof can easily be obtained by the use of the threshold decomposition property which has once again proved to be a very useful and powerful tool in analyzing these morphological filters . We would, however, like to point out that the invariance domain (the root signal sets) of morphological filters has been thoroughly studied, see for instance [ 18], using mathematical morphology .

3. Root number of opening and closing 3 .1 . Opening by length-two structuring element Based on the above analysis, a state model for the root signal set of morphological filters will be developed . The model inherits the main feature of the state model for median filters [ 2, 8] , i .e ., each state generates another state in the state model as the signal length increases, However, we will see that transitional problems arise in the state model for morphological filters . For instance, the upward transitional state is not allowed to appear at the end of ann opening root . We will solve this problem by incorporating some virtual states . In order to get a clearer insight into the proposed state model, morphological opening by a length-two structuring element will be considered first . Generalizations to length-three and larger structuring elements will be carried out in the next subsection . The results for closing follows immediately, see Property 7 . For opening by length-two structuring element, the following two states of our system are defined in terms of the last two digits of the signal . The characteristics of them are given as follows . Static state Sc (i) : When the values of the last two samples of the signal are identical and equal to i, for



139

Q. Wang ci al. /Root properties of nrorphologicat filters

O i i, the signal is said to be in a downward transitional state, see Fig . 4(d) . Upward transitional state UL ,(m-I - i) : If them is a change of level from j to i and j < i, the signal is said to be in an upward transitional state . No upward transitional states are allowed at the end of a root signal . However, the two samples preceding the last one may form an upward transitional state, see Figs . 4(b) and 4(c) . Since the upward states do not appear at the end of a root signal, we call them virtual stales . However, they do exist within a root signal and `generate' other upward states or static states . By increasing the signal by one sample, the signal may either stay in the previous state or move to another state in the state model . Such transformations are readily derived based on the root signal structures described in Section 2 . Specifically, static states may be generated from static states, downward states and virtual upward states ; downward states from other downward states and static states ; and upward states from static states, other upward states and downward states, see Figs . 4(b) and 4(c) . Formally, SL+,(i)=SL(i)+DL(i)+UL(m

000

"-I

D, .+i(i)=

L, (SL(r)+D,,(r)),

(14)

r-I+l U,.(i)=

(SL_l(m-1-r) +U L ,(r)+D L

J (m-1-r)) .

Let R'" ( L) denotes the number of roots at a given signal length L and quantization level m . The total number of states, except the virtual states, is equal to the number of mots, Rm(L+1)

= L (SL+i(i)+DL+I(i)) .

(15)

With the initial conditions, the recursive relation given by ( 14) and ( 15) enables us to find the number of roots for any signal length and quantization level . For example, the initial conditions for m=3 are given as S2 (0)=S2(1)=S2(2)=1, D2 (0)=D 2 (I)=D2 (2) =0, U2 (0)=2, U2 (l)=I, U2 (2)=0 ; the number of roots can be calculated using (14) and (15) for any signal length L . 3.2 . Opening by structuring element of arbitrary length

Suppose that the structuring element K has an arbitrary hut fixed length k and the last k aamnles of the signal are a„ . . ., a, The states defined in terms of these k samples are as follows .

900

0

(c)

(d)

bi b1 bz bd

Fig. 4. Examples of states for opening by length-two structuring element. (a)-(c) Static states; (d) downward transitional states .

Fig . 5 . Virtual upward transitional state ; k-4 and j=2. Vol . 34,W 2 . November 1993



140

Q. Wang et at /Root properties of morphological filters

Static state SL (i) : When the values of the last k samples of the signal are identical and equal to i, i .e., a I = . . . =a,= i, for 0 < i < m - l , the signal is said to be in a static state . Downward transitional state DL (j,i) : If and only if

number of levels ni=2 Eummring ele ent length k

1 .=2 2 I 1 7

3 4 5

2k i>ak+1 j = ak1z ;= . . .=ak-l,forl
and 0 < i < m- 1, the signal is said to be in a downward transitional state . Upward transitional states are not so trivial to define . Recall that upward states are not allowed at the end of a root signal . Furthermore, a root signal is considered to be in an upward state as long as the last few samples are monotone non-decreasing and do not terminate in a constant neighborhood . In order to decide whether a signal is in an upward state, one must examine those k samples preceding the last k-j samples, where 1 < j < k - 1 . Depending on the new sample, the signal may still stay in an upward state, or move to a static state . It is based on these k samples (before the last k-j ones) that we shall decide if the signal is in an upward state or not . Upward transitional state U Q (j,i) : If and only if bk-i
1-1

+

(24) DL+I-k(j,i)=DL-k(1-l,i),

for 1

ISL+1

k(r)+~ D7+I-k(l,r)

I-1

r=t+1 1


+ F

S, .+,_k(m-1-r)

(27)

I U,.+1-k(1,i)=

F,

k(m - 1 - r)

SL

k-1

+E +

DL+I-k(hr)

UL-k(l,r)/, k-I

r-1

DL+I

E

-

k(1,i)

r-i+I

1-k(j,i)=UL_k(j-l,i), for1
Since only static states are allowed to be at the end of a root signal, the number of roots is equal to the sum of these states at a given stage, i .e ., SL+I(z) .

R - (L+1)-

SL-k(r)+E DL-k(l,r) r-1

number of levels m-2 slruclunng eleo~l

Iengthk 2 3

L

(25)

3 2 2 0 0

4 4 2 2 0

5 6 6 10 2 4 2 2 2 2

7 16 6 2 2

8 26 8 4 2

9 10 II 42 68 110 12 18 26 6 8 10 2 4 6

12 178 38 14 8

i=n number of levels m=3

For binary signals (m = 2), we can simplify (24) and (25) to obtain a simple difference equation for R 2 (L+ 1) . In the binary case, DL (j ,1) =UL(i,1)=0, for I jck-1 . By (24) and (25) . R2

(L+

1)=SL+I(0)

element lengthk 2 3 4 5

L=2 3 0 0 0

3 3 3 0 0

+SL+1 ( 1 )

+SL+1-k(O) =R2(L)+R2(L+1-k) .

4 9 3 3

0

5 17 3 3 3

nmnber of

smtclunng element Iengvhk 2 3 4 5

= SL(O) +SL+1-k( 1 ) +SL( 1 )

Signal Processing

shuctunng

(26)

1-2 4 0 0 0

3 4 4 0 0

4 16 4 4 0

6 7 37 77 9 17 3 3 3 3

8 163 27 9 3

9 10 11 343 723 1523 49 91 163 17 27 39 3 9 17

12 3209 293 63 27

levels m=4 5 36 4 4 4

6 94 16 4 4

7 236 36 4 4

8 9 602 1528 66 136 16 36 4 4

10 3882 292 66 16

II 9858 612 108 36

Fig . 7 . Number of roots for open-closing and clos-opening .

12 25038 1280 192 66



Q. Wang et al . /Root properties of morphologicalfilters DL „-k(l .t)=D, .-k(j-1,i),

143

for 1
The upward transition state 0(j,i) has been removed . Initial conditions.

if X; < T,

output= So ;

if X; > T,

output=S„

(30)

The initial conditions are given as follows : SL (i)=0,

1
5k(i)=I,

0
Da (j,i)=0,

1
0
(28) 0
Resorting to computer solution, numerical results are easily obtained . Some examples are provided in Fig . 7 .

5 . BTC image coding application As mentioned in the introduction, knowledge of the root signals and their number for a nonlinear filter may he very useful in several ways . Which one of these nonlinear filters should be used for a particular application depends largely on the root signals of the filter . In particular, root signals may be used in optimal filtering under structural constraints [4, 9] . Coding is another potential application area where root signals are directly used in data compression . Block Truncation Coding (BTC) [5] is perhaps the simplest coding scheme which can be used in real-time image transmission . The principle of the BTC algorithm is to use a non-parameter one-bit quantizer to preserve the local statistics of the image, e .g. the first-order and secondorder moments of an image. To describe the BTC image coding scheme in more detail, consider an image block of size n X n (usually n=4) . Set m=n 2 and denote by X„ i= 1, . . ., m, the values of the pixels in the block, then the local mean and variance can be expressed as

E X„

X=-

M _1

v2

for i =1, . . ., m . Set T=X and denote by q the number of X,'s greater than or equal to T. Then in order to preserve the sample mean and sample variance, S„ and St will be set to

(29)

1

=- T, XZ-X L. M i-1

When using a one-bit quantizer, a threshold T and two output levels So and S, must be computed so that

So =X-

S,=

I m- q

v,l

V

(31)

9

It is easy to see that the block is now described by X, a and an n X n bit plane consisting of zeros and ones corresponding to pixels with values S„ and S, respecz tively . To code the bit plane, n bits are required . Therefore, when n=4, 2 bits/pixel will be required to code an image, assuming that 16 bits are used to code X and a (8 bits for each) . Figure 8 gives an example to illustrate the coding and decoding procedure of BTC . In order to further compress the bits /pixel, Arce and Gallagher [ I ] proposed an algorithm which uses the roots of ID window width three median filter to perform BTC . They showed that the bit plane has a high probability of belonging to the root signal set of the median filter and can be reduced to a root signal through a single filter pass . Applying this 1D median filter to each row of the bit plane, one can use only 12 bits to code it, reducing the bit-rate in this way from 2 to 28/ 16=1 .75 bits/pixel . This success is partially due to the correlation which exists among the root signals in the bit plane . However, 1D root signals exploit the I D correlation only . Therefore, 2D root signals can be expected to improve the

10 10 3 2

10 9 4 4 (a)

11 12 12 15 1215 1015

1 1 1 1 1 0 1 1 001 1 0011 (b)

12 12 12 12 12 3 12 12 3 3 1212 3 31212 (c)

Fig . 8 . An example to illustrate the coding and decoding procedure of BTC. (a) Original 4 x 4 block; (b) truncated 4 x 4 bit plane ; (c) decoded 4 x 4 block (X=9 .6, v=4.2q=11, S o =3 and S, =12) . Vol . 34 . No . 2 . November 1993



144

Q. Wang et al . /Root properties of rnorphologieol filters

results . Recently, we proposed a new scheme which uses root signals of the cross-median and separable median filter to compress the bit-rate 301 . We showed that 13 and 11 bits arc required to code binary root signals (of 4 x 4 size) of the 3 x 3 cross-median and separable median filter, respectively . The bits/pixel achieved this way thus become 29/16=1 .81 and 27/ 16=1 .69, respectively [301 . In this section, we will develop a coding scheme which keeps the same bit-rate for the local mean and variance (8 bits each), but uses only 12 bits for coding the hit plane. From Fig . 6, we find that for binary signals of length 4 . there are 7 possible roots of opening and closing by a length-two structuring element . They are shown in Fig. 9 . However, using 3 bits we can encode 2'=8 states . Therefore, to efficiently use all three bits, one more state should be added to the list of Figs . 9(a) and 9(b) . A logical choice would be to add a state which would appear with high probability in the bit plane. Following a similar reasoning as in [ I ], we choose '0001' for opening and `0111' for closing_ However, since `0001' is not a root of opening and '0111' is not a root of closing, they will be reduced to '00tH)' and

opening

closing

0000

1111

0011

1100

0110

1001

1100

0011

0111

1000

1110

0001

1111

0000

Fig . 9 . Roots of opening and closing by length-two structuring clement for the signal length of 4 . (a) Roots of opening; (b) roots of closing . Signal Processing

`1111' by opening and closing, respectively, This problem can be solved by choosing an appropriate hybrid appending strategy. For opening the constant value (of zeros) carry-on appending strategy is used at the beginning of the signal ; whereas the last value carry-on appending strategy is applied at the end of the signal . Consequently, in addition to the roots given in Fig . 9(a), two new roots emerge . They are `0001' and `1101' . The former is what we want ; and the latter can be discarded by changing the last two digits from '01' to '00' or '11' . Similar argument holds for closing, i .e ., the first value carry-on strategy is used at the beginning of the signal ; while the constant value (of ones) carryon appending strategy is used at the end of the signal . In practice, the appended bit plane is subject to ID morphological opening or closing, one row at a tittle . After discarding one root, 3 bits are used to encode each row and therefore 12 bits are needed to encode the bit plane . The bit-rate required is thus the same as for coding with ID median roots which is 1 .75 bits/ pea . One way to further improve this proposed scheme would be to exploit the 2D correlation that exists in the bit plane, as was noted earlier . The aim is to improve the picture quality while keeping the same bit-rate . According to Property 1, opening preserves negative structures including negative impulses ; while closing preserves positive structures . Furthermore, the previous scheme exploits only the horizontal correlation . Therefore, better performance would be achieved by exploiting the vertical correlation in the bit plane . A simple way to do this is to alternate between the roots of opening and those of closing . When the output of opening contains more zeros than ones, it may be due to the removal of some positive details . In such a case, closing would have produced

Fig.

1110 0110 0100 1001

1110 0110 0000 1001

1110 0111 0000 1000

(a)

(b)

(c)

An example of root coding. (a) BTC block; (b) opening and closing coded block; (c) median root coded block.

10 .

Q . Wang et al. /Root properties of morphological filters

145

Fig. 11 . Examples of BTC image coding . (a) The original 'Lena' of 512x512 size at 8 .0 bits/pel; (6) the BTC coded `Lena' ; (c) the ID median root coded `Lena' ; (d) the opening and closing root coded 'Lena' .

better results (an output that is closer in the Hamming distance to the input) . Similarly, when the output of closing contains more ones, opening could have produced better results . However, an extra bit to denote whether an opening or a closing should be used is too much a price to pay . A much simpler alternative is thus proposed . Based on the output of the current row, the encoder will predict whether to use opening or closing

for the next row . This decision is based on the contents of the current row, i.e ., if the current row contains more zeros after opening, then use closing in the next row ; otherwise use opening . To avoid side information, the first row in the bit plane is always filteredby an opening . Recall that there are 10 different window width three median filter binary roots of length four [ 1, 21 . Two of these must be discarded (those with the least probabilVo1 .34, No .2, November 1993



146

Q. Wang el al . /Root properties of n orphological filters

Table 1 Results of image coding Method

MAE

Standard BTC 1 D median root Opening and closing

3.96 4.42 4.33

MSE 44.76 55 .21 54.56

ity of occurrence) before using them in the BTC scheme proposed in [I] . The same 10 root signals are also root signals (to be used in the coding scheme discussed above) for either opening or closing, see Figs . 9(a) and 9(b) . Suppose that the block is highly correlated in the vertical direction, then it is possible to use all these 10 roots for encoding the block by alternating between opening and closing . Therefore, the opening and closing coded block must be closer to the original BTC block than the median root coded block. This is illustrated by an example shown in Fig . 10, where two median roots `1001' and `0110' were discarded and changed to `1000' and `0111', respectively . Image 'Lena' with 512 X 512 size is used to test the feasibility of the proposed coding scheme . The results are also compared with the median-based BTC coding scheme. Figure 11 shows the results of the different BTC coding schemes . Table 1 gives the mean absolute error (MAE) and the mean square error (MSE) computed for each method . The proposed morphologicalbased BTC scheme produced as good results as the median-based scheme .

The system symmetry found in [8] for median roots was used to reduce the amount of computation for open-closing and clos-opening . These root signals were then used in a BTC image coding scheme . The results were satisfactory and comparable to previous results obtained by a median-based BTC image coding scheme . Other potential applications of these results are in the areas of image restoration and image enhancement where image features are the prime criteria based on which a nonlinear filter is to be selected . The theoretical background has already been developed for stack filters [9, 27, 28] and the results should be useful for morphological filters .

Appendix A Derivation of (20)

In a binary case, we note that DL(j,l)=0, for I cjck-1 . By (17),

U L (k-1,0) k-I

E

=SL+I-k(())+

DL+1-J110)

I-1 k-1 =SL-k(O)+DL_k(k-1,0)+L DL-k( 1 - 1,0) I-2 +DL+1-k(1,0) k-1 = SL-k(Q)+E DL-k( 1 0 ) + SL + k(l) I- 1 1

6 . Conclusions In this paper, the multilevel root signal sets of morphological opening, closing, open-closing and elosopening have been characterized . Using the powerful tool of threshold decomposition property, several properties of ID root signals of the most common morphological filters were presented . Based on these results, state models were developed for computing the cardinality of the root signal sets . A complete system of equations was established by which we can calculate the number of roots of these morphological filters for a given signal length and a given quantization level . Signal Processing

=R(L-k),

(32)

where we note that k-1 DL-k(k - 1,0)+E D,,_k(I-1,0) t-^

(33)

k-1 _

DL-k( 1,0 ) t-I

and DL+1-k(1,0) -SL-k( 1) . Thus, by (18), (19) and (32),

(34)



Q . Wang et al. /Root properties of morphological filters

R 2 (L+1) k-l

=St+1(0)+St+1(1)+L Dt+1(1,0) r= l =S,.(0)+D,.(k-1,0)+S,,(1)+U, .(k-1,0) k-1

+~ D t (1-1,0)+S I (I) 1-2 =R2(L)+R2(L-k)+S,,(1) .

(35)

Thus, we can calculate the difference R 2 (L- 1) -R 2 (L) =R 2 (L) +R 2 (L-k) +St (l) -(R2(L-1)+R2(L-I-k)+S,._,(1))

=R2(L)+R2(L-k)-R2(L-1) .

(36)

In the above equation, we have used the relation SL(1) - St-1(1) = &L _(k- 1,0) =R 2 (L- I -k) which can be directly derived from (16) and (19) . Adding R 2 (L) to both sides of (36), we have R 2 (L+I)=2R 2 (L)+R 2 (L-k)-R 2 (L-1) .

(37)

References I I I G .R. Arce and N .C . Gallagher, 'BTC image coding using median fitter mots' , IEEE Trans . Comm ., Vol . COM-31, No . 6, June 1983,pp.784-793 . [2] G .R. Aree and N .C . Gallagher, "State description for the rootsignal set of median filters", IEEE Trans. Acoust. Speech Signal Process ., Vol. ASSP-30, No . 6, December 1982, pp. 894-9(Y2[3] E .J . Coyle and J .H . Lin, "Stack filters and the mean absolute error criterion", IEEE Trans. Acoust- Speech Signal Process ., Vol . ASSP-36, No . 8, August 1988, pp . 1244-1254 . 141 E .J . Coyle, J .H . Lin and M. Gabbouj, "Optimal stack filtering and the estimation and structural approaches to image processing", IEEE Tran.s . Acoust. Speech Signal Process ., Vol. ASSP-37 . No . 12, December 1989, pp . 2037-2066 . 151 E .J . Delp and OR. Mitchell, "Image compression using block truncation coding", IEEE Tram. Comm ., Vol . COM-27, No. 9, September 1979, pp . 1335-1342 . [6] E .R.Duugherty, 'Minimal search for the optimal mean-square digital gray-scale morphological filter", Proc. Visual Communications and Image Processing '90, Lausanne, Switzerland, 1-4 October 1990, pp . 214-226 .

147

[ 7 ] J .P . Fitch, E .J. Coyle and N .C . Gallagher, Jr., "Median filtering by threshold decomposition" . IEEE Trans . Accuse . Speech Signal Process., Vol . ASSP-32, No. 6, December 1984, pp . 1183-1188 . 18 ] J .P . Fitch, E .J . Coyle and N .C . Gallagher, Jr., "Root properties and convergence rates of median filters", IEEE Trans . Acoust. Speech Signal Process., Vol . ASSP-33, No . 1, February 1985, pp.230-240 . [9] M . Gabbouj and E .J . Coyle, "Minimum mean absolute error slack filtering with structural constraints and goals", IEEE Trans . Acoust . Speech Signal Process ., Vol . ASSP-38, June 1990, pp. 995-968 . [101 M . Gabbouj, P .T. Yu and E .J . Coyle, "Convergence behavior and root signal sets of stack filters", Circuits System Signal Process ., Special Issue on Median and Morphological Filters, Vol . 11, No. I, 1992, pp . 171-193 . [it] E.N . Gilbert, "Lattice-theoretic properties of frontal switching functions", J. Math . Ph-vs ., Vol . 33, April 1954 . [12] R .M . Haralick, S .R . Stemberg and X . Zhuang "Image analysis using mathematical morphology", IEEE Trans . Pattern Anal. Machine Intell., Vol . PAMI-9, No . 4, July 1987, pp . 532-550 . [13] L. Koskinen, J . Astola and Y . Neuvo, "Morphological filtering of noisy images", Proc . Visual Communications and Image Processing '90, Lausanne, Switzerland, 1-4 October 1990, pp . 155-165 . [14] P .A . Maragos and R.W . Schafer, "Morphological filters - Part B : Their relations to median, order-statistic, and stack filters", IEEE Trans. Acoust . Speech Signal Process ., Vol . ASSP-35, No. 8, August 1987, pp . 1170-1184 . [15] P .A . Maragos and R.W . Schafer, "Morphological filters-Part I: Their set-theoretic analysis and relations to linear shiftinvariant filters", IEEE Trans. Acoust. Speech Signal Process ., Vol. ASSP-35, No . 8, August 1987, pp. 1153-1169 . [16] C . Matheron, Random Sets and Integral Geometry, W iley, New York, 1975 . [17] J . Serra, Image Analysis and Mathematical Morphology, Vol . 1, Academic Press, New York, 1982 . [ 18] J . Serra, ed ., Image Analysis and Mathematical Morphology, Vol . 2, Academic Press, New York, 1988[19] R .L . Stevenson and G.R . Arce, "Morphological filters : Statistics and further syntactic properties", IEEE Trans . Circuit and Systems, Vol . CAS-34, No. 11, November 1987, pp.1292-1305 . [20] S .G . Tyan, "Median filtering : Deterministic properties", in : T.S . Huang, ed., Topics in Applied Physics, Two-Dimensional Digital Signal Processing 11, Springer, Berlin, 1981, pp . 197217 . [ 211 Q . Wang and Y. Neuvo, "On two-dimensional root structures of separable and cross median filters", Proc. 1991 Internat . Svmp . Circuits and Systems, Singapore, 11-14 June 1991, pp . 104-107 . [221 Q . Wang and Y . Neuvo, "Adaptive grayscale morphological filters for image noise smoothing", Proc . IEEE Internat. Conf. Systems Engineering . Kobe, Japan, 27-29 August 1992 . [231 Q . Wang, M. Gabbouj and Y . Neuvo, "State description for the root signal sets of morphological filters", Proc. 1992 Internat . Symp . Circuits and Systems, San Diego, California, USA, 10-13 May 1992, pp . 113-116. Vol .14,

No- 2 .Novemter1993

148

Q . Wang er al /Roof properties of morphological filters

[241 Q . Wang, M . Gabbouj and Y . Neuvo, "Root signal sets of morphological fillers", Electronics Letters, Vol . 28, No . 10, 1992.pp .952-953 . [25] L . Yin, 1 . Astola and Y . Neuvo, "Optimal weighted order statistic filters under the mean absolute error criterion", Proc. Internat . Conf. Acoust. Speech Signal Process ., Toronto, Canada, May 1991, pp. 2539-2532. [26] L . Yin, 1 . Astola and Y . Neuvo, "Adaptive stack filtering with application to image processing", IEEE Trans . Signal Process ., To appear. [271 P.T . Yu and E.J . Coyle, "Convergence behavior and N-roots of stack filters", IEEE Trans . Acoust. Speech Signal Process ., Vol . ASSP-38. No . 9, September 1990, pp . 1529-1544 .

signal vmcassmg

[281 P.T. Yu and E .J . Coyle, "On the existence and design of the best stuck filter based associative memory", IEEE Trans. Circuits and Systems I1 : Analog and Digital Signal Processing, Vol . 39, No . 3, March 1992, pp . 171-184. [29] P .T. Yu, W,L . Wang and S .S. Hung, "Root properties of median filters under three appending strategies", Proc . 1991 Internal Symp. Circuits and Systems, Singapore, 11-14 June 1991 . [30] B . Zeng . Q . Wang and Y. Neuvo, "BTC image coding using two-dimensional median filter roots", Proc . 1991 IEEE Internat . Symp . Circuits and Systems, Singapore, 11-14 June 1991,pp .400-403 .