Académique Documents
Professionnel Documents
Culture Documents
=
/
1
max
i
i
N
,]), and
when the difference between N
i
(1i)is slight,
1
,
2
are
approximately .
Theorem 2. Suppose that there are digital circles in an
image without any noise and rectangle. They consist of
N
1
,N
2
,, N
=
]), and when the difference
between N
i
(1i) is slight, then is 1/approximately.
Theorem 3. Suppose that the sum of number of noise
pixels and number of edge pixels on all rectangles istimes
greater than the sum of number of edge pixels on digital
circles in an image, then probability that 2 edge pixels (4 edge
pixels) sampled randomly lie on the same circle is
approximately 1/(1+)
2
times (1/(1+)
4
times) than that of no
noise and rectangle.
III. THE MULTI-CIRCLE DETECTION
As RHT and RCD detect multi-circle in an image, possible
circles are determined by sampling randomly so that many of
them are false. It is better solved by reducing number of points
sampled randomly and eliminating invalid sample in this paper.
A. Eliminating Two Kinds of Noises
Let A=[a
ij
]
HeighWidth
denote a matrix with Height row and
Width column, where Width and Height denote breadth and
height of an image, respectively, a
ij
is a pixel value corre-
sponding to a pixel in image (non-edge pixel: 0 , edge pixel:1).
Definition 2 Let P(x,y) be a edge pixel in an image, there
is no one edge pixel in its 33 neighborhood, then P is called
an isolated noise.
Definition 3 Let 44 neighborhood of a edge pixel P(x,y)
in an image satisfy: Boundary consists of 14 non- edge pixels
and except P(x,y) there are 1~3 edge pixels in it then P is
called a half-link noise.
By the analysis of digital image, the most noises belong to
the above two kinds. According to Theorem 3, removing all
isolated noises and half-link noises before detecting circle and
rectangle can reduce remarkably invalid sample.
B. The Basic Idea
According to theorem 1~2, 2 edge pixels P
1
(x
1
, y
1
) and
P
2
(x
2
, y
2
) are picked randomly in an image. IfP
1
P
2
T
d
(T
d
is a threshold), then we begin from midpoint M(x
m
,y
m
) of
line segment P
1
P
2
, and search a edge pixel P
3
(,) on perpen-
dicular bisector of line segment P
1
P
2
. Suppose that circles
dont intersect each other, and if P
1
and P
2
lies on the same
circle with center O(a,b) and radius r, then P
3
is certainly on
the O (see Fig3). According paper[7], 3 parameters of the
O can be written as:
2 2 2 2 2 2 2 2
2 1 2 1 1 1 1 2 1
2 1 1 1 2 1
( )( ) ( )( )
2(( )( ) ( )( ))
x x y y y x y y y
a
x x y x y y
+ +
=
(1)
2 2 2 2 2 2 2 2
1 1 2 1 2 1 2 1 3 1
2 1 1 1 2 1
( ))( ) ( ))( )
2(( )( ) ( )( ))
x y x x x x y y x x
b
x x y x y y
+ +
=
(2)
( ) ( )
2 2
1, 2, 3.
i i
r x a y b i = + = (3)
The above stated is only an ideal case. In general, the paper
makes following process according to Theorem 2~3.
C. Deceasing Invalid Sample Farthest
Theorem 2 shows that even if P
1
and P
2
are not noise
pixels, the invalid sample rate is much larger for multi-circle
detection. For example, the invalid sample rate goes up 9/10
possibly when =10. So, it is quite necessary to reduce invalid
sample most. The judge method is as follows: If there isnt
any edge pixel on the perpendicular bisector of line segment
P
1
P
2
, then P
1
and P
2
are invalid sample; or else, the slope a
1
of
fitting line y=a
0
+a
1
x can be figured out by the equation set
(4) obtained by least- squares line fitting with 9 edge pixels in
33 neighborhood of P
3
and element value corresponding to
them in matrix A. According to character of circle, if ka
1
(k
denotes slope of line segment P
1
P
2
), then P
1
,P
2
and P
3
arent
certainly on the same circle and belong to invalid sample(see
Fig.4). In programming the condition k=a
1
is replaced by |k-a
1
|
<T
k
(T
k
is a threshold) because of the digital circle.
1 1
0 1 1
1 1
1 1 1 1
2
0 1 2
1 1 1 1
9
y x
ij
i y j x
y y x x
ij i j
i y j x i y j x
a a j a u
a j a a j a u
+ +
= =
+ + + +
= = = =
+ =
+ =
+)
When k=a
1
and line segment P
1
P
2
and circle through P
3
lie on 2 sides of tangent respectively (see Fig.5), because the
line going through P
3
(,) and running parallel to line segment
P
1
P
2
can be written as y=+k(x-). Define:
s(P
i
,M)=[y
i
--k(x
i
-)][y
m
--k(x
m
-)] (5)
Then it can be known that P
i
and M both are on the same side
of line l: y=+k(x-) when s(P
i
,M)>0, on line l when s(P
i
,M)=
0, on 2 sides of line l when s(P
i
,M)<0. In 33 neighborhood of
P
3
, we figure out respectively
1
(the number of edge pixels on
the same side with M),
2
(the number of edge pixels on other
side of M),
0
(the number of edge pixels lying on the line) by
Eq.(5). If
0
+
1
-
2
<T
(T
is a threshold), then P
1
, P
2
and P
3
certainly are not on the same circle and are invalid sample.
D. Determining True Circle Fleetly
Fig. 3. ideal case to detect Fig. 4. the P1,P2 lies on O1 ,P3 on 2
P
1
P2
P
3
M
O
P1
P2
P3
O2
O1
10131
Fig.7. Tracking process of rectangle
(a)
(b)
(c)
(d)
(e)
A
F
C
D
B2
B
1
Q1
Q2
Q
1
Q1 Q2
Q2
Q3
C E
F
D
E
After working out centre O(a,b) and radius r of the
possible circleonly when statistic of the edge pixels on O
is conducted in the smaller area contained the circle, can the
detection speed be improved. The area D in the paper is the
difference of 2 square areas. Side-lengths of 2 square are
2(r+1) and 1.1r respectively. Their sides run paralleling with
the coordinate axes respectively, and their symmetry centre
both are the circle centre O(a,b).
( ) ( )
2 2
a b r + <T
(6)
Let T
y
max
(i=1,2,,m), the possible rectangle is determined by
G
r1
(x
min
,y
min
), G
r2
(x
min
,y
max
), G
r3
(x
max
,y
max
), G
r4
(x
max
,y
min
) (or G
t1
(x
min
,y
t1
), G
t2
(x
t2
,y
min
), G
r3
(x
max
, y
r3
),G
t4
(x
t4
, y
max
)). Where 1
ri,tim(see Fig. 9 (a),(b)). If each of the 4 sides of the possible
rectangle is a true line segment and the possible rectangle
satisfies the definition of rectangle, the possible rectangle is
Fig. 6. 8 directions of a pixel Fig.5. P
1
,P
2
is on O
1
and P
3
is on O
2
P
1
P
2
P
3
O
1
O
2
M
1
0
2
3 4
5
6
7
E E
E
Q
1
Q
2
Q
1
Q
2
Q
1
Q
2
Fig.8. The rectangle vertex om`ttd du to tuking.
(a) (b) (c)
(a) (b)
Gr3
Gr2
Gr1 Gr4
Gt2
Gt3
Gt4
Gt1
Fig. 9. Two case of the possible rectangle
10132
true. Left bottom vertex (x,y), length d, width w, slant angle
of rectangle R(x,y,d,w,) are finally calculated.
V. THE SIMPLE DATA STRUCTURE
In this approach, we initialize the matrix A with value 0 or
1 of HeightWidth pixels in an image, and the 2-D list V (set
V) with row and column value of all edge pixels in an image.
Once a possible circle or rectangle is affirmed for true, all
elements corresponded to the edge pixels on the circle or
rectangle are assigned 0 in matrix A, and elements in set V are
renewed by row and column value of the nonzero elements in
matrix A. Thus, the changing set A and V plays the role of
dynamic list in the process of detection. By using it we can
obtain fleetly the information of circle or rectangle in an
image and speed up detection.
VI. PSEUDO CODE OF THE APPROACH
From the above description, C/C++ pseudo code in the
approach can be written as following:
Initialization Given T
f
,N
c
,T
d
,T
k
,T
,T
,.set f=N=M
c
=0.
V= V-all the isolated noise and half-link noise;
do{
do { randomly sample P
1
,P
2
in V}while (|P
1
P
2
|T
d
);
calculate slope k and midpoint M(x
m
,y
m
) of P
1
P
2
;
P
3
(,) = M(x
m
,y
m
);
do {P
3
(,)=next pixel of P
3
(,) on digital perpendicular bisector of P
1
P
2
with the same direction ;
calculate a
1
of fitting line with Eq.(4);
if(|k-a
1
|>T
k
) continue ;
else { calculate
0
,
1
,
2
with Eq.(5);
if (
0
+
1
-
2
< T
, T
+
2
i
(i=,,2,1)
respectively, where
1
i
=
1
j
j
L
=
/
1
j
j
N
=
(
j
L denotes number of pixels
of rectangle j (j=1,2,, ));
2
i
is noise level. The meanings
of
V and D are the same as the above mentioned. In term of
Theorem 1~3 and procedure of RCD, RCD and our approach
samples ( )
4
1 2 1 2
1 /
1
i i
i i i
i
+ +
=
and ( )
2
1
1 /
1
i
i
i
+
=
times respectively.
Since
i
1
,
i
2
(i=1,2,, ) are related to , and
i
(i=1,
2,,) is related to reciprocal of , and
1
i
>
1
1
,
2
i
>
2
1
(i=1,
2,,), the average number of the sample times of RCD
increase sharply at the same order as O(
3
(1+
1
i
+
2
i
)
4
)
quantitative level. Average number of the sample times of our
approach increases at the same order as O((1+
1
i
)
2
)
quantitative level. Furthermore, invalid sample times in RCD
are more than those in our approach. When it affirms true
circle, RCD does more invalid computing meanwhile. The
whole detection time increases with exponential of and
1+
1
i
+
2
i