Robust comparison of binary images

7
ELSEVIER Pattern RecognitionLetters 18 (1997) 1057-1063 Pattern Recognition Letters Robust comparison of binary images 1 Jos6 Paumard 2 CMLA, Ecole Normale Sup£rieure de Cachan, 6I avenue du Prdsident Wilson, 94235 Cachan Cedex, France Received 12 January 1997; revised 5 September 1997 Abstract The Hausdorff distance between planar sets of points is known to be a good method to compare binary images. We present here a modification of this distance, called the censored Hausdorff distance. It allows robust comparisons of noisy binary images. The definition of the Voronoi surfaces is extended to this new distance, as well as the definition of the inclusion field. We then show that it is possible to localize a small binary pattern in an image. © 1997 Elsevier Science B.V. Keywords: Binary image comparison; Hausdorff distance 1. Introduction It is well known that the edges of an image play a key-role in the recognition process. Numerous meth- ods have been proposed to compare these edge im- ages. Among them is the Hausdorff distance, suc- cessfully used to recognize and localize binary pat- terns in images (Borgefors, 1984; Hnttenlocher et al., 1993). This distance is defined between planar sets of points. It can be computed very quickly, but suffers from a serious lack of robustness, making it hard to use in real object recognition applications. Some modifications have been proposed in (Dubuis- son and Jain, 1994; Huttenlocher et al., 1993; Oh-Kyu Kwon Kwon et al., 1996), mainly based on a robust estimation of h(A,B) (see Eq. (2)). We propose here a new modification, called the censored Hansdorff distance. This paper is divided into three parts. Firstly, we give the definition, some properties and references to fast algorithms usually used to compute the classical Hausdorff distance. Then we explain why, with such a definition, this distance is not robust. In the second part, we describe the modification we propose. We call it the censored Hausdorff distance (CHD). In a third part, we study very carefully the robustness of this distance, and show that it is very well suited for pattern recognition applications, and localization of binary patterns in edge images. 2. The classical Hausdorff distance 1This work has also been supported by CEA-DAM/BIII/L, 91680 Bruy~res-le-Chatel Cedex, FRANCE and CISI, 3 rue Le Corbusier, SILIC 232, 94528 Rungis Cedex, France. 2 Email: [email protected]. The application of the Hausdorff distance to the comparison of binary images has been presented in (Huttenlocher et al., 1993). The definition of this 0167-8655/97/$17.00 © 1997 Elsevier Science B.V. All rights reserved. PII S0167-8655(97)00130-X

Transcript of Robust comparison of binary images

ELSEVIER Pattern Recognition Letters 18 (1997) 1057-1063

Pattern Recognition Letters

Robust comparison of binary images 1

Jos6 P a u m a r d 2

CMLA, Ecole Normale Sup£rieure de Cachan, 6I avenue du Prdsident Wilson, 94235 Cachan Cedex, France

Received 12 January 1997; revised 5 September 1997

Abstract

The Hausdorff distance between planar sets of points is known to be a good method to compare binary images. We present here a modification of this distance, called the censored Hausdorff distance. It allows robust comparisons of noisy binary images. The definition of the Voronoi surfaces is extended to this new distance, as well as the definition of the inclusion field. We then show that it is possible to localize a small binary pattern in an image. © 1997 Elsevier Science B.V.

Keywords: Binary image comparison; Hausdorff distance

1. Introduction

It is well known that the edges of an image play a key-role in the recognition process. Numerous meth- ods have been proposed to compare these edge im- ages. Among them is the Hausdorff distance, suc- cessfully used to recognize and localize binary pat- terns in images (Borgefors, 1984; Hnttenlocher et al., 1993). This distance is defined between planar sets of points. It can be computed very quickly, but suffers from a serious lack of robustness, making it hard to use in real object recognition applications. Some modifications have been proposed in (Dubuis- son and Jain, 1994; Huttenlocher et al., 1993; Oh-Kyu Kwon Kwon et al., 1996), mainly based on a robust estimation of h ( A , B ) (see Eq. (2)). We propose here

a new modification, called the censored Hansdorff distance.

This paper is divided into three parts. Firstly, we give the definition, some properties and references to fast algorithms usually used to compute the classical Hausdorff distance. Then we explain why, with such a definition, this distance is not robust. In the second part, we describe the modification we propose. We call it the censored Hausdorff distance (CHD). In a third part, we study very carefully the robustness of this distance, and show that it is very well suited for pattern recognition applications, and localization of binary patterns in edge images.

2. The classical Hausdorff distance

1 This work has also been supported by CEA-DAM/BIII/L, 91680 Bruy~res-le-Chatel Cedex, FRANCE and CISI, 3 rue Le Corbusier, SILIC 232, 94528 Rungis Cedex, France.

2 Email: [email protected].

The application of the Hausdorff distance to the comparison of binary images has been presented in (Huttenlocher et al., 1993). The definition of this

0167-8655/97/$17.00 © 1997 Elsevier Science B.V. All rights reserved. PII S0167-8655(97)00130-X

1058 Z Paumard/Pattern Recognition Letters 18 (1997) 1057-1063

distance is given here, and the reasons of its lack of robustness are analysed. We also present the algo- rithm used to compute it.

2.1. Definition, properties

Let A and B be two sets of points of 772. Let d be a distance over the plane. We can, for example, use the 1-norm (see definition in Appendix A). The Hausdorff distance H( A,B) between A and B is defined by:

Va~A, D(a,B)=minb~B{d(a ,b)} , (1)

h(A,B) = max a ~ A{ D( a,b)}, (2)

H(A,B) = max{h( A,B) ,h (B ,A)} . (3)

One can show that H is a true distance: it has the properties of identity, symmetry and triangle inequal- ity.

If h(A,B) = R, then each point of A has at least one point of B in a neighbourhood of radius R. If R is small, we can conclude that A is nearly included in B. This is the reason why h(A,B) is called the measure of inclusion of A in B. There is a fast algorithm to compute the Hausdorff distance be- tween two sets, based on the use of the Distance Transform (Borgefors, 1988; Huttenlocher et al., 1993).

2.2. Voronoi surfaces and distance transform

The Voronoi surface of an image has been studied in (Borgefors, 1986) and (Huttenlocher et al., 1993). Let V(B) be the Voronoi surface of B. V(B) is a distance map, with the following property:

V m ~ Z 2, V( B)( m) = D( m,B). (4)

Thus, V(B)(m) is the distance between a given point of the plane and its closest neighbour in B. Then, h(A,B) is computed by reading the values of V(B) along the points of A, and by selecting the greatest value of D e --- {V(B)(a) I a ~ A}. This sur- face can be computed very quickly using the Dis- tance Transform. Fast sequential and parallel algo- rithms are given in (Borgefors, 1986). An example of a Voronoi surface is shown in Fig. 4.

This distance seems very attractive: it is fast and simple to compute, and, as it relies on edges, the

h(A, B) = :4(~, B)]

,A)

If'' A B

Fig. 1. In this example, due to the presence of the noisy point a, the resemblance between A and B is not detected.

observed values are consistent with the dissimilari- ties of the objects we compare. But its lack of robustness prevents us from using it in real object recognition application.

2.3. Robustness of the Hausdorff distance

In the example of Fig. 1, we see that, for the noisy point a, D(a,B) is much greater than for the other points of A. Taking the greater values of D 8 gives us an irrelevant value of h(A,B), which hides the great resemblance between A and B. Some modifications to the Hausdorff distance have been proposed to deal with this problem (Dubuisson and Jain, 1994; Huttenlocher et al., 1993; Oh-Kyu Kwon Kwon et al., 1996). These modifications are based

D(a, 13)

"'°'°" b

b'

h(A, B) "b

A B Fig. 2. False recognition due to a small value of h(A,B). This error is due to the irrelevant points b, b' et b", detected in B.

J. Paumard/Pattern Recognition Letters 18 (1997) 1057-1063 1059

• • • " ° ~ 1 •" "

A B C

Fig. 3. Three edge images of size 128 × 128 pixels. B has been obtained by adding randomly black and white dots on A.

on robust estimations of h(A,B). Instead of taking the greatest value of D e , one can take the median, average or the greatest value of a subset of D e, obtained by taking out a certain amount of the greatest values of D B.

These modifications do not handle the second example we propose. In Fig. 2, for all a ~ A, the values of D(a,B) are forced to a small value by the noisy points of B. h(A,B) is then too small. This small value leads us to the conclusion that A is nearly included in B, which is not the case.

The modification we propose now has been de- signed to deal with this kind of problem.

3. The censored Hausdorff distance

In this section, we propose a new modification of the Hausdorff distance, based on the robust estima- tion of both D(a,B), a ~ A and h(A,B). We will show on two examples the robustness given by this modification. We also propose a generalization of the definition of the Voronoi surfaces, to follow the modifications of the Hausdorff distance.

3.1. Definition

The definition of the censored Hausdorff distance has been introduced in (Azencott et al., 1996a,b), and studied in (Paumard, 1996). The basic concept is to build a simple robust estimator of D(a,B), a ~ A. This estimation is computed by censoring the closest neighbours of a ~ A in B. We do not take into account the p closest neighbours of a in B, and compute D(a,B) with the (p + 1)th closest neigh- bour of a in B.

In the following, we call ]XI the cardinal of the set X and E(x) the integer part of a real x. Let us consider X = {x 1 . . . . . x N} where x i c ~ and x i __< xz+ 1. For all a ~ [0,1], we call N~ = E (a × [X]). We define Q,( X) = XN;

We can now define the censored Hausdorff dis- tance by:

D~( a,B) = Q~{ d( a,b),b ~ B}, (5)

h. ,~(A,B) = QI_t~{D~(a,B),a cA}, (6)

H,~,f~( A,B) =max(h.,f~( A,B),h~,t3(B,A)). (7)

Typical values are ~ = 1% and/3 = 10%. Now, if h.,/~(A,B) = R, then 90% of the points of A have

Table 1 Values of both the classical Hausdorff distance and the CHD between the edge images of Fig. 3. These values are computed with the 1 -norm

H(X,Y) A B C H~ ~(X Y) A B C

A 0 30 49 A 6 9 26 B 30 0 68 B 9 8 25 C 49 68 0 C 26 25 5

1060 J. Paumard / Pattern Recognition Letters 18 (1997) 1057-1063

IABCl P

s v(s) I(s) Fig. 4. P is a binary pattern we want to localize in S. V(S) is the classical Voronoi surface of S, and I(S) the inclusion field of P in S. We notice the minimum of I(S) where P is localized.

1% of the points of B in a neighbourhood of radius less or equal than R. This prevents irrelevant points of A or B from altering the measure.

Let us consider the example in Fig. 3. The edge image B has been obtained by adding randomly black and white dots on A, so h(B, A) 4: O. We have first adjusted the centroid of each of these images on

the origin of the plane. Then, we have computed the value of both the classical Hausdorff distance and the CHD between these three images. The results are given in Table 1. With the classical Hausdorff dis- tance, it is impossible to conclude that A resembles B and that both of them are different from C. If we consider now the values given by the CHD, we notice that the distance between A and B is nearly the same as the self-distance of B. That means that

we cannot tell B from A. On the contrary, both A

and B are far away from C. Then, we can conclude that A and B are very similar, and distinct from C.

3.2. Properties

The CHD does not have the property of identity, nor triangle inequality. Counter-example are given in (Paumard, 1996). The consequences of this could be very serious. Fortunately, we can show that

H~,¢( A ,B) <_H~,o( A ,P ) + Ho~,o( P ,B )

+ min(H=,o ( A, A),H~,o(B,B)) . (s)

This proves that two images A and B that resemble

P

i

ABC

s' v(s') I(P) Fig. 5. P is the same binary pattern as in Fig. 4, and we have added four black dots and four white dots on S to get S'. The classical Voronoi surface V(S') is altered, and the minima of the inclusion field do not allow the correct localization of P in S.

J. Paumard / Pattern Recognition Letters 18 (1997) 1057-1063 1061

P

ABC I s ' (s ') (p)

Fig. 6. P and S' are the same pattern and scene as in Fig. 5. VI(S) is the censored Voronoi surface of S, obtained by censoring the closest neighbour of each point. We can notice that the minima of the inclusion field computed with VI(S) allows us to correctly localize P in S r.

a third image C, look alike in a certain extent. The proof of this result is given in Appendix B.

3.3. Censored Voronoi surfaces

Let p = N~ be an integer, and Dp = D~. We can now define the censored Voronoi surfaces:

V m ~ 7 7 2, Vp(B) (m)=Dp(m,B) . (9)

Thus, Vp(B)(m) is the distance between m and its ( p + 1)th closest neighbour in B. To compute the censored measure of inclusion of A in B, we first build the set Dp.B( A)= {Dp(a,B) ] a cA} by read- ing Vp(B) along the points of A. This process depends only on [A]. Then, by censoring the q greatest values of this set, we can compute hp,q(A,B).

Figs. 4 - 6 show three examples of Voronoi sur- faces. In Fig. 4 the classical Voronoi surface of an original binary image is shown. We have added a small amount (four of each) black and white dots on this binary image, and computed both its classical Voronoi surface (shown in Fig. 5) and its censored Voronoi surface (shown in Fig. 6). The presence of the noisy points is clearly visible when the surface is computed with no censor. On the censored surface, the noisy points do not affect the surface any more. But we can see that the borders of the " C " are not as precise as in the other case. The robustness we gained by censoring the closest neighbour leads to a little loss of precision.

V(B) is usually computed by the use of the Distance Transform (Borgefors, 1984, 1986, 1988). Unfortunately this two-pass algorithm cannot be use to compute the censored Voronoi surfaces. A fast algorithm has been described in (Paumard, 1996). Both sequentiel and parallel versions of this algo- rithm are given there, showing that a censored Voronoi surface of size 256 × 256 can be computed in 2ms on SYMPHONIE, a SIMD ring of 256 processors developed by CEA/LETL

3.4. Inclusion field

Let h(A(m),B) be the measure of inclusion of a binary pattern A centered on a given point m of a binary image B. The inclusion field of A in B is a map with the following property:

VmET/2 , I ( A ) ( m ) = h ( A ( m ) , B ) . (10)

This inclusion field can be used to solve the problem of the localization of a binary pattern in an image: the minima of this field are the points where A is likely to be found in B. In the examples of Figs. 4-6, we can see that the inclusion field computed with the classical Voronoi surface is correct in the non-noisy case. We can see that, due to the censor- ing, the global minimum that was lost because of the presence of noisy points (Fig. 5), is recovered at the fight place in Fig. 6. This is a first clue of the robustness of our method.

1062 J. Paumard / Pattern Recognition Letters 18 (1997) 1057-1063

4. Conclusion

We have presented in this paper a new new edge matching method, based on a modified Hausdorff distance, called the censored Hausdorff distance. This new distance has proven to be fast to compute, and its robustness has been showed on two examples, covering two different types of applications. Its ro- bustness against non-linear luminance changes, its consistency with the matchings a human operator would have made has been shown in (Paumard, 1996). The possibility to recognize and localize buildings in large aerial scenes using a multiscale approach, has proven to be fast in (Azencott et al., 1996a,b). Real-time has been reached on SYM- PHONIE, a SIMD ring of 256 processors, developed by the CEA/LETI. The adjusting of astronomical images is presented in (Paumard and Auborg, 1998).

