Grain filters Vicent Caselles (
[email protected])
Dept. de Tecnologia, Universitat Pompeu-Fabra, Passeig de Circumvalaci´ o 8, 08003 Barcelona, Spain
Pascal Monasse (
[email protected])
∗
CMLA, ENS Cachan, 61 Av. du President Wilson, 94235 Cachan Cedex, France Abstract. Motivated by operators simplifying the topographic map of a function, we study the theoretical properties of two kinds of “grain” filters. The first category, discovered by L. Vincent, defines grains as connected components of level sets and removes those of small area. This category is composed of two filters, the maxima filter and the minima filter. However, they do not commute. The second kind of filter, introduced by Masnou, works on “shapes”, which are based on connected components of level sets. This filter has the additional property that it acts in the same manner on upper and lower level sets, that is, it commutes with an inversion of contrast. We discuss the relations of Masnou’s filter with other classes of connected operators introduced in the literature. We display some experiments to show the main properties of the filters discussed above and compare them. Keywords: Mathematical morphology, connected operators, grain filters, extrema filters, connected sets
1. Introduction Filters used to simplify an image and satisfying a minimal set of invariance properties are scarce. Actually, only one of them has the maximal set of invariance properties, and it is driven by the parabolic partial differential equation [1, 26, 18]: ∂u = k∇ukcurv1/3 u, ∂t where curvu(x) is the curvature of the level line of u at the point x, this being restricted to the regular points of u. However, the previous filter is optimal (in terms of invariance) among regular filters, that is, filters driven by a P.D.E. This property of regularity, while desirable in theory, has the drawback of modifying all contours, and, in particular, of destroying T -junctions, which are important clues for occlusion [5, 4]. If we drop this requirement, a bunch of other filters satisfying the same invariance properties are available. Motivated by the study of a family of filters by reconstruction [9, 10, 21, 31, 32], Serra and Salembier [30, 25] introduced the notion of ∗
http://pascal.monasse.free.fr c 2001 Kluwer Academic Publishers. Printed in the Netherlands. °
grain.tex; 19/11/2001; 9:16; p.1
2
V. Caselles and P. Monasse
connected operators. Such operators simplify the topographic map of the image. These filters have become very popular in image processing because, on an experimental basis, they have been claimed to simplify the image while preserving contours. This property has made them very attractive for a large number of applications, such as noise cancellation or segmentation [17, 33]. More recently, they have become the basis of a morphological approach to image and video compression [23, 24, 22, 6]. Different classes of connected operators have been studied by Meyer [15, 16], Serra [29] or Heijmans [8] (see also references therein). In this article, we study the theoretical properties of two kinds of connected operators: the extrema filters and the “shape” filters. Each of them simplifies the topographic map of the image, but with different senses given to the term topographic map. The maxima filter removes connected components of upper level sets of insufficient area, while keeping the other ones identical [31, 32]. This ensures that regional maxima of the filtered image have a minimal grain size. Similarly, the minima filter removes too small connected components of lower level sets. For these filters, the “grain” corresponds to a connected component of a level set, and small grains are considered as noise. This can be seen as the pruning of the tree of the connected components of upper, or lower, level sets. In a previous work [3], we introduced the notion of “shapes”, designed to deal symmetrically with upper and lower level sets. The shapes are also organized in a tree, driven by inclusion. When applied to images of positive minimal grain size, we showed that the structure of this tree is finite. As shown here, any image resulting from the application of the extrema filters has this property. This new tree also provides the definition of another grain filter, for which the grain is a shape [13, 19, 20]. It removes small shapes while preserving the ones of sufficient area. The essential improvement over the extrema filters is that it deals in the same manner with upper and lower level sets. In the vocabulary of mathematical morphology [14, 27, 28], this filter is self-dual when applied to continuous functions. The present article is organized as follows. Section 2 recalls the foundations of mathematical morphology and underlines the link between contrast invariant operators on images and set operators. Section 3 introduces the main properties of extrema filters and proves them. In Section 4 we prove the analogous properties for the grain filter and, in particular, that it is a self-dual filter on continuous functions, generalizing a result of [2]. Finally, in Section 5 we illustrate these filters with an experiment.
grain.tex; 19/11/2001; 9:16; p.2
3 2. General results from mathematical morphology This Section is a review of some well known results of Mathematical Morphology. We review them in some detail for the reader’s convenience. More detailed accounts on them can be seen in [?, 11, 12], or [7]. Throughout this section, we shall consider real functions defined in a subset of IRN . If u is a real function defined on D ⊆ IRN , we denote by [u ≥ λ] the set {x ∈ D : u(x) ≥ λ}, λ ∈ IR. Similarly, we define the sets [u > λ], [u ≤ λ], [u < λ]. 2.1. Level sets Let D ⊆ IRN . If u : D → IR is any real function, and Xλ u = [u ≥ λ], then \ ∀λ ∈ IR, Xλ u = Xµ u µ ε} .
We shall observe below that both operators Mε and Mε0 , which are well known in mathematical Morphology , are increasing and idempotent, thus they are filters. Since they are also anti-extensive they are openings, and they are called area openings. They may be used to define area closings by computing the corresponding negative operator, for in0 stance, the negative of Mε0 would be defined by Mε∗ (X) = Ω\Mε0 (Ω\X). 0∗ Then Mε is increasing, idempotent and extensive, thus, it is a closing, called the area closing. Let Bε = {B : B measurable and connected, O ∈ B, |B| ≥ ε} and Bε0 = {B : B measurable and connected, O ∈ B, |B| > ε}. We define x + Bε = {x + B : B ∈ Bε }, x + Bε0 = {x + B : B ∈ Bε0 } where x + B = {x + y : y ∈ B}. We define the maxima filter Mε+ and the minima filter Mε− on a function u : Ω → IR by Mε+ u = Mε− u =
sup
inf u(y),
inf
sup u(y).
B∈x+Bε y∈B B∈x+Bε0 y∈B
Again, these operators are well known in Mathematical Morphology. As we shall observe below, both are increasing and idempotent, thus they are filters. Mε+ u comes from applying Mε to upper level sets u, thus, it is an anti-extensive filter, in other words, an opening. Mε− u comes from applying Mε0 to the lower level sets of u or, equivalently, from
grain.tex; 19/11/2001; 9:16; p.6
7 0
applying Mε∗ to the upper level sets of u, thus is an extensive filter, or, in other words, a closing. The definitions are voluntarily not symmetric, so that both can act on (upper) semicontinuous functions. We will show that, when defined on upper semicontinuous functions, Mε+ and Mε− are contrast invariant operators whose associated set operators are Mε and Mε0 , respectively. To avoid the cases where Bε = ∅ or Bε0 = ∅, we will always suppose that ε < |Ω|. 3.2. Preliminary results LEMMA T 1. If (Cn )n∈IN is a nonincreasing sequence of compact sets and C = n∈IN Cn , then cc(C, x) =
\
cc(Cn , x).
n∈IN
If (On )n∈IN is a nondecreasing sequence of open sets and O = then [ cc(O, x) = cc(On , x).
S
n∈IN
On ,
n∈IN
Proof. It is clear that cc(C, x) ⊆ cc(Cn , x) for any n. Conversely, cc(Cn , x) is an intersection of continua, thus, it is a continuum. Since it contains x and is included in C, we get the other inclusion.
T
n∈IN
S
For any n, cc(On , x) ⊆ O, thus n∈IN cc(On , x) ⊆ cc(O, x). On the other hand, O being open and Ω locally connected, cc(O, x) is an open is some continuum Ky ⊆ cc(O, x) set. Hence, for any y ∈ cc(O, x), there S containing x and y. Since Ky ⊆ n∈IN On and it is a compact set, we can extract a finite covering of Ky , and as the sequence (On ) is nondecreasing, there is some n such that Ky ⊆ On . Since Ky is connected and contains x, we have that y ∈ Ky ⊆ cc(On , x). We conclude that S cc(O, x) ⊆ n∈IN cc(On , x). PROPOSITION 1. We have the following properties for Mε and Mε0 : (i) Mε and Mε0 are nondecreasing on measurable subsets of Ω. (ii) Mε is upper semicontinuous on compact sets:T(Fn )n≥0 being a nonT increasing sequence of compact sets, then Mε ( n Fn ) = n Mε (Fn ). (iii) Mε0 is lower semicontinuous on open sets: (O ) being a nondeS n n≥0S creasing sequence of open sets, then Mε0 ( n On ) = n Mε0 (On ).
grain.tex; 19/11/2001; 9:16; p.7
8
V. Caselles and P. Monasse
Proof. Property (i) is a direct consequence of the definitions. T (ii) Let F = n∈IN Fn . Since Mε is monotone, we have that Mε (F ) ⊆ T ∈ Mε (Fn ) for all n, and Cn = cc(Fn , x). n∈IN Mε (Fn ). Now, let x T Then |Cn | ≥ ε. Let C = n∈IN Cn . Applying Lemma 1, we observe that C = cc(F, x). In particular, |C| = inf |Cn | ≥ ε and we deduce x ∈ C ⊆ Mε (F ). S S (iii) Let O = n On . Since Mε0 is monotone, n Mε0 (On ) ⊆ Mε0 (O). Now, let x ∈ Mε0 (O). Then U = cc(O, x) is such that |U | > ε. Let Un = cc(On , x). Lemma 1 proves that [
U=
Un .
n∈IN
Then sup |Un | = |U | > ε. Hence for n large enough, |Un | > ε. We conclude that x ∈ Un ⊆ Mε0 (On ). If A and B are two families of sets, we say that A is a basis of B if A ⊆ B and for any B ∈ B, there is some A ∈ A such that A ⊆ B. LEMMA 2. Bε is a basis of {X : O ∈ Mε (X)} and Bε0 is a basis of {X : O ∈ Mε0 (X)}. Proof. This is a direct consequence of the definitions. COROLLARY 1. Applied to upper semicontinuous functions, Mε+ (resp. Mε− ) is a contrast invariant operator whose associated set operator is Mε (resp. Mε0 ). More precisely, for all λ, [Mε+ u ≥ λ] = Mε ([u ≥ λ]); [Mε− u < λ] = Mε0 ([u < λ]). Proof. Let Cε = {X : O ∈ Mε (X)}. As consequence of Proposition 1, we have (
x:
)
sup
inf u(y) ≥ λ
B∈x+Cε y∈B
= Mε ([u ≥ λ]).
We now use the fact that Bε is a basis of Cε , as shown in Lemma 2. As Bε ⊆ Cε , we deduce that M²+ u (x) ≤
sup
inf u(y).
B∈x+Cε y∈B
If B ∈ x + Cε , there is some B 0 ∈ x + Bε such that B 0 ⊆ B. Then inf u(y) ≤ inf 0 u(y) ≤ Mε+ u (x),
y∈B
y∈B
grain.tex; 19/11/2001; 9:16; p.8
9 and by taking the supremum over all B, we get sup
inf u(y) ≤ M²+ u (x).
B∈x+Cε y∈B
A similar proof applies to link Mε− and Mε0 . PROPOSITION 2. Let u, v : Ω → IR. Then (i) If ² < ²0 then Mε+0 u ≤ Mε+ u ≤ u ≤ Mε− u ≤ Mε−0 u. (ii) If u ≤ v, then Mε+ u ≤ Mε+ v and Mε− u ≤ Mε− v. (iii) Mε± (α) = α for all α ∈ IR. (iv) Mε± (u + α) = Mε± u + α for all α ∈ IR. The proofs are immediate and we will not include the details. COROLLARY 2. Let un , u : Ω → IR be such that un → u uniformly in Ω. Then Mε± un → u as n → ∞ uniformly in Ω. Proof. Given δ > 0, let n0 be such that u − δ ≤ un ≤ u + δ for all n ≥ n0 . Using Proposition 2, (ii), (iii) and (iv), we obtain Mε− u − δ ≤ Mε− un ≤ Mε− u + δ, for all n ≥ n0 . Hence Mε− un → u as n → ∞ uniformly in Ω. Similarly, we prove that Mε+ un → u as n → ∞ uniformly in Ω.
3.3. Properties PROPOSITION 3. If u is an upper semicontinuous function, also are Mε± u. If u is continuous, also are Mε± u. Proof. Let u be an upper semicontinuous function. Then, for any λ, [Mε+ u ≥ λ] = Mε ([u ≥ λ]). As [u ≥ λ] is a closed set, its connected components are closed. Since Mε ([u ≥ λ]) is a finite union of some of them, it is closed. Thus Mε+ u is upper semicontinuous. In the same manner, [Mε− u < λ] = Mε0 ([u < λ]). Since [u < λ] is an open set, its connected components are also open, and its image by Mε0 is thus a union of open sets, which is open. This proves that Mε− u is upper semicontinuous.
grain.tex; 19/11/2001; 9:16; p.9
10
V. Caselles and P. Monasse
Finally, suppose that u is continuous. We just have to prove that [Mε± u ≤ λ] is closed for any λ ∈ IR. Using Corollary 1, we write [Mε+ u ≤ λ] =
\
[Mε+ u < λ +
n>0
=
\
1 ] n
(Ω \ [Mε+ u ≥ λ +
1 ]) n
(Ω \ Mε ([u ≥ λ +
1 ])). n
n>0
=
\ n>0
We claim that Mε [u ≥ λ +
[ 1 ] = {O ∈ CC([u > λ]), |O| > ε}. n
(∗)
If C ∈ CC([u ≥ λ + n1 ]) and |C| ≥ ε for some n, we define O = cc([u > λ], C). Since O is open and contains the closed set C, we deduce that O \ C is open and not empty, and, thus, of positive measure. Hence |O| > |C| ≥ ε. This proves that Mε ([u ≥ λ +
[ 1 ]) ⊆ {O ∈ CC([u > λ]), |O| > ε}. n
Now, let O = cc([u > λ], x) be such that |O| > ε. Then, thanks to Lemma 1, we have cc([u > λ], x) =
[
1 cc([u ≥ λ + ], x). n n>0
Thus, ε < |O| = supn>0 |cc([u ≥ λ + n1 ], x)|. There is some n such that if C = cc([u ≥ λ + n1 ], x), then |C| > ε. This proves the remaining inclusion in (∗). The right hand side of this equality being open, we conclude that [Mε+ u ≤ λ] is closed. To prove the same result for Mε− , we write [Mε− u ≤ λ] =
\
[Mε− u < λ +
1 ] n
Mε0 ([u < λ +
1 ]). n
n>0
=
\ n>0
S
We claim that the last set coincides with {C ∈ CC([u ≤ λ]), |C| ≥ ε}. If C ∈ CC([u ≤ λ]) and |C| ≥ ε, we define On = cc([u < λ + n1 ], C). Since On is open and C is closed, we have that ε ≤ |C| < |On |. Hence, [
{C ∈ CC([u ≤ λ]), |C| ≥ ε} ⊆
\ n>0
Mε0 ([u < λ +
1 ]). n
grain.tex; 19/11/2001; 9:16; p.10
11 Let x ∈ Mε0 ([u < λ + n1 ]) for all n. Then we have cc([u ≤ λ], x) ⊆
\
\ 1 1 cc([u < λ + ], x) ⊆ cc([u ≤ λ + ], x). n n n>0 n>0
Applying Lemma 1, we get \
1 cc([u ≤ λ + ], x) = cc([u ≤ λ], x), n n>0 yielding cc([u ≤ λ], x) =
\
1 cc([u < λ + ], x). n n>0
Hence |cc([u ≤ λ], x)| = inf n |cc([u < λ + n1 ], x)| ≥ ε. This proves that \ n>0
Mε0 ([u < λ +
[ 1 ]) ⊆ {C ∈ CC([u ≤ λ]), |C| ≥ ε}, n
and, thus, the equality of both terms. The right hand side term, being a finite union of closed sets, it is also closed. PROPOSITION 4. When restricted to upper semicontinuous functions, Mε± is idempotent. Proof. Let u be an upper semicontinuous function and λ ∈ IR. Clearly, we have Mε ◦ Mε = Mε . Applying this equality to the set [u ≥ λ], and using Corollary 1, we get Mε ([Mε+ u ≥ λ]) = [Mε+ u ≥ λ]. Now, thanks to Proposition 3, we have that [Mε+ u ≥ λ] is closed and we can apply again Corollary 1 to the left hand side of this equality to obtain [Mε+ Mε+ u ≥ λ] = [Mε+ u ≥ λ]. Since this equality holds for any λ ∈ IR, we conclude that Mε+ ◦ Mε+ = Mε+ . The same proof applies to Mε− . PROPOSITION 5. Let u ∈ C(Ω). Then (i) Mε+ u ↑ u, Mε− u ↓ u as ε → 0+. (ii) Mε+ Mε− u → u, Mε− Mε+ u → u uniformly as ε → 0+.
grain.tex; 19/11/2001; 9:16; p.11
12
V. Caselles and P. Monasse
Proof. (i) Both cases being similar, it will be sufficient to prove the first part of the assertion. Let v(x) = supε Mε+ u(x). Observe that v is lower semicontinuous. Assume that M := maxx∈Ω (u(x) − v(x)) > 0. Let x0 ∈ Ω be such that M = u(x0 ) − v(x0 ). Let C = cc([u ≥ v(x0 ) + M 2 ], x0 ). Since u is continuous, C contains an open set, hence, |C| > δ > 0 for some δ. Let ε ≤ δ. Then Mε+ u(x) ≥ inf u(y) ≥ v(x0 ) + y∈C
M 2
for all x ∈ C.
Letting ε → 0+ and choosing x = x0 we obtain v(x0 ) ≥ v(x0 ) +
M 2
which is a contradiction. We conclude that v(x) = u(x) and the proposition is proved. (ii) Both cases being similar, we shall only prove that Mε+ Mε− u → u uniformly as ε → 0+. For that, let us write Mε+ Mε− u − u = Mε+ Mε− u − Mε+ u + Mε+ u − u. Given δ > 0, let ε0 > 0 be small enough so that u − δ ≤ Mε− u ≤ u + δ and
|Mε+ u − u| ≤ δ
for all ε ≤ ε0 . Then Mε+ u − δ ≤ Mε+ Mε− u ≤ Mε+ u + δ, i.e.,
|Mε+ Mε− u − Mε+ u| ≤ δ.
Collecting these facts we have that |Mε+ Mε− u − u| ≤ 2δ, for all ε ≤ ε0 . Remark. If A : IRN → IRN is a linear map whose determinant we denote by det A, if u : IRN → IRN is a measurable map and Au(x) = + − u(Ax), x ∈ IRN , then Mε+ Au(x) = M|det A|ε u(Ax) and Mε Au(x) = − N M|det A|ε u(Ax), for all x ∈ IR . In particular, the area opening and
grain.tex; 19/11/2001; 9:16; p.12
13 closing are invariant under special affine maps, i.e., linear maps with |det A| = 1. 3.4. Interpretation Let u be an upper semicontinuous function and C ∈ CC([u ≥ λ]). If |C| ≥ ε, we have Mε (C) = C and, thus, C is a connected component of Mε ([u ≥ λ]) = [Mε+ u ≥ λ]. If |C| < ε, then Mε (C) = ∅ and C is not a connected component of [Mε+ u ≥ λ]: it does not even meet this set, since [Mε+ u ≥ λ] = M² ([u ≥ λ]), so that [Mε+ u ≥ λ] ∩ C = M² ([u ≥ λ]) ∩ C = ∅. Conversely, if C ∈ CC([Mε+ u ≥ λ]), we have C ∈ CC(Mε ([u ≥ λ])) and C = Mε (C 0 ), C 0 being a connected component of [u ≥ λ], and since C 6= ∅, we have Mε (C 0 ) = C 0 , thus C = C 0 . Summing up these remarks, we can see that the connected components of [Mε+ u ≥ λ] are exactly the connected components of [u ≥ λ] of measure ≥ ε. In particular, since the connected components of upper level sets have a structure of tree driven by inclusion, the tree of Mε+ u is the tree of u pruned of all nodes of insufficient measure. The same observations can be made concerning Mε− and the connected components of [u < λ]. The tree of Mε− is the tree of connected components of lower level sets of u pruned of all nodes of insufficient measure. Summarizing the above discussion, we have the following result. PROPOSITION 6. If X ∈ CC([Mε− u < λ]) 6= ∅, then |X| > ². If X ∈ CC([Mε+ u ≥ λ]) 6= ∅, then |X| ≥ ². If |cc([u ≥ λ], x)| ≥ ² (resp. if |cc([u < λ], x)| ≥ ²) then |cc([Mε− u ≥ λ], x)| ≥ ² (resp. |cc([Mε+ u < λ], x)| ≥ ²). In particular, the above result implies that the connected components of [Mε+ Mε− u ≥ λ] and [Mε+ Mε− u < λ] have measure ≥ ε. The same thing can be said of connected components of the upper and lower level sets of Mε− Mε+ u. For that reason, the operators Mε+ Mε− and Mε− Mε+ u are called extrema filters. Let us finally mention that, when defined on IRN these operators are translation invariant, since the notions of connected set and measure are translation invariant.
grain.tex; 19/11/2001; 9:16; p.13
14
V. Caselles and P. Monasse
3.5. Composition LEMMA 3. Let u be an upper semicontinuous function and λ ∈ IR. Then C ∈ CC([Mε+ u < λ]), C = 6 ∅ ⇒ ∃x ∈ C, − C ∈ CC([Mε u ≥ λ]), C = 6 ∅ ⇒ ∃x ∈ C,
u(x) < λ. u(x) ≥ λ.
Proof. Let C ∈ CC([Mε+ u < λ]). If the consequence was false, we would have C ⊆ [u ≥ λ]. If C = Ω, then we have [Mε+ u ≥ λ] = Mε ([u ≥ λ]) = Mε Ω = Ω, since |Ω| ≥ ε. This contradicts the definition of C. If C ( Ω, C being open, we have C ) C and ∂C ⊆ [Mε+ u ≥ λ] = Mε ([u ≥ λ]). Let x ∈ ∂C. Then x belongs to a connected component D of [u ≥ λ] such that |D| ≥ ε. Since x ∈ C, D ∪ C is connected and included in [u ≥ λ]. As |D ∪ C| ≥ ε, we get D ∪ C ⊆ [Mε+ u ≥ λ], contradicting the definition of C. This proves our claim that there is some x ∈ C such that u(x) < λ. Now, let C ∈ CC([Mε− u ≥ λ]). Suppose that C ⊆ [u < λ]. If C = Ω, arguing as above, we have [Mε− u < λ] = Ω, which contradicts the hypothesis. Thus, we may assume that C ( Ω. Let D = cc([u < λ], C). Since C is closed and D open, then C ( D. Thus there is some x in D \ C such that Mε− u(x) < λ. Thus, x ∈ Mε0 ([u < λ]), meaning that |cc([u < λ], x)| > ε. This component must be D and, therefore |D| > ε. Finally, we observe that D ⊆ [Mε− u < λ], which is a contradiction. THEOREM 1. The operators Mε+ ◦ Mε− and Mε− ◦ Mε+ (i) transform upper semicontinuous functions into upper semicontinuous functions, and continuous functions into continuous functions; (ii) are idempotent on upper semicontinuous functions. Proof. (i) is a direct consequence of the equivalent properties we have proved for Mε+ and Mε− in Proposition 3. (ii) is a consequence of the well-known result in Mathematical Morphology that the composition of a morphological opening and closing are idempotent. We shall include a proof for the sake of completeness. As a consequence of Proposition 2, we have Mε+ u ≤ u ≤ Mε− u for any function u. Applying this to Mε+ Mε− u instead of u, we get Mε+ Mε− u ≤ Mε− Mε+ Mε− u.
grain.tex; 19/11/2001; 9:16; p.14
15 We apply the first part of Lemma 3 to v = Mε− u, λ ∈ IR and C ∈ CC([Mε+ v < λ]) such that C 6= ∅. We find a point x ∈ C ∩ [v < λ]. Let D = cc([v < λ], x). We know that |D| ≥ ε. Since Mε+ v ≤ v, we have that D ⊆ [Mε+ v < λ]. Since D ∩ C 6= ∅ and D is connected, we have D ⊆ C and, therefore, |C| ≥ ε. Thus, Mε0 (C) = C, yielding C ⊆ [Mε− Mε+ Mε− u < λ]. This proves that Mε− Mε+ Mε− u ≤ Mε+ Mε− u, and, thus, we have the equality Mε− Mε+ Mε− u = Mε+ Mε− u. Applying Mε+ to each member and using its idempotency, we conclude that Mε+ Mε− Mε+ Mε− u = Mε+ Mε− u. With a similar proof, using the second part of Lemma 3, we prove that Mε− Mε+ is idempotent.
4. Grain filter 4.1. Introduction and definitions The area opening, area closing and the extrema filters studied above are connected operators (see Subsection 5.2). We have seen that Mε− and Mε+ do not commute, and neither Mε− and Mε+ , Mε− Mε+ or Mε+ Mε− deals symmetrically with upper and lower level sets. Actually, they work in two steps: first upper, then lower level sets are treated (or in the opposite order). These operators are not self-dual. We are going to introduce now an operator which is self-dual when acting on continuous functions. We shall call it the grain filter and denote it by Gε . First we introduce the grain filter for sets and then we lift it to functions by the usual procedure described in Subsection 2.3. Recall that, besides the monotonicity of the operator on sets, a necessary and sufficient condition for that extension to be possible is the upper semicontinuity of the operator on sets, i.e, \
Gε (
n
Fn ) =
\
Gε (Fn )
(3)
n
holds for any decreasing sequence of sets Fn . Indeed, if we want to extend Gε to upper semicontinuous functions it suffices that the above property holds for any decreasing sequence of closed sets. We shall check that this is indeed true. Now, the self-duality on functions would be implied by the self-duality on sets (see below and Subsection 5.2 for
grain.tex; 19/11/2001; 9:16; p.15
16
V. Caselles and P. Monasse
definitions). The problem is that the grain filter Gε as we shall define it is not self-dual on sets. In spite of this, it is self-dual on functions, the reason being that it is self-dual for sets as far as the sets satisfy some additional conditions. And this additional conditions hold for almost all level sets of a continuous function. Thus the set operator Gε is self-dual for almost all level sets of a continuous function and this is sufficient to lift the self-duality to the extended operator G˜ε when acting on continuous functions. The above strategy is quite involved, and we shall not pursue it. Indeed, it is much simpler to prove directly the self-duality of G˜ε on continuous functions; later, in Section 5.2, having all details at hand, we shall give more details on the above strategy. DEFINITION 2. A contrast invariant operator T˜, associated to the set operator T , is said to be self-dual on continuous functions if the following equivalent properties hold for any continuous function u 1. T˜(−u) = −T˜(u). 2. ∀x, supB∈B inf y∈B u(y) = inf B∈B supy∈B u(y), B describing the structuring elements of T˜. 3. ∀λ, T ([u ≤ λ]) = [T˜u ≤ λ]. To show the equivalence of the first two properties, it suffices to write the second one with −u instead of u. By taking −λ instead of λ, we can see that the third property is equivalent to ∀λ,
T ([−u ≥ λ]) = [−T˜u ≥ λ].
(4)
Now, using the contrast invariance of T˜, (4) amounts to write ∀λ,
[T˜(−u) ≥ λ] = [−T˜u ≥ λ];
which means exactly that T˜(−u) = −T˜u. We recall the definition and the essential properties of a saturation operator. DEFINITION 3. Let p∞ be a fixed point of Ω. For X ⊆ Ω, we call holes of X the connected components of Ω \ X. The external hole of X is cc(Ω \ X, p∞ ) if p∞ 6∈ X. The other holes are the internal holes of X. The saturation of X, Sat(X), is the union of X and its internal holes. The following results are proved in [3] (see also [?] for 9):
grain.tex; 19/11/2001; 9:16; p.16
17
A
B
C D
E
Figure 1. Application of operator defined in Formula (5) to a set X composed of 5 connected components, A to E. B, D and E are too small, they are removed. A is sufficiently large and has no hole, it remains unchanged. Two holes of C are too small, they are filled, whereas the hole containing E is large enough, and remains a hole.
PROPOSITION 7. 1. X ⊆ Y ⇒ Sat(X) ⊆ Sat(Y). 2. Sat(Sat(X)) = Sat(X). 3. If X is connected, then Sat(X) is connected and for all H ∈ CC(Ω \ X), ∂H connected. 4. X open (resp. closed) ⇒ Sat(X) open (resp. closed). 5. p∞ 6∈ X ( Ω closed ⇒ Sat(X) = Sat(∂X). 6. If X is connected, then ∂Sat(X) is a connected subset of ∂X. 7. If X is connected and H is an internal (resp. external) hole of X, then Sat(H) = H (resp. Ω). 8. If X, Y are connected and X ∩ Y = ∅, then Sat(X) and Sat(Y) are either nested or disjoint. 9. Let Cn be a nonincreasing sequence of continua and C = ∩n Cn . Then Sat(C) = ∩n Sat(Cn ). 10. Let X be open or closed, C ∈ CC(X) and x ∈ Sat(C) \ C. Then ∃O ∈ CC(Ω \ X) such that x ∈ Sat(O) ⊆ Sat(C). Since an area threshold is involved, we define our set operator on measurable sets. For the developments of this Section it would be sufficient to define it on closed sets, but for later discussion we define it
grain.tex; 19/11/2001; 9:16; p.17
18
V. Caselles and P. Monasse
in the general context. If X is a measurable set, we define Gε X =
S
{ Sat(C) \ ∪i C0i : C ∈ CC(X), |Sat(C)| ≥ ε, Ci0 internal hole of C, |Ci0 | > ε}.
(5)
Since, if |Sat(C)| ≥ ε, then Gε (C) = Sat(C)\{∪i C0i : C0i internal hole of C, |C0i | > ε}, we may write Gε X =
[
{Gε C : C ∈ CC(X), |Sat(C)| ≥ ε}.
(6)
An example of such an operation applied to a set is illustrated in Figure 1. It shows that connected components are processed independently. For ε > |Ω|, we clearly have that Gε X = ∅ for any measurable set X. Thus we will always suppose that ε ≤ |Ω|. Observe that Gε X =
S
{ Sat(C) ∪ ∪i C0i : C ∈ CC(X), |Sat(C)| ≥ ε, Ci0 internal hole of C, |Ci0 | ≤ ε}.
(7)
4.2. Preliminary results Let X ⊆ Ω. For simplicity, we shall denote by Hc (X) the family of the internal holes of the connected components of X. LEMMA 4. Gε is nondecreasing on measurable sets. Proof. Let X ⊆ Y be measurable sets. Let C ∈ CC(X) be such that |Sat(C)| ≥ ε. Then there exists C 0 ∈ CC(Y ) such that C ⊆ C 0 . On the other hand, if H 0 is an internal hole of C 0 such that |H 0 | > ε, then H 0 is included in an hole H of C, and, thus, |H| > ε. It could happen that H is not an internal hole, in that case, H = H∞ := Ω \ Sat(C) Thus [
{H 0 : H 0 ∈ Hc (C 0 ), |H 0 | > ε} ⊆
and we deduce that Sat(C) \
[
{H : H ∈ Hc (C), |H| > ε} ∪ H∞
[
{H : H ∈ Hc (C), |H| > ε} =
[
Sat(C) \ (
{H : H ∈ Hc (C), |H| > ε} ∪ H∞ ) ⊆
Sat(C0 ) \
{H0 : H0 ∈ Hc (C0 ), |H0 | > ε}
[
We conclude that Gε C ⊆ Gε C 0 and, therefore, Gε X ⊆ Gε Y . LEMMA 5. Let A, B ⊆ Ω be closed sets such that A ∩ B = ∅. Then Gε A ∩ Gε B = ∅.
(8)
grain.tex; 19/11/2001; 9:16; p.18
19 Proof. Taking components of A and B instead of A and B, we may assume that A and B are connected. The result being obvious if Gε A, or Gε B, is empty, we may also assume that none of them is empty (thus, in particular, |Sat(A)| ≥ ε, |Sat(B)| ≥ ε). Observe that, by Proposition 7, item 8, Sat(A) and Sat(B) are either nested or disjoint. If they are disjoint, since Gε A ⊆ Sat(A) and Gε B ⊆ Sat(B), (8) is obvious. If they are nested, without loss of generality, we may assume that Sat(A) ⊆ Sat(B). Then Sat(A) is inside a hole H of B. We get that |H| ≥ |SatA| ≥ ε. Since Sat(A) is closed and H is open, H \Sat(A) is an open and nonempty set, thus, it has positive measure. This yields |H| > ε, and therefore H ∩ Gε B = ∅. Hence Sat(A) ∩ Gε B = ∅, which implies (8). LEMMA 6. Let X be a closed subset of Ω. Then Z ∈ CC(Gε X) ⇔ Z 6= ∅ and ∃Y ∈ CC(X) such that Z = Gε Y. Proof. Let CC(X) = {Ci }i∈I and let Iε ⊆ I be the set of indices for which |Sat(Ci )| ≥ ε. S
As we already observed we have the identity Gε X = i∈Iε Gε Ci . We also observe that, since Ci is closed, each hole H of Ci is open and closed in Ω \ Ci , and therefore Ci ∪ H is connected ([?], IV, Thm. 3.4). Now, Gε Ci , if not ∅, is the union of Ci and some of its internal holes and, thus, it is connected. S
Let J be a subset of Iε whose cardinal is at least 2, and let D = j∈J Gε Cj . We now prove that D is not connected. S
Since D0 = j∈J Cj is not connected, by the definition of connectedness, there is an open and closed subset E 0 in D0 different from ∅ since each of those sets is and D0 . Observe that E 0 is an union of Cj , S 0 connected. To be precise, let us write E = l∈L Cl , with ∅ 6= L ( J. S Let E = l∈L Gε Cl . Note that E = E 0 ∪l∈L {∪H : H ∈ Hc (Cl ), |H| ≤ ε}.
(9)
We prove that E is open and closed in D, hence, D is not connected. Clearly, we have that ∅ 6= E ( D. Since E 0 is open in D0 , there is an open set U 0 such that U 0 ∩ D0 = E 0 . Let U 00 be the union of the connected components of U 0 that meet (thus, contain) some Cl , l ∈ L. Since E 0 ⊆ U 0 , we have that E 0 ⊆ U 00 . Let U = U 00 ∪ E. Observe that U = U 00 ∪ E = U 00 ∪ E 0 ∪l∈L {∪H : H ∈ Hc (Cl ), |H| ≤ ε} = U 00 ∪l∈L {∪H : H ∈ Hc (Cl ), |H| ≤ ε}
grain.tex; 19/11/2001; 9:16; p.19
20
V. Caselles and P. Monasse
The set U 00 , as a union of open sets, is open, and the set U , as the union of U 00 and some internal holes of Cl , which are all open, is also open. If j ∈ J \ L, by Lemma 5 we have that E ∩ Gε Cj = ∅. Let us prove that also U 00 ∩ Gε Cj = ∅. Otherwise we would have U 00 ∩ Gε Cj 6= ∅,
(10)
and, by definition of U 00 there would be a connected component O of U 0 containing Cl , for some l ∈ L, and Gε Cj . We note that also O ∩ Cj 6= ∅. Indeed, if O ∩ Cj = ∅, then there is some internal hole H of Cj with |H| ≤ ε such that O ∩ H 6= ∅. Let us prove that H cannot contain Cl . If Cl ⊆ H, then Sat(Cl ) ⊆ H and, since H \ Sat(Cl ) is open and not empty, thus of positive measure, we would have |H| > |Sat(Cl )| ≥ ε, a contradiction. Thus Cl is not contained in H. Hence the hole Hl of Cj containing Cl does not coincide with H. Since O is connected, O∩H 6= ∅ and O ∩Hl 6= ∅, then O must intersect Cj . Thus we cannot assume that O ∩ Cj = ∅ and, indeed, O meets Cj . This implies that U 0 ∩ Cj 6= ∅ with j ∈ J \ L, contradicting the identity U 0 ∩ D0 = E 0 , which means that U 0 only intersects the Ci with i ∈ L. This contradiction proves that (10) does not hold, i.e., we have that U 00 ∩ Gε Cj = ∅ for any j ∈ J \ L. Therefore U 00 ∩ (D \ E) = U 00 ∩ ∪l∈J\L Cl = ∅, and as a consequence U ∩ D = (U 00 ∪ E) ∩ D = (U 00 ∩ D) ∪ (E ∩ D) = (U 00 ∩ E) ∪ E = E. We have shown that the set E is open in D. Applying the same argument to D \ E instead of D we prove that E is also closed in D. We have shown that D is not connected. Thus the components of Gε X are the sets Gε Ci . LEMMA 7. Let (Cn )n∈IN be a nonincreasing sequence of continua and T C = n Cn . If H is a hole of C, there exists n0 ∈ IN and a nondecreasing sequence (Hn )n≥n0 , each Hn being a hole of Cn , such that S H = n≥n0 Hn . Proof. If x ∈ H, then there is some n0 such that x 6∈ Cn for n ≥ n0 . Thus, if nS≥ n0 , x is in some hole Hn of Cn . Obviously, Hn ⊆ H, and therefore n≥n0 Hn ⊆ H. S Let y ∈ ∂ n≥n0 Hn , U be a neighborhood of y and V be a connected S neighborhood of y such that V ⊆ U . Since y ∈ n≥n0 Hn there is some n1 ≥ n0 such that Hn1 ∩ V 6= ∅; and, by monotonicity of (Hn ), we may write Hn ∩ V 6= ∅,
∀n ≥ n1 .
(∗)
grain.tex; 19/11/2001; 9:16; p.20
21 Since y ∈ Ω \ ∪n≥n0 Hn ⊆
T
n≥n1
Ω \ Hn , we also have that
V ∩ (Ω \ Hn ) 6= ∅,
∀n ≥ n1 .
(∗∗)
From (∗) and (∗∗), the connectedness of V implies that V ∩ ∂Hn 6= ∅,
∀n ≥ n1 .
Since ∂Hn ⊆ Cn , we get that V ∩ Cn 6= ∅ for all n ≥ n1 , and, thus, V ∩ Cn 6= ∅, for all n ≥ n1 . It follows that V ∩ C 6= ∅, which implies that U ∩ C 6= ∅. This being true for any neighborhood U of y, we get that y ∈ C = C. Thus [ ∂ Hn ⊆ C. n≥n0
S
S
This implies that H ∩ ∂ n≥n0 Hn = ∅, and, thus, n≥n0 Hn is closed in H. Since it is also open, as a union of open sets, the connectedness S of H yields H = n≥n0 Hn . THEOREM 2. The operator Gε is upper semicontinuous on closed sets, i.e., if (Kn )n∈IN is a nonincreasing sequence of closed subsets of Ω, then \ \ Kn = G ε Kn . Gε n∈IN
n∈IN
Proof. The inclusion of the left hand side term into the right hand side one is due to the monotonicity of Gε . We just have to show the other inclusion. T
Let x ∈ n Gε Kn . Using Lemma 6, for any n, there is some Cn ∈ CC(Kn ) such that x ∈ Gε Cn . For each n ≥ 1, Cn is inside some Q ∈ CC(Kn−1 ), and then Gε Cn ⊆ Gε Q. Thus x ∈ Gε (Q) ∩ Gε (Cn−1 ) 6= ∅, implying, by Lemma 6, that Q = Cn−1 . This shows that the sequence of continua (Cn ) is nonincreasing, soTthat their intersection C is a continuum ([?], Thm. 5.3). Since C ⊆ n Kn , the desired result will be implied if we prove that x ∈ Gε C. T
By Lemma 7, 9, we have that SatC = n SatCn . Thus |SatC| ≥ ε, hence C ⊆ Gε C. Since x ∈ Gε Cn ⊆ Sat(Cn ), we have that x ∈ Sat(C). If x ∈ C, then x ∈ Gε C. If x 6∈ C, there is an internal hole of C, say H, such that x ∈ H. By Lemma 7, there is a nondecreasing sequence Hn of internal holes of Cn such that H = ∪n Hn and we may assume that x ∈ Hn . Since x ∈ Gε Cn , the sequence Hn is such that |Hn | ≤ ε S and thus |H| = | Hn | ≤ ε. Hence x ∈ H ⊆ Gε C.
grain.tex; 19/11/2001; 9:16; p.21
22
V. Caselles and P. Monasse
4.3. Properties LEMMA 8. If A is a closed set, C a connected component of A and H an internal hole of C, then, for any x in H, H=
[
G.
G=Sat(G0 ):G0 ∈CC(Ω\A), x∈G⊆H
Proof. Let H 0 denote the right hand side of the above equality. Observe that, by Lemma 7, 10, H 0 6= ∅. Obviously, H 0 ⊆ H. Suppose that this inclusion is strict. The set H being connected and H 0 being open (as a union of open sets), H 0 is not closed in H, so that H ∩ ∂H 0 6= ∅. Let y ∈ H ∩ ∂H 0 and let U be a connected neighborhood of y which we may take contained in H, since H is an open set. Observe that U ∩ H 0 6= ∅, U ∩ (Ω \ H 0 ) 6= ∅. In particular, there is G0 ∈ CC(Ω \ A) such that G = Sat(G0 ) satisfies x ∈ G ⊆ H 0 and U ∩ G 6= ∅. We claim that U ∩ A 6= ∅. Otherwise, we would have U ⊆ Ω \ A. In that case G0 ⊆ U ∪ G0 ⊆ Ω \ A. Since G0 ⊆ H 0 and U ∩ (Ω \ H 0 ) 6= ∅ U cannot be contained in G0 and, thus, G0 ( G0 ∪ U . Let us observe that U ∩ G0 6= ∅ Indeed, U ∩ G 6= ∅ and y ∈ U \ H 0 ⊆ U \ G. Thus U ∩ ∂G 6= ∅. Since ∂G = ∂Sat(G0 ) ⊆ ∂G0 , we have that U ∩ ∂G0 6= ∅, and, therefore, also U ∩ G0 6= ∅. It follows that U ∪ G0 ⊆ Ω \ A and strictly contains G0 . This contradiction proves that U ∩ A 6= ∅. We conclude that y ∈ A = A. Since H is a hole of C ∈ CC(A) and y ∈ H, we may apply Lemma 7, 10, and find O0 ∈ CC(Ω \ A) such that y ∈ Sat(O0 ) ⊆ H ⊆ Sat(C). Let O = Sat(O0 ), O, O0 being open sets. Let V be a neighborhood of y such that V ⊆ O, and, since y ∈ ∂H 0 , V meets H 0 and Ω \ H 0 . Since V ∩ H 0 6= ∅, there is Q0 ∈ CC(Ω \ A) such that Q = Sat(Q0 ) satisfies x ∈ Q ⊆ H 0 and such that V ∩ Q 6= ∅. Thus, also O ∩ Q 6= ∅. Both, O and Q being shapes, they must be nested. If O ⊆ Q, then V ⊆ Q ⊆ H 0 and V could not intersect Ω\H 0 , a contradiction. We must have Q ⊆ O. Since x ∈ Q, also x ∈ O ⊆ H. We conclude that O ⊆ H 0 . Then y ∈ H 0 , a contradiction. We conclude that H = H 0 . 6 A. Assume LEMMA 9. Let A be a closed subset of Ω such that p∞ ∈ T that x ∈ Ω \ Gε A. Then D = C∈CC(A) Ω \ Sat(C) is a continuum contained in Ω \ A such that p∞ ∈ D. Proof. For any C ∈ CC(A), since p∞ 6∈ C, Ω\SatC is a nonempty and of’s connected set, and, thus, the set Ω \ SatC is a continuum. By Lindel¨ theorem, the intersection of a family of continua can be written as the intersection of a sequence of them. We can thus find a sequence (Cn )
grain.tex; 19/11/2001; 9:16; p.22
23 of connected components of A such that \
Ω \ Sat(C) =
\
Ω \ Sat(Cn ).
n∈IN
C=cc(A)
T
Let Dn = nk=0 Ω \ SatCk . Clearly, (Dn ) is a nonincreasing sequence of continua, and we may write \
Ω \ Sat(C) =
C=cc(A)
\
Dn ,
n∈IN
which is thus a continuum D. Obviously p∞ ∈ D. Let F = Ω \ A. Let us prove that D ⊆ F . If this is not the case, there is y ∈ D \ F ⊆ A, and there exists C ∈ CC(A) with y ∈ C. Since y ∈ D ⊆ Ω \ Sat(C), y is not in the interior of Sat(C) while it is in C. Thus y ∈ ∂Sat(C) ⊆ ∂C. Now, we prove that (*) for any connected neighborhood U of y, U ∩F = 6 ∅. This will imply that y ∈ F = F , a contradiction. We conclude that D ⊆ F . To prove (*), assume on the contrary that U is a connected neighborhood of y such that U ∩ F = ∅. Then U ⊆ A, and also C ∪ U ⊆ A. Since y ∈ C ∩ U , the set C ∪ U is connected and this implies that U ⊆ C. On the other hand, since y ∈ ∂C, U ∩ (Ω \ C) 6= ∅. This contradiction proves (*) and the Lemma follows. LEMMA 10. Let A, B ⊆ Ω be closed sets such that A ∪ B = Ω. Then Gε A ∪ Gε B = Ω.
(11)
Proof. Let x 6∈ Gε A. We shall prove that x ∈ Gε B. Since x 6∈ Gε A, one of the following cases happens: (i) ∀C = cc(A), x 6∈ Sat(C). (ii) ∀C = cc(A), x ∈ Sat(C) ⇒ |Sat(C)| < ε. (iii) There is some C = cc(A) such that x ∈ Sat(C) and |Sat(C)| ≥ ε. Suppose that (i) holds. Observe that in this case p∞ 6∈ A, since, otherwise, there would be a connected component C∞ of A containing p∞ . As a consequence x ∈ Ω = Sat(C∞ ). Let D be the set defined in the Lemma 9. Then x ∈ D and D ⊆ B. Since Sat(D) = Ω, we have |Sat(D)| ≥ ε, and, therefore, x ∈ D ⊆ Gε D ⊆ Gε B. Suppose that (ii) holds. As above we observe that p∞ 6∈ A. Let D be the set defined in Lemma 9. Let DB be the connected component of B containing D. If x ∈ DB we have again that x ∈ DB ⊆ Gε DB ⊆ Gε B,
grain.tex; 19/11/2001; 9:16; p.23
24
V. Caselles and P. Monasse
and we are done. If x 6∈ DB , since Sat(DB ) = Ω, then x is in a hole H of D. Thanks to Lemma 8, we may write [
H=
G.
G=Sat(G0 ),G0 ∈CC(Ω\B)), x∈G⊆H
Thanks to Lindel¨ of’s theorem, we may write H = ∪n Gn where, for each n, Gn = Sat(G0n ), G0n ∈ CC(Ω \ B), and x ∈ Gn ⊆ H. Since Ω \ B ⊆ A, we have that G0n ⊆ A and there is a connected component C of A such that G0n ⊆ C. Therefore Gn = Sat(G0n ) ⊆ Sat(C) and we obtain that |Gn | ≤ |Sat(C)| < ε. We conclude that |H| = supn∈IN |Gn | ≤ ε. Thus x ∈ H ⊆ Gε DB ⊆ Gε B. Finally, we suppose that (iii) holds. Let F = {E = Sat(C) : C ∈ CC(A), x ∈ E, |E| ≥ ε} and T =
\
C.
E∈F
We claim that T = Sat(T0 ), with T 0 ∈ CC(A). If F contains a finite number of sets, our claim is true since they are nested. Thus, we may assume that F contains an infinite number of sets. Thanks to Lindel¨ of’s as the intersection of a seTheorem, we may write their intersection T quence En of them. By taking nk=0 Ek ∈ F instead of En , we may also assume that this sequence is nonincreasing. The set T is therefore a continuum and |T | = inf n∈IN |En | ≥ ε. Let us prove that ∂T ⊆ A. For that, let y ∈ ∂T and let U a connected neighborhood of y. Then U ∩ T 6= ∅ and ∪n (Ω \ En ) = U ∩ (Ω \ T ) 6= ∅. There is some n0 such that U ∩ (Ω \ En0 ) 6= ∅. Since also U ∩ En0 6= ∅, we have that U ∩ ∂En0 6= ∅. Since ∂En0 ⊆ ∂A ⊆ A, we conclude that U ∩ A 6= ∅, and, therefore y ∈ A = A. This proves that ∂T ⊆ A. On the other hand, we observe that the complement of T is connected, being the union of an increasing sequence of connected sets. Since Ω is unicoherent, and ∂T = T ∩ (Ω \ T ), being the inytersection of two continua, it is connected. Thus, there is some T 0 ∈ CC(A) such that ∂T ⊆ T 0 . If p∞ ∈ T , then p∞ ∈ E for any E ∈ F. Then E = Ω for any E ∈ F, and, thus T = Ω = Sat(C) for any Sat(C) ∈ F. If p∞ 6∈ T , then T 6= Ω and we may use Proposition 7, 5, to obtain that T = Sat(∂T) ⊆ Sat(T0 ). Since ∂T ⊆ T 0 and ∂T ⊆ T ⊆ E for any E ∈ F, we have that T 0 ∩E 6= ∅, and therefore Sat(T0 ) ⊆ E for any E ∈ F. It follows that Sat(T0 ) ⊆ T. We have, thus, the equality T = Sat(T0 ) and T ∈ F. This implies that T 0 ⊆ Gε T 0 ⊆ Gε A, and, thus, x 6∈ T 0 . Since x ∈ T , then x must be in a hole H of T 0 and we must have |H| > ε, since otherwise x ∈ H ⊆ Gε T 0 ⊆ Gε A. Using Lemma 8, we
grain.tex; 19/11/2001; 9:16; p.24
25 write H=
[
G,
G=Sat(G0 ):G0 ∈CC(Ω\A), x∈G⊆H
and, again, using Lindel¨ of’s Theorem, we may write the above union as the union of a sequence Gn , which we may take as nondecreasing since the sets Gn are saturated and all contain x. Since |H| > ε, there is some n0 ∈ IN such that |Gn | > ε for all n ≥ n0 . Fix such a value of n. We write Gn = Sat(G0n ), where G0n ∈ CC(Ω \ A) and x ∈ Gn ⊆ H. Let Q ∈ CC(B) such that G0n ⊆ Q. If x ∈ G0n , then also x ∈ Gε G0n ⊆ Gε Q ⊆ Gε B. If x 6∈ G0n , then x is in a hole H 0 of G0n , and, since ∂H 0 ⊆ ∂G0n ⊆ ∂A ⊆ A, there is K ∈ CC(A) containing ∂H 0 . Observe that K intersects H 0 , a hole of G0n . Since p∞ 6∈ H 0 , by Proposition 7, 5, we have that H 0 = Sat(∂H0 ) ⊆ Sat(K). Since K ⊆ A and G0 ⊆ Ω \ A, K and G0n cannot intersect. Hence K cannot intersects another hole of G0n , since it would intersect G0n . Thus K ⊆ H 0 , and, also Sat(K) ⊆ H0 ( Sat(G0n ) ⊆ T. In particular, H 0 = Sat(K) 6∈ F, and this implies that |H 0 | < ε. We conclude that H 0 ⊆ Gε G0n and, thus, x ∈ Gε G0n . Since G0n is contained in a connected component of B also x ∈ Gε B. ˜ ε acting THEOREM 3. The operator Gε may be lifted to an operator G ˜ ε maps upper semiconon upper semicontinuous functions. Moreover G tinuous functions into upper semicontinuous functions. Proof. By Lemma 2, and the results recalled in Subsection 2.3, Gε may be lifted to an operator defined on upper semicontinuous functions ˜ ε u ≥ λ] = Gε [u ≥ λ], λ ∈ IR. To prove that G ˜ ε u is by the formula [G upper semicontinuous, it suffices to prove that Gε [u ≥ λ] is a closed set. Thus, it will be sufficient to prove that the image by Gε of a closed set F is also closed. Observe that this is true if F is closed and connected. Indeed, in this case, the complement of Gε F is a union of holes of F which are open, and, thus, Gε F is closed. Assume now that F is a general closed subset of Ω. Let (xn )n∈IN a sequence of points of Gε F converging to x ∈ Ω. We shall prove that x ∈ Gε F . As shown by Lemma 6, xn belongs to some Gε Fn , where Fn ∈ CC(F ). Obviously, we may assume that x 6∈ Gε Fn , for all n. If the family {Fn , n ∈ IN } is finite, we can extract a subsequence of (xn )n∈IN belonging to some Gε Fn0 which is closed. Thus, x ∈ Gε Fn0 ⊆ Gε F . We may now assume that {Fn , n ∈ IN } is infinite, and, possibly after extraction of a subsequence, we may also assume that Fm ∩ Fn = ∅ for any m 6= n. Since Sat(Gε Fn ) = Sat(Fn ), we have that |Sat(Fn )| ≥ ε. This implies that only a finite number of these saturations are two by two disjoint.
grain.tex; 19/11/2001; 9:16; p.25
26
V. Caselles and P. Monasse
Thus, after extraction of a subsequence, if necessary, we may assume that they all intersect, so that they form either a decreasing or an increasing sequence. If the sequence (Sat(Fn ))n∈IN is decreasing, then their intersection is a set Sat(F0 ), F 0 ∈ CC(K). This can be shown as in Lemma 10. Then we have that |Sat(F0 )| = inf n |Sat(Fn )| ≥ ε. Since F 0 ∩ Fn = ∅ for all n (otherwise, we would have F 0 = Fn for all sufficiently large n), and F 0 ⊆ Sat(Fn ), we have that Sat(F0 ) is contained in an internal hole Hn of Fn for any n. Since Hn is open, we have that |Hn | > ε and then Hn ∩ Gε Fn = ∅. This implies that xn 6∈ Sat(F0 ) for any n. Since xn converges to x and x ∈ Sat(F0 ) we conclude that x ∈ ∂Sat(F0 ) ⊆ ∂F0 ⊆ F0 ⊆ Gε F0 ⊆ Gε F, the desired result. Let us assume now that (Sat(Fn ))n∈IN is increasing. We claim that x ∈ lim inf Fn . This is obviously true if xn ∈ Fn . If xn 6∈ Fn , then there is an internal hole Hn of Fn such that |Hn | ≤ ε and x ∈ Fn . Let V be a connected neighborhood of x. For n large enough, xn ∈ V , thus Hn ∩ V 6= ∅. Since x 6∈ Gε Fn , V also intersects another hole of Fn . Hence V ∩Fn 6= ∅. It follows that x ∈ lim inf Fn . The lim inf of Fn being nonempty, its lim sup is a continuum C [?], 42.II.6. Since F is compact, it follows that C ⊆ F . Let F 0 = cc(F, C). We observe that x ∈ F 0 . If Fn ∩ F 0 6= ∅, then Fn = F 0 since both are connected components of F . Since we are assuming that the sets Fn are two by two disjoint, this cannot happen more than once. Thus we may assume that Fn ∩ F 0 = ∅ for all n. The sequence (Sat(Fn )) being increasing, all Fn are in the same hole H of F 0 . This hole must be internal. Suppose that H is the external hole of F 0 . Since H is open, there is a continuum L contained in H joining p∞ and an arbitrary point y0 of F0 . Since F0 is in an internal hole of F1 , there is some y1 ∈ L ∩ F1 . In this manner, we can construct a sequence (yn )n∈N such that yn ∈ L ∩ Fn for all n. L being compact, some subsequence of (yn ) converges to a point y ∈ L ∩ C. It follows that F 0 ∩L 6= ∅, contrary to the assumption that L was contained in H. This proves that H is internal. Since Gε Fn ⊆ Sat(Fn ) ⊆ H ⊆ Sat(F0 ), we have that |Sat(F0 )| ≥ ε, thus x ∈ F 0 ⊆ Gε F 0 ⊆ Gε F . ˜ ε maps continuous functions to continuous functions THEOREM 4. G and it is self-dual when acting on them. ˜ ε (−u) = −G ˜ ε (u) for any function Proof. First we shall prove that G u ∈ C(Ω). For that we shall prove that condition 3 of Definition 2 holds. According to (8), we may write for any λ ∈ IR, ∀n > 0,
Gε [u ≤ λ] ∩ Gε [u ≥ λ +
1 ] = ∅, n
grain.tex; 19/11/2001; 9:16; p.26
27 ˜ ε u ≥ λ + 1 ], by taking the intersection and, since Gε [u ≥ λ + n1 ] = [G n over all n, we get ˜ ε u > λ] = ∅. Gε [u ≤ λ] ∩ [G Therefore
˜ ε u ≤ λ]. Gε [u ≤ λ] ⊆ [G
Now, let x be such that for all n > 0, x 6∈ Gε [u ≥ λ+ n1 ]. Due to (11), T we have that x ∈ n Gε [u ≤ λ + n1 ]. Since Gε is upper semicontinuous, x ∈ Gε
\ n
[u ≤ λ +
1 ] = Gε [u ≤ λ]. n
This proves that Gε [u ≤ λ] ∪ and, thus, Gε [u ≤ λ] ∪
[ n
[ n
Gε [u ≥ λ +
1 ] = Ω, n
˜ εu ≥ λ + [G
1 ] = Ω. n
By taking the complement of each part, we get: ˜ ε u ≤ λ] = ∅, (Ω \ Gε [u ≤ λ]) ∩ [G which proves that
˜ ε u ≤ λ] ⊆ Gε [u ≤ λ], [G
and, actually, we have the equality of both sets. ˜ ε u is upper semicontinApplying Theorem 3, if u is continuous, G ˜ ε (−u) = −G ˜ ε u is also uous. Since −u is also upper semicontinuous, G ˜εu ˜ upper semicontinuous, hence Gε u is lower semicontinuous. Thus, G is continuous. ˜ ε0 = G ˜ ε0 ◦ G ˜ ε . Therefore G ˜ ε is PROPOSITION 8. For ε0 ≥ ε, G idempotent. ˜ ε is idempotent derives from the preProof. The conclusion that G 0 vious statement by taking ε = ε. The result amounts to show that for any λ, Gε0 [u ≥ λ] = Gε0 Gε [u ≥ λ]. We distinguish three families among the connected components (Ci )i∈I of [u ≥ λ]: Iε0 = {i ∈ I : |Sat(Ci )| ≥ ε0 }, Iε = {i ∈ I : ε0 > |Sat(Ci )| ≥ ε}, I0 = {i ∈ I : ε > |Sat(Ci )|}.
grain.tex; 19/11/2001; 9:16; p.27
28
V. Caselles and P. Monasse
We observe that Iε = ∅ if ε = ε0 . Thanks to Lemma 6, we may write Gε [u ≥ λ] =
[
{Sat(Ci ) \
i∈Iε0
[
{Sat(Ci ) \
[
[
H, H internal hole of Ci , |H| > ε} ∪
H, H internal hole of Ci , |H| > ε}.
i∈Iε
If i ∈ Iε , the measure of Sat(Sat(Ci ) \
[
H) = Sat(Sat(Ci )) = Sat(Ci )
is < ε0 and Gε0 (Sat(Ci ) \
[
H) = ∅.
For the same reason, if i ∈ Iε0 , we have |Sat(Sat(Ci ) \ [
Gε0 (Sat(Ci ) \
[
H) = Sat(Ci ) \
S
H)| ≥ ε0 . Thus,
H = Gε0 Ci .
|H|>ε0
|H|>ε
In conclusion, this yields Gε0 Gε Ci = Gε0 Ci . The following properties are an easy consequence of the definition ˜ ε. of G ˜ ε satisfies the following properties LEMMA 11. The operator G ˜εu ≤ G ˜ ε v, for any u, v ∈ USC(Ω). (i) If u ≤ v, then G ˜ ε (α) = α for any α ∈ IR. (ii) G ˜ ε (u) + α for any function u ∈ USC(Ω) and any ˜ ε (u + α) = G (iii) G α ∈ IR. ˜ ε is increasing and idempotent, it is indeed a filter. Thus, G LEMMA 12. Let u be an upper semicontinuous function and let v = ˜ ε v = v for any ε < δ. Mδ+ Mδ− u. Then G ˜ ε v ≥ λ] = Gε [v ≥ λ], it will be Proof. Let us fix ε < δ. Since [G sufficient to prove that Gε [v ≥ λ] = [v ≥ λ] for almost all λ ∈ IR. Let K = [v ≥ λ]. We observe that Gε K =
[
{Sat(C)\
[
H, H internal hole of C, |H| > ε}.
C∈CC(K),|Sat(C)|≥ε
grain.tex; 19/11/2001; 9:16; p.28
29 Since, by Proposition 6, the connected components of K have measure ≥ δ, any C ∈ CC(K) satisfies |Sat(C)| ≥ ε. Similarly, since any internal hole of any C ∈ CC(K) contains a connected component of [v < λ] ([?], Prop. 14), it has also measure ≥ δ > ε. Hence, the family of internal holes H of the connected components of K such that |H| ≤ ε is empty. We conclude that Gε K = K and, therefore, Gε v = v. ˜ ε u → u uniformly as ε → PROPOSITION 9. Let u ∈ C(Ω). Then G 0+. Proof. Using Lemma 12, we have ˜ εu − u = G ˜ εu − G ˜ ε (M + M − u) + M + M − u − u. G δ δ δ δ for any ε, δ > 0 such that ε < δ. By Proposition 5, given α > 0, there is some δ0 > 0 such that u − α ≤ Mδ+0 Mδ−0 u ≤ u + α. This implies that ˜ εu − α ≤ G ˜ ε (M + M − u) ≤ G ˜ εu + α G δ0 δ0
∀ε > 0,
and, therefore, ˜ ε (M + M − u) − G ˜ ε u| ≤ α |G δ0 δ0
∀ε > 0.
Now, we choose ε < δ0 and we obtain that ˜ ε u − u| ≤ |G ˜ ε (M + M − u) − G ˜ ε u| + |M + M − u − u| ≤ 2α. |G δ0 δ0 δ0 δ0 The proposition follows.
5. Relations with other operators of Mathematical Morphology 5.1. Relations with grain operators We want to compare the grain filter described above with the notion of grain operators as defined in [8]. To fix ideas, we shall work in Ω with the classical connectivity. Thus, we denote by C the family of connected sets of Ω. A grain criterion is a mapping c : C → {0, 1}. Given two grain
grain.tex; 19/11/2001; 9:16; p.29
30
V. Caselles and P. Monasse
criteria, f for the foreground and b for the background, the associated grain operator ψf,b is defined by ψf,b (X) =
[
{C : (C = cc(X) and f (C) = 1) or (C = cc(X c ) and b(C) = 0) }.
In [8], Heijmans characterizes grain operators that are selfdual and those that are increasing. Indeed, he proves that ψf,b is self-dual if and only if f = b. He also proves that ψf,b is increasing if and only if f and b are increasing and the following condition holds sup(f (cc(X ∪ {x}, x)), b(cc(X c ∪ {x}, x)) = 1,
(12)
for any X ⊆ Ω and any x ∈ Ω. We shall say that a grain criterion c : C → {0, 1} is upper semicontinuous on compact sets if c(∩n Kn ) = inf n c(Kn ) for any decreasing sequence of continua Kn , n ∈ IN . PROPOSITION 10. Let ψ be a self-dual and increasing grain operator in Ω associated to the grain criterion c. Assume that c upper semicontinuous. Then ψ(X) = X for any X ⊆ Ω. Proof. We have that either c({x}) = 1 for all x ∈ Ω, or c({x}) = 0 for some point x ∈ Ω. In the first case, we deduce that c(X) = 1 for any nonempty subset X of Ω and, therefore, we have that ψ(X) = X for any ∅ 6= X ⊆ Ω. Since also ψ(∅) = ∅, we have that ψ(X) = X for any X ⊆ Ω. In the second case, using the upper semicontinuity of c we have that c(B(x, r)) = 0 for some r > 0 small enough. Then, we choose X = B(x, r) and observe that c(cc(X ∪ {x}, x)) = c(X) = 0 and c(cc(X c ∪ {x}, x)) = c({x}) = 0, which contradicts (12). The above proposition says that there are no nontrivial translation invariant, increasing and self-dual grain operators. Other types of connected operators called flattenings and levelings were introduced by Meyer in [15, 16] and further studied in [29]. In particular, Serra proves that there exist increasing and selfdual flattenings and levelings based on markers [29]. 5.2. Relations with connected operators Finally, let us prove that the grain filter we have introduced above corresponds to a universal criterion to define increasing and self-dual filters. Let us recall the definition of connected operator [25, 30, 8]. For that, given a set X ⊆ Ω, we denote by P (X) the partition of Ω constituted by the cc(X) and cc(X c ). The family of all subsets of X will be denoted by P(Ω).
grain.tex; 19/11/2001; 9:16; p.30
31 DEFINITION 4. Let F ⊆ P(Ω). An operator T : F → F is connected if the partition P (T (X)) is coarser than P (X) for every set X ⊆ Ω. Let B(Ω) be the family of Borel sets of Ω, i.e., the σ-algebra of subsets of Ω generated by the open sets. Observe that, if X ∈ B(Ω), then the connected components of X are also in B(Ω). Given a connected operator T : B(Ω) → B(Ω) we shall say that (i) T is increasing if T (X) ⊆ T (Y ) for any X, Y ∈ B(Ω) such that X ⊆ Y ⊆ Ω. (ii) ψ acts additively on connected components if T (X) = ∪i T (Xi ) when Xi is the family of connected components of X ∈ B(Ω). (iii) T is self-dual if T (Ω \ X) = Ω \ T (X) for any open or closed set X ⊆ Ω. (iv) T is bounded if p∞ 6∈ T (X) when p∞ 6∈ X. We have restricted the notion of self-duality of T to open and closed sets for convenience. Indeed this will be sufficient for our purposes, which are to extend the self-duality of the set operator to continuous functions. In the context of Mathematical Morphology this notion could be defined for any subset of Ω. We can give an explicit formula for connected, increasing, bounded self-dual operators which act additively on connected components. For that let us recall the definition and the essential properties of a saturation operator. PROPOSITION 11. Let T : B(Ω) → B(Ω) be a connected operator. Suppose that T is increasing, self-dual, bounded and acts additively on connected components. Let Ker T := {X ⊆ Ω : T (X) = ∅}. Let X ⊆ Ω be an open or closed connected set. Then, if Sat(X) 6∈ Ker T, we have T (X) = Sat(X) \
[
{H : H ∈ H(X) and H 6∈ Ker T }.
where Hc (X) denotes the family of internal holes of X. Proof. Since T is self-dual, without loss of generality, we may assume that p∞ 6∈ X. Since T is a connected operator, if Z is simply connected, then T (Z) must be one of the sets {∅, Z, Ω \ Z, Ω}. Since ψ is bounded we must have that either T (Z) = ∅ or T (Z) = Z. In particular, either T (Sat(X)) = ∅ or = Sat(X). In the first case, we have that Sat(X) ∈ KerT. In the second case, using the additivity of T
grain.tex; 19/11/2001; 9:16; p.31
32
V. Caselles and P. Monasse
on connected components and the observation at the beginning of the proof, we have T (Ω \ X) = T (Ω \ Sat(X)) = (Ω \ Sat(X)) = (Ω \ Sat(X))
[
[ [
{T(H) : H ∈ Hc (X)}
{ψ(H) : H ∈ Hc (X) and H 6∈ Ker T } {H : H ∈ Hc (X) and H 6∈ Ker T }.
Now, using the self-duality of T we have T (X) = Ω \ T (Ω \ X) = Sat(X) \
[
{H : H ∈ Hc (X) and H 6∈ Ker T }.
Obviously, if T is increasing, then Ker T is an ideal of sets, i.e., if Y ⊆ X and X ∈ Ker T , then Y ∈ Ker T . THEOREM 5. Let T : B(Ω) → B(Ω) be an upper semicontinuous operator on closed sets which is increasing and self-dual. Then the associated operator T˜ is increasing and self-dual when defined on continuous functions. Proof. Since T is upper semicontinuous on closed sets we know that T˜ can be defined on upper semicontinuous functions, hence, on continuous functions. We are not saying that the image by T˜ of an upper semicontinuous is upper semicontinuous. This would be true if the image by T of a close set would be closed, and, then also the image by T˜ of a continuous function would be continuous. Let u ∈ C(Ω. Since T is self-dual, we know that T ([u ≥ λ]) = Ω \ T ([u < λ])
(13)
for all λ ∈ IR. These identities will imply that T˜(−u) = −T˜(u).
(14)
Indeed to prove (14) it will be sufficient that (13) holds for a dense subset of values of λ ∈ IR. Thus, let Λ be a dense subset of IR such that (13) holds for any λ ∈ Λ. Let x ∈ Ω. We know that T˜(u)(x) = sup{λ ∈ Λ : x ∈ T ([u ≥ λ])}. Using (13) we may write T˜(u)(x) = sup{λ ∈ Λ : x ∈ Ω \ T ([u < λ])}.
grain.tex; 19/11/2001; 9:16; p.32
33 Since −Λ = {−λ : λ ∈ Λ} is also dense in IR, we have −T˜(−u)(x) = = = = =
− sup{µ0 ∈ −Λ : x ∈ T ([−u ≥ µ0 )} − sup{µ0 ∈ −Λ : x ∈ T ([u ≤ −µ0 ])} − sup{µ0 ∈ −Λ : x ∈ T ([u < −µ0 ])} − sup{−µ ∈ −Λ : x ∈ T ([u < µ])} inf{µ ∈ Λ : x ∈ T ([u < µ])}.
The only identity of the above ones which needs a comment is the third. It is an immediate consequence of the increasing character of T and the density of Λ. Let us prove that inf{µ ∈ Λ : x ∈ T ([u < µ])} = sup{λ ∈ Λ : x ∈ Ω \ ([u < λ])}.
(15)
Let µi , λs be the left and right hand side of (15), respectively. Let λ > λs , λ ∈ Λ. Then x 6∈ Ω \ T ([u < λ]), i.e., x ∈ T ([u < λ]). Thus (λs , ∞) ∩ Λ ⊆ {µ ∈ Λ : x ∈ T ([u < µ])}. It follows that µi ≤ λs . Suppose that µi < λs . Let µi < µ < ρ < λ < λs ), µ, ρ, λ ∈ Λ. Then x ∈ T ([u < µ]) ⊆ T ([u < ρ]). On the other hand x ∈ Ω\([u < λ]). Since ρ < λ also x ∈ Ω\T ([u < ρ]). This contradiction proves that µi = λs . It follows that T˜(−u)(x) = −T˜(u)(x). We have shown that Gε is upper semicontinuous on closed sets and increasing (moreover, it acts additively on connected components and it is bounded). Thus, Theorem 5 would imply that G˜ε is a dual operator on C(Ω) if Gε would be self-dual. The fact is that Gε is not self-dual. Indeed, let X be an open or closed ball in Ω such that |X| = ε and p∞ 6∈ X. Then Gε X = X and Gε (Ω \ X) = Ω, and we see that Gε is not self dual. The problem comes from connected sets which have saturations or holes of area ε. One could think that this could be avoided if we used the definition Gε X =
S
{ Sat(C) \ ∪i C0i : C ∈ CC(X), |Sat(C)| > ε, Ci0 internal hole of C, |Ci0 | > ε},
(16)
but in this case Gε would not be upper semicontinuous. Indeed, let Xn = B(p, rn ) ⊆ Ω and X = B(p, r) with rn ↓ r and |X| = ε. Then, using (16) we have Gε Xn = X − n while Gε X = X. Thus, this definition is not satisfactory if we want to deduce easily that Gε induces an operator acting on USC(Ω). This is the reason why we chose our definition of Gε given in (5). The inconvenience of Gε being not self-dual is not a major one, since it turns out that it is generically self-dual. Indeed, the following proposition holds.
grain.tex; 19/11/2001; 9:16; p.33
34
V. Caselles and P. Monasse
PROPOSITION 12. Assume that E is a closed set with a finite number of connected components such that Ω \ E has also a finite number of connected components. Assume that for any C ∈ CC(E), Sat(C) and the holes of C have measure 6= ε. Then Gε (E) = Ω \ Gε (Ω \ E) This is indeed sufficient to prove that G˜ε is self-dual on C(Ω). We shall not give the full details of the proof, having chosen to provide different proof which we find more direct. However, let us give a sketch of this proof based on sets, assuming Proposition 12. Let u ∈ C(Ω) and let v = Mε+ Mε− u. Then one can prove that almost all upper level sets of v, [v ≥ λ], satisfy the assumptions of Proposition 12. We conclude that (17) Gε [v ≥ λ] = Ω \ Gε [v < λ] holds for almost all λ ∈ IR. Now, we recall that in Theorem 5 the identity (18) Gε (−v) = −Gε (v) could be proved when (17) was true for a dense set of λ, and this is here the case. Thus (18) holds. Now, approximating u by v = Mε+ Mε− u, let˜ ε under uniform convergence ting δ → 0+ and using the continuity of G ˜ ε (−u) = −G ˜ ε (u). The full proof would require more we deduce that G space than the one we devoted here. Finally, let us note that the present proof is essentially based on Lemma 10, which also contributes to the ˜ ε maps C(Ω) into C(Ω). proof of Theorem 3 and to the proof that G This last result could be obtained differently, through approximations ˜ ε maps USC(Ω) into USC(Ω) by v = Mε+ Mε− u, but the fact that G requires the approach presented in the paper. ˜ ε is translation Finally, let us notice that, when defined on IRN , G invariant, since the notions of connected set, holes, and measure are translation invariant. 5.3. Interpretation Similar remarks to those for the extrema filters can be made concerning ˜ ε , as defined in [3]. In that reference, the “shapes” of the shapes of G an image refer to the saturations of its connected components of level ˜ ε u are the shapes of u of sufficient measure. G ˜ε sets. The shapes of G corresponds to a pruning of the tree of shapes of u.
grain.tex; 19/11/2001; 9:16; p.34
35 6. Experiments 6.1. Algorithm We propose to adapt the algorithm proposed by Vincent in [31, 32] to the self-dual grain filter. This algorithm is very close to the one proposed in [19, 20]. We scan the pixels one after one and modify the image, ensuring the following property: if S is the set of scanned pixels, the connected components of level sets without internal holes and meeting S have area (i.e., number of pixels) at least ε. Once all pixels are scanned, this ensures that the image is a fixed point of the grain filter. At pixel P , we extract by a classical region growing algorithm the connected component of isolevel set containing P , call it C and its level λ. There are different cases: − C has neighbors with levels less and larger than λ, C has an internal hole, or its area is at least ε. In this case, we do not modify the image and resume the scan. − C has all neighbor pixels at level less (resp. larger) than λ, no internal hole, and its area is less than ε. C is then a regional extremum. We put all pixels of C at the gray level of the neighbor closest to λ and continue the region growing by extracting the connected component of isolevel of the modified image at this new level. From these cases, it appears clearly that it is useful to initiate the region growing only at pixel of local extremum of gray level. In order to memorize neighbors of the current region and their levels, it is convenient to use priority queues, as proposed in [31, 32], priority of a pixel at level λ0 being given by −|λ − λ0 |. A convenient way to store this structure is to use a heap, as in heap sort algorithm. 6.2. Experimental results Theoretically, the filters Mε+ Mε− , Mε− Mε+ and Gε are different. This is illustrated in Figure 2. The second row shows the filtered images G3 u, M3+ M3− u and M3− M3+ u; they are all different, stressing that their respective notions of grains are different. The difference appears in presence of holes. Concerning natural images, the difference would be the most apparent on certain images of textures, for which the nestedness of shapes would be important. Figure 3 shows a complex texture, and Figure 4 the image filtered according to the three filters of parameter 30 pixels. Whereas they are actually
grain.tex; 19/11/2001; 9:16; p.35
36
V. Caselles and P. Monasse
2
0
2
0
1
1
2
2
1
1
Figure 2. Top-left: original image u. The three constant regions are supposed of area 2. Bottom left: G3 u. Middle column: M3− u and M3+ M3− u. Right column: M3+ u and M3− M3+ u.
Figure 3. Texture image of a carpet, size 254 × 173.
different, they are visually equivalent, and distinguishing them requires some effort. We can explain that by the fact that connected components of level sets having a hole of greater area than themselves are scarce. In other words, the situation illustrated by Figure 2 is not frequent. Finally, the effect of the grain filter with respect to impulse noise is illustrated in Figure 5. The top-right image has got impulse noise of frequency 20%, meaning that around 1 pixel out of 5 is changed to an arbitrary value (independent of the original value). It is visible that after application of the grain filter G40 , the images are fairly close. The
grain.tex; 19/11/2001; 9:16; p.36
37
Figure 4. Three grain filters applied to the image u of Figure 3. Left column: G30 u, + − − + + − − + M30 M30 u and M30 M30 u. Right column: difference images; M30 M30 u − M30 M30 u, − + + − G30 u − M30 M30 u and G30 u − M30 M30 u.
level lines become noisy, but for most of them, their presence or absence is not affected by noise. 6.3. Complexity The theoretical complexity of the algorithm is not easy to estimate, as it depends on image complexity. However, we can give experimental computation times. Measurements are done on a Pentium 2 processor at 300 MHz. For original image of Figure 5, the computation time varies from 1.3 to 1.7 seconds, according to area parameter ε. For the same image with the noise of Figure 5, whose topographic map is abnormally complex, these computations times vary from 1.7 to 2.2 seconds. This
grain.tex; 19/11/2001; 9:16; p.37
38
V. Caselles and P. Monasse
Figure 5. Noise removal and topographic map preservation by the grain filter. Top-left: Original image (350 × 300). Top-right: Impulse noise of frequency 20%. Bottom row: grain filter G40 applied to these images.
shows that reasonable times can be reached on rather weak processor speeds with respect to current standards. Acknowledgements We acknowledge partial support by the TMR European project “Viscosity solutions and their applications”, reference FMRX-CT98-0234 and the CNRS through a PICS project. The first author acknowledges partial support by the PNPGC project, reference BFM2000-0962-C0201.
grain.tex; 19/11/2001; 9:16; p.38
39 References 1. 2. 3. 4. 5. 6. 7. 8. 9. 10. 11. 12. 13. 14. 15. 16. 17. 18. 19. 20.
Alvarez, L., F. Guichard, P. Lions, and J. Morel: 1993, ‘Axioms and Fundamental Equations of Image Processing: Multiscale Analysis and P.D.E.’. Archive for Rational Mechanics and Analysis 16(9), 200–257. Ambrosio, L., V. Caselles, S. Masnou, and J. Morel: 1999, ‘The Connected Components of Sets of Finite Perimeter and Applications to Image Processing’. submitted to the Journal of the European Mathematical Society. Ballester, C., V. Caselles, and P. Monasse: 2001, ‘The Tree of Shapes of an Image’. Preprint CMLA. Caselles, V., B. Coll, and J. Morel: 1996, ‘A Kanisza program’. Progress in Nonlinear Differential Equations and their Applications 25. Caselles, V., B. Coll, and J. Morel: 1997, ‘Is Scale-Space Possible?’. In: Proc. of the 1st Workshop on Scale-Space Theories in Computer Vision. Utrecht, the Netherlands. Froment, J.: 1999, ‘A Compact and Multiscale Image Model Based on Level Sets’. In: Proc. of the 2nd Workshop on Scale-Space Theories in Computer Vision. Corfu, Greece, pp. 152–163. Guichard, F. and J. Morel: 2000, ‘Image Iterative Smoothing and P.D.E.’s’. Book in preparation. Heijmans, H.: 1999., ‘Connected Morphological Operators for Binary Images’. Preprint. Lantujoul, C. and S. Beucher: 1981, ‘On the Use of Geodesic Metric in Image Analysis’. Journal of Microscopy 121, 39–49. Lantujoul, C. and F. Maisonneuve: 1984, ‘Geodesic Methods in Image Analysis’. Pattern Recognition 17, 117–187. Maragos, P. and R. Schafer: 1987a, ‘Morphological Filters. Part I: Their SetTheoretic Analysis and Relations to Linear Shift-Invariant Filters’. IEEE Transactions on Acoustics, Speech and Signal Processing 35, 1153–1169. Maragos, P. and R. Schafer: 1987b, ‘Morphological Filters. Part II: Their Relations to Median, Order-Statistic, and Stack Filters’. IEEE Transactions on Acoustics, Speech and Signal Processing 35, 1170–1184. Masnou, S.: 1998, ‘Image Restoration Involving Connectedness’. In: Proceedings of the 6th International Workshop on Digital Image Processing and Computer Graphics, Vol. 3346. Vienna, Austria. Matheron, G.: 1975, Random Sets and Integral Geometry. N.Y.: John Wiley. Meyer, F.: 1998a, Mathematical Morphology and Its Application to Signal and Image Processing, Chapt. From Connected Operators to Levelings. Kluwer Academic Publishers, h. heijmans and j. roerdink edition. Meyer, F.: 1998b, Mathematical Morphology and Its Application to Signal and Image Processing, Chapt. The Levelings. Kluwer Academic Publishers, H. Heijmans and J. Roerdink edition. Meyer, F. and S. Beucher: 1990, ‘Morphological Segmentation’. Journal of Visual Communication and Image Representation 1(1), 21–46. Moisan, L.: 1998, ‘Affine Plane Curve Evolution: A Fully Consistent Scheme’. IEEE Transactions on Image Processing 7(3), 411–420. Monasse, P. and F. Guichard: 2000a, ‘Fast Computation of a Contrast-Invariant Image Representation’. IEEE Transactions on Image Processing 9(5), 860–872. Monasse, P. and F. Guichard: 2000b, ‘Scale-Space from a Level Lines Tree’. Journal of Visual Communication and Image Representation 11, 224–236.
grain.tex; 19/11/2001; 9:16; p.39
40 21. 22. 23. 24. 25. 26. 27. 28. 29. 30. 31.
32.
33.
V. Caselles and P. Monasse
Salembier, P.: 1994, ‘Morphological multiscale segmentation for image coding’. Signal Processing 38(3), 359–386. Salembier, P., P. Brigger, J. Casas, and M. Pardas: 1996a, ‘Morphological Operators for Image and Video Compression’. IEEE Transactions on Image Processing 5(6), 881–898. Salembier, P., F. Meyer, P. Brigger, and L. Bouchard: 1996b, ‘Morphological Operators for Very Low Bit Rate Video Coding’. In: Proceedings of International Conference of Image Processing. p. 19P1. Salembier, P., A. Oliveras, and L. Garrido: 1998, ‘Antiextensive Connected Operators for Image And Sequence Processing’. IEEE Transactions on Image Processing 7(4), 555–570. Salembier, P. and J. Serra: 1995, ‘Flat Zones Filtering, Connected Operators and Filters by Reconstruction’. IEEE Transactions on Image Processing 4, 1153–1160. Sapiro, G. and A. Tannenbaum: 1993, ‘Affine Invariant Scale-Space’. International Journal of Computer Vision 11(1), 25–44. Serra, J.: 1982, Image Analysis and Mathematical Morphology. New York: Academic Press. Serra, J.: 1986, ‘Introduction to Mathematical Morphology’. Computer Vision, Graphics and Image Processing 35(3), 283–305. ´ Serra, J.: 1999, ‘Connections for sets and functions’. Preprint, Ecole des Mines de Paris, Centre de Morphologie Math´ematique, Fontainebleau, France. Serra, J. and P. Salembier: 1993, ‘Connected Operators and Pyramids’. In: Proceedings of SPIE Conference on Image Algebra and Mathematical Morphology, Vol. 2030. San Diego, California, pp. 65–76. Vincent, L.: 1993, ‘Grayscale Area Openings and Closings, Their Efficient Implementation and Applications’. In: J. Serra and P. Salembrier (eds.): Proceedings of the 1st Workshop on Mathematical Morphology and its Applications to Signal Processing. Barcelona, Spain, pp. 22–27. Vincent, L.: 1994, ‘Morphological Area Openings and Closings for Grey-scale Images’. In: Proceedings of the Workshop Shape in Picture: Mathematical Description of Shape in Gray-Level Images. Driebergen, The Netherlands, pp. 197–208. Vincent, L. and P. Soille: 1991, ‘Watersheds in Digital Spaces: An Efficient Algorithm Based on Immersion Simulations’. IEEE Transactions on Pattern Analysis and Machine Intelligence 13(6), 583–598.
grain.tex; 19/11/2001; 9:16; p.40