IEEE TRANSACTIONS ON IMAGE PROCESSING, VOL. 5, NO. 3, MARCH 1996 541
A High-speed Algorithm for Elliptical Object Detection
Chun-Ta Ho and Ling-Hwei ChenAbstract- A high-speed method for elliptical object location is pro- posed. Through the use of the geometric symmetry, it first locates centers of elliptical objects and classifies the boundary points. Then, each point possible on an elliptical object boundary is used to obtain the remaining three parameters of the elliptical object. Since each boundary point is at most transformed to one point on the parameter space, the proposed method is very fast. Some experimental results are also given to show that the proposed method is better than some existing methods under the consideration of space and storage.
I. INTRODUCTION
Elliptical objects are frequently seen in real world; hence, the detection of elliptical shapes from a digital image is important in computer vision and industrial applications. The Hough transform [I] has long been recognized as a robust technique for detecting analytically defined curves in digital images, but directly applying it to detect ellipses requires a 5-D array for the accumulator. Moreover, a great deal of computing time is needed to transform a feature point in an input image into many points in the parameter space. Several modified versions of the Hough transform [2]-[6] have been proposed. They utilize a gradient to decompose parameter space, and this can reduce the parameter space dimension. However, it is hard to obtain the gradient accurately. To avoid this disadvantage, Yin and Chen [7] and Wu and Wang [8] utilized some geometric symmetry properties to extract elliptical objects. YidChen method is fast but still needs a 5-D array. The Wu/Wang method uses eight special symmetric points on an ellipse to find candidate elliptical centers rapidly. Hence, if some of these symmetric points on an ellipse do not exist, the ellipse will not be found.
In this paper, an efficient algorithm for locating an elliptical object is proposed. It uses a geometric symmetry to reduce the dimension of parameter space. In addition, through a point-to-point transform, the proposed method can greatly reduce the computing time.
11. PROPOSED METHOD
The proposed method consists of two phases: elliptical center location and parameter estimation. In Phase 1, a global geometric symmetry is first used to locate all possible centers ( 2 0 , yo) of elliptical objects in an image, and then, all boundary points are classified into several groups according to these center points. Ellipses with different centers will lie in different groups. In Phase 2, based on the above result, candidates for the remaining three parameters ( a , b , and 0) ( a is the the half length of the major axis, b is the the half length of the minor axis, and 8 is the orientation angle) of an ellipse in each group can be found quickly. Before describing these two phases in detail, we will first introduce some definitions and theorems.
Manuscript received March 18, 1994; revised March 2, 1995. This work was supported by the National Science Council of the Republic of China under Contract NSC-83-0408-E-009-037. The associate editor coordinating the review of this paper and approving it for publication was Prof. Rama Chellappa.
The authors are with the Department of Computer and Information Science, National Chiao Tung University, Hsinchu, Taiwan, R.O.C.
Publisher Item Identifier S 1057-7149(96)01788-5.
NE
NE
(b) Fig. 1.
Five classes of boundary points: (b) four-connected neighbors of point P. Illustration for the classification of boundary points on an object: (a)
Fig. 2. A is a boundary point of elliptical object E with center O ( 0 , 0 ) . H A
and VA are its horizontal and vertical buddy points, and A' i s t h e m m e t r i c point of A relative to 0. ] A H A / -~ = IA'HA~I and
lml
= IA'VA,~.A. Dejinitions and Theorems
Dejinition 1: Let O B be an object, P be a boundary point of
O B , U , D , L , and R be four-connected neighbors of P. The class of P is defined by the following rules (see Fig. 1):
Rule 1: If both L and U are not object points, P belongs to class
LU.
Rule 2: If both R and U are not object points, P belongs to class
R U .
Rule 3: If both L and D are not object points, P belongs to class
L D .
Rule 4: If both R and D are not object points, P belongs to class
R D .
Rule 5: If Rules 1 4 are not true, P belongs to class N E . Dejinition 2: Let A ( z a , y a ) be a boundary point. Its horizontal
buddypoint H A ( X I , ya) is defined to be the nearest boundary point to A if the following hold: a) A E LU or L D , if H A is on the right- hand side of A; b) A E RU or R D , where H A is on the left-hand side of A (see Fig. 2).
548 E E E TRANSACTIONS ON IMAGE PROCESSING, VOL. 5 , NO. 3, MARCH 1996
Fig. 3. Result of applying the proposed method to a real image: (a) Real image; (b) result of thresholding. (c) Result of applying the ellipitical centers location phase to (b). Five groups of boundary points corresponding to five candidate centers are obtained. (d) Final result of the proposed method superimposed on the original image with white line segments standing for the m a j o r h n o r axes of the extracted elliptical objects.
Definition 3: Let A(z,, y,) be a boundary point. Its vertical buddy point T/A(x=, y1) is defined to be the nearest boundary point to A if the following hold: a) A
E
LU or R U if VA is on the down direction of A; b) A E L D or R D if VA is on the up direction of A (see Fig. 2).DeJinition 4: Let A = ( z a , ya), B = (Xb, yb), and 0 = (XO, yo); then, we say that B is the symmetric point of A relative to 0 if 2,
+
xb z o = ~ 2 and Ya+
Y b 2 yo =-.Theorem 1: Let E be an elliptical object with center O(0, 0), and let A(x,, ya) be a boundary point of E; then, the symmetric point A' of A relative to 0 has coordinates (-xa, - y a ) and is also on the boundary of E .
Theorem 2: Let E be an elliptical object with center 0, A be a boundary point of E , and A' be the symmetric point of A relative to 0. Let H A and VA be the horizontal and vertical buddy points of A,
HA, and let
Va,
be the horizontal and vertical buddy points of A'. Then, ~ A H A ~ -= I A ' H A , ~ - and1
x
1
=IA'v,,l
(see Fig. 2).The proofs of the above theorems are easy and omitted here. Theorem 3: Let
E
be an elliptical object with center O ( 0 , 0) and orientation angle 0#
0, let A(za, y,) be a boundary point of E with za#
0 and ya#
0, H A ( z ~ , y,), and let VA(Z,, y1) be the two buddy points of A. Then, the three geometric parameters ( a , b, 8) of E can be determined by the coordinates of A, H A , and VA.Proof: The equation of the boundary of E with center (0, 0) can be expressed as
dz2
+
ezy+
f y 2 = 1, where df> 0.
(1) In addition, e#
0 if only if 6'#
0. Since A(x,, y,), H ~ ( z 1 , y,), and VA(Z,, y1) are three different boundary points of E , we havexa
#
X I , ( 2 )Ya
#
YI (3)(4) (5)
( 6 ) d(za)'
+
e(xa)(ya)+
f(y,)' = 1,d(m)'
+
e ( m ) ( y a )+
f(ya)' = 1,IEEE TRANSACTIONS ON IMAGE PROCESSING, VOL. 5, NO. 3, MARCH 1996 549
From (2)-(6), we can derive
Since za
#
0 and ya#
0, through (2), (3), and (7), we have that the determinant of the coefficient matrix of (4)-(6) is. (e1 - Za)(ZlYl - z a y a )
#
0. This means that we can get a unique solution (d, e, f ) from (4)-(6).After (d, e, f ) are obtained, the three geometric parameters ( a , b, 8 ) of E can be determined by the following formulas [9]:
tan-' d - f
2
O =
u = J 1
d
x
cos2 8+
ex
sin 0x
cos 0+
fx
sin' 8(8)
1
b = \ l f x c o s 2 8 - e x s i n 8 x c o s 8 + d x s i n 2 8 ' Theorem 4: Let E be an elliptical object with center O(0, 0), let
A ( z a , y a ) be a boundary point of E with za
#
0 and y a#
0, and let H A ( z ~ , ya) andV A ( Z , ,
y1) be the two buddy points of A . Then,the elliptical object has no orientation if only if H A is the symmetric point of VA relative to 0. That is, 8 = 0 if only if z1 = -za and
Y l = -ya.
The proof is easy and omitted.
Theorem 5: Let E be an elliptical object with center O ( 0 , 0) and 8 = 0, and let A ( z , , ya) be a boundary point of E . If leal
<
IyaI, take another boundary point A* = ( 2 1 , ea); otherwise, take A* = ( y a , y l ) . Then, the two geometric parameters ( a , b) ofE
can be obtained by the coordinates of A and A*.
Pro03 The equation of the boundary of elliptical object E with center (0, 0) and 6' = 0 can be expressed as
d z 2
+
f y 2 = 1, where df>
0. (9) If lzal<
A * ( z l , z,) into (9), we can get
by substituting the coordinates of A ( z , , y a ) and
de:+ fy: = 1, (10)
dz:+ fz: = 1. (11)
Since df
>
0, by reducing the above two equations, we have ( f / d ) ( z %-
y:) = (zz-
zs). Since lzal<
lyal and df>
0, we have z: - z:<
0. Furthermore, we can obtainThis means that we can get an unique solution (d, f ) from (10) and (11). After (d, f ) are obtained, the two geometric parameters ( a , b ) of E can be obtained by the following formulas:
U = &
b = 8 . (12)
In a similar way, we can also get ( a , b ) for leal
2
Iyal.B. Phase 1-Elliptical Centers Location
In this section, we will present the first phase of the proposed method, in which all possible centers of elliptical objects will be located. Let f be an input image. Before applying the proposed method, we first use a binary thresholding algorithm [lo] to convert
the input image
f
into a black and white image F . Black points on F are considered to be object points, and white points are back- ground. Then, Phase 1 is conducted. It consists of two procedures: symmetric pair finding and elliptical center locating and boundary point classifying. They are described as follows.Symmetric Pair Finding Procedure: Initialize a blank array G,
each cell includes a counter and a link; Scan the thresholded image F
For each boundary point
A(%,,
ya), check its class If A E N E or its two buddy pointsH A and VA can not be found No more process is done; Else
Take its two buddy points H A and VA,
and set w =
l n I ,
h =lmI;
G[h][w].counter=G[h] [w].counter+l;A ( z , , y a ) is added to the link list linked by G[h][w].link; Check each cell(h, w ) in G
If G[h][w].counter
2
2Any two entries on the link-list linked by G[h][w].link
are considered as a symmetric pair;
By Theorems 1 and 2, we know that if there exists an elliptical object E with center 0 in image F , through the above procedure, each boundary point A of E and its symmetric point A' relative to 0 must be considered to be a symmetric pair and be put
on
the same link list. Furthermore, we can see that the midpoint ofAA'
is 0. Based on this fact, we develop the following procedure to classify boundary points into several groups; those boundary points of elliptical objects with the same center will be put in the same group.Elliptical Center Locating and Boundary Point Classifying Proce- dure:
Initialize two blank arrays I and
I',
each cell includes a counter and a link;For each symmetric pair A(z,, ya) and A ' ( z , / , y a / )
Set ( 2 0 , YO) = K z a , y a )
+
(zar, ya/)1/2; If the two buddy points H A , andVA
of A are not symmetric relative to (eo, yo) /* for rotated ellipse */A tuple including A, H A , and VA is added to the link-list linked by I[ZO] [yo].link,
I[zO] [yo] .counter=I[zo] [yo] .counter+l ;
/* for un-rotated ellipse */ Find another boundary point A* according to the following rules;
Else
a) if Iza -
ZOI
<
Iya - yol, b) if Iza - 2012
Iya-
yol, A* = ( Z I , yo+
2, - 1 0 )A' = (zo
+
~a - YO, YI)A tuple including A and A* is added to the link-list linked by I' [ZO] [yo].link;
I' [ z o ] [yo].counter=I' [zo] [yo] .counter+l ; Applying a peak detecting algorithm to I[z] [y].counter and I' [z] [y] .counter;
Consider each extracted peak ( 2 0 , yo) to be a candidate elliptical center;
From the above procedure, we can see that if there exists an elliptical object E with center ( 2 0 , yo) and orientation 0
#
0 in550
I[zo][yo].counter, and I[z][y].counter will have a peak at ( 5 0 , yo). Thus, ( 2 0 , yo) will be considered to be a candidate elliptical center, and all boundary points of E will be put in the same link list linked by I[zo][yo].link. On the other hand, for an elliptical object with center ( 5 0 , yo) and 0 = 0, through Phase 1, we can find that each boundary point will contribute 1 to I’ [20] [yo] .counter, I’[z] [y].counter will have a peak at ( z o , yo), and all boundary points will be put in the same link list linked by I’[zo][yo].link.
C. Phase 2-Parameter Estimation
In Phase 2, based on the result of Phase 1 and Theorems 3-5, the remaining three parameters (a, b , 0) for each elliptical object will be found. Initially, it establishes an array AR(a, b , 0) with
AR(a, b , 6’) = 0 for each entry (a, b , 6’). Next, for each candidate elliptical center ( 5 0 , yo), each tuple ( A , H A , V A ) on the link list linked by I[z,][y/,].link (or ( A , A * ) on the link list linked by I’[zO][yO].link) is shifted (-20, -yo) to make the possible elliptical center be moved to (0, 0). Then, by substituting the coordinates of the shifted A, H A , and VA (or A and A*) into (1) (or (9)), a set of ( d , e , f ) (or (d, f ) ) is obtained. Through (8) (or (12)), one set (a, b , 6’) (or (a, b , 0)) can be obtained and considered to be a set of possible parameters for an elliptical object. The corresponding entry AR(n, b , 0) is increased by one. After all tuples linked to I[z,][y,].link and I’[zO] [yo].link are processed, a local peak-finding algorithm is finally applied to the array AR(a, b , 0), and each found peak is considered to be the parameters of a true elliptical object.
Note that if there exists an elliptical object E with parameters (ao, bo, 6’0, 2 0 , yo), through Theorems 3-5, each boundary point A of E should contribute one to AR(a0, bo, 6‘0). Hence, after Phase 2, the value of A R ( a 0 , bo, 6’0) must be large, and the elliptical object can be found through the local peak-finding algorithm.
111. EXPERIMENTAL RESULTS
This section will present an experimental result of applying the proposed method to a real image. Fig. 3(a) shows a real image including a cup and some cookies: one broken, two touching pairs. Fig. 3(b) is the thresholded result of Fig. 3(a). Through the elliptical center location phase, five candidate centers are extracted, and their corresponding boundary points are put in five different groups as shown in Fig. 3(c). Then, the parameter estimation phase is conducted for each group to find the remaining three parameters. Fig. 3(d) presents the final result superimposed on the original image with five sets of two orthogonal-cross line segments standing for the major and minor axes of the elliptical objects. From this figure, we can see that five elliptical objects are located successfully.
For the purpose of comparison, we also apply the TsujilMatsumoto, WulWang, and YinlChen methods to Fig. 3(a). By using a SUN SPARC-10 workstation, the results are shown in Table I. From this table, we can see that our method is faster than the others and needs an acceptable storage size.
IV. CONCLUSION
In this correspondence, we have proposed a two-phase fast method for locating elliptical objects. In Phase 1, the symmetry of elliptical objects is used to locate the centers of elliptical objects; this reduces two dimensions of elliptical parameters. According to these centers, all boundary points are classified into several groups, each of which is then treated separately. This could reduce greatly the time required to evaluate candidate parameters. In Phase 2, using the result of Phase 1, for each boundary point A, we only evaluate one set of parameters ( a , b , 0) of an elliptical object that possibly passes through A. Thus, the proposed method is faster than the existing
IEEE TRANSACTIONS ON IMAGE PROCESSING, VOL. 5 , NO. 3, MARCH 1996
TABLE I
RUNNING-TIME AND SPACE COMPLEXITY NEEDED BY EACH DETECTOR,
N
STANDING FOR THE NUMBER OF EACH PARAMETER QUANTIZED Methods Running-time (sec.) space complexityPropsedmethod 8 N 3
Tsuji/Matsumoto 15 N 2
w u “ g 23 N 2
Yin/Chen 23
N S
Hough-based algorithms. In addition, since the edge direction is not used, the estimation accuracy will not be lost. Furthermore, the proposed method is simple and easy to implement.
REFERENCES
P. V. C. Hough, “Method and means for recognizing complex pattern,” US Patent no. 3069654, 1962.
S . Tsuji and M. Matsumoto, “Detection of ellipses by a modified Hough transform,” IEEE Trans. Comput., vol. (2-27, pp. 777-781, 1978. D. H. Ballard, “Generalizing the Hough transform to detect arbitrary shapes,” Putt. Recog., vol. 13, pp. 111-122, 1981.
H. K. Yune, J. Illingworth, and J. Kittler, “Detection partially occluded ellipses using the Hough transform,” Image Vision Comput., vol. 7, pp. 31-37, 1989.
J. Illingworth and J. Kittler, “The adaptive Hough transform,’’ IEEE Trans. Pan. Anal. Machine Intell., vol. PAMI-10, pp. 690-698, 1987. K. K. Y, Raymond, K. S . T. Peter, and N. K. L. Dennis, “Modification of Hough transform for circles and ellipses detection using a 2-dimensional array,” Pan. Recog., vol. 25, pp. 1007-1022, 1992.
P. Y . Yin and L. H. Chen, “A new method for ellipses detection using
symmetry,” J. Electron. Imaging, vol. 3, pp. 20-29, 1994.
W. Y. Wu and M. J. Wang, “Elliptical object detection by using geometric properties,” Pun. Recogn., vol. 26, pp. 1499-1509, 1993. W. Wemick, Analytic Geometry. New York: Silver Burdett, 1968.
R. C. Gonzalez and P. Wintz, Digital Image Processing.
Addison Wesley, 1987.