Acknowledgements

The author would like to thank Professor Robert Azencott for valuable advice and discussions during this work.

Appendix A. Definition of the 1-norm

The 1-norm between two points Mo(xo,y o) and Ml(Xl,y 1) of the plane is defined by:

d(Mo,Ml) = Ix0 - x l l + [Yo -yll.

So, as A, B and C form a triangle, are permutable, and as H and H a are symmetric:

H( A,C) + H~( B,C) >_H~( A,B), (B.3)

H~( A,C) + H( B,C) >_H~( A,B). (B.4)

We can then substitute C with B in Eq. (B.3) and C with A in Eq. (B.4):

H( A,B) >_ H~( A,B) - H~( B,B), (B.5)

H(A,B) >_H=(A,B) -H~(A,A). (B.6)

So:

H(A,B) > H,~(A,B)

-min(H~(A,A),H,~(B,B)). (B.7)

For all A and B:

H~,~( A,B) <_H~( A,B), (B.8)

H~,¢( A,B) <_H( A,B)

+ min(Ho~ (A,A) ,Ha(B,B)). (B .9)

For all C, we have:

H(A,B) <_ Ha(A,C) + H,~(C,B). (B.10)

Then:

H~.~( A,B) <_Hc~( A,C ) + H~(C,B)

+ ,lain(Ha, ~ ( A, A), H a,¢ (B,B)). (B.11)

References

Appendix B. Proofs of Eq. (8)

In the following, H a = H~. 0. Let us show:

H~,~( A,B) <_H~( A,C) + H~(C,B)

+ min(H,~ ( a , a ) ,H~(B,B)).

We know that:

Ha(A,B) > H(A,B), (B.1)

H~( A,B) + H~( B,C) > H( A,C). (B.2)

Azencott, R., Durbin, F., Paumard, J., 1996. Multiscale identifica- tion of buildings in compressed aerial scenes. In: Proc. 13th Intemat. Conf. on Pattern Recognition, Vienna, p. C-974.

Azencott, R., Dinbin, F., Paumard, J., 1996. Robust recognition of buildings in compressed aerial scenes. In: Proc. Internat. Conf. on Image Processing, Lausanne.

Borgefors, G., 1984. An improved version of the chamfer match- ing algorithm. In: Proc. 7th Internat. Conf. on Pattern Recogni- tion, Montreal.

Borgefors, G., 1986. Distance transformations in digital images. Comput. Vision Graphics Image Process, 34 (86).

Borgefors, G,, 1988. Hierarchical chamfer matching: a parametric edge matching algorithm. IEEE Trans. Pattern Anal. Machine ][ntell. 10 (6).

J. Paumard/Pattern Recognition Letters 18 (1997) 1057-1063 1063

Dubuisson, M.-P., Jain, A.-K., 1994. A modified Hausdorff dis- tance for object matching. In: Proc. Internat. Conf. on Pattern recognition, Jerusalem.

Huttenlocher, D.P., Klanderman, G.A., William J, R., 1993. Com- paring images using the Hausdorff distance. 1EEE Trans. Pattern Anal. Machine Intell. 15 (9).

Oh-Kyu Kwon Kwon, Dong-Gyn Sim, Rae-Hong Park, 1996. New Hausdorff distances based on robust statistics for com-

paring images. In: Proc. Internat. Conf. on Image Processing, Lausanne.

Paumard, J., 1996. Reconnaissance multi6chelle d'objets clans des sc~nes. Ph.D. Thesis. Ecole Normale Sup6rienre de Cachan (in French).

Paumard, J., Aubourg, E., 1998. Adjusting astronomical images using a censored Hausdorff distance. In: Proc. Internat. Conf. on Image Processing, Santa Barbara.