Discrete distance operator on rectangular grids D. Coquin *, Ph. Bolon Laboratoire d'Automatique et Microlnformatique lndustrielle, LAMI1/ CESALP, Universit~ de Savoie, BP 806, F. 74016 Annecy Cedex, France
Received 16 June 1994; revised 10 March 1995
Abstract
In this paper we present a new local distance transformation adapted to rectangular grids. This situation occurs with most industrial vision systems. Such operators allow Euclidean distance transform images to be approximated by using only local operations. These operators are optimized in the context of minimizing the maximum error over circular trajectories. The formulas of the coefficients as a function of the pixel width are given in the case of a 5 × 5 neighborhood. Experimental results and comparisons with other distance operators are then presented. Keywords: Distance transformation;Local distance; Chamferdistances; Rectangular grid
1. I n t r o d u c t i o n
In image analysis, measuring distances between objects is often essential. The notion of distance is very useful to compute granulometries, to describe a pattern in a digital image, and to estimate the distance between objects. Most industrial vision systems digitize images with sampling steps which are different, depending on whether they are in rows or columns. Hence images are digitized on a rectangular grid. The optimization of distance transform operators should be reconsidered in that context. Pseudo-Euclidean distance transformations on rectangular grids were studied by Bolon et al. (1992), using an optimization approach similar to (Borgefors, 1986). In this paper we consider the minimization of the error between the Euclidean distance d E and the local distance d E over circular trajectories (Verwer, 1991) rather than linear ones (Borgefors, 1986; Thiel and Montanvert, 1992). It should be noticed that vector distance transforms (Danielsson, 1980) can be adapted to the case of rectangular grids (Mullikin, 1992). However, this technique requires more memory space. There is a trade-off between accuracy and computation time. Moreover, the value of the maximum relative error depends on the arrangement of the feature pixels (Mullikin, 1992). In Section 2, formulas of optimal coefficients are presented in the case of a 5 × 5 neighborhood. In Section 3, the performances of the operator are studied. In Section 4, we compare the results obtained by this operator with those obtained by Borgefors, Thiel and Verwer in the case of a square grid.
D. Coquin,Ph.Bolon/ PatternRecognitionLetters16(1995)911-923
912
2. L o c a l d i s t a n c e o p e r a t o r o n r e c t a n g u l a r g r i d s
As shown in Fig. 1, the pixel size is characterized by its height H and its width L. Without loss of generality, we assume that H = 1 and L >/1. With local operators, global distances in the image are approximated by propagating local distances, i.e. distances between neighboring pixels. The distance transform image can be obtained with either a sequential or a parallel algorithm (Rosenfeld and Pfaltz, 1966, 1968). In this section we present the optimization of the coefficients of a 5 X 5 operator. Since pixels are rectangular, the operator is defined by 5 coefficients (see Fig. 1). The objective is to approximate the real Euclidean distance d E. The optimization criterion consists of minimizing the maximum error between the so-called local distance d L and the Euclidean distance d E. Unlike (Borgefors, 1986), we consider a circular trajectory rather than a linear one.
2.1. Coefficient optimization 2.1.1. Real coefficients Let pixel P be the origin of the digitized image. Let x and y be the coordinates in the image referential. Let pixel Q(x, y) describe a circle having radius R. The equation of the trajectory is (Lx) 2 + y2 = R 2. We assume that R is very large with respect to L, so that the displacement between two adjacent pixels can be regarded as continuous. Coefficients a-e must satisfy the following triangular inequality constraints: