Table 1: Code modifications for smoothing stray pixels
from the boundary.
Current BC Codes Modified MC Codes
(0, 7, 1) / (0, 1, 7) (0, 0)
(2, 3, 1) / (2, 1, 3) (2, 2)
(4, 5, 3) / (4, 3, 5) (4, 4)
(6, 5, 7) / (6, 7, 5) (6, 6)
(1, 2, 0) / (1, 0, 2) (1, 1)
(3, 4, 2) / (3, 2, 4) (3, 3)
(5, 6, 4) / (5, 4, 6) (5, 5)
(7, 0, 6) / (7, 6, 0) (7, 7)
(2, 0, 2) (2, 1)
(4, 6, 4) (4, 4)
(5, 3, 5) (5, 4)
(BC
i+n(n=1,2)
= BC
i−1
AND 6= BC
i
) then
BC
i
= BC
i+1
(or BC
i
= BC
i−1
).
– If (BC
i−n(n=1,2)
= BC
i+2
AND BC
i
6= BC
i+2
)
OR (BC
i+n(n=1,2)
= BC
i−2
AND BC
i
6= BC
i−2
)
then BC
i
= BC
i+2
(or BC
i
= BC
i−2
).
This step modifies all the spurious codes
on the curve and aligns the stray pixels
along the dominant slope of the line. For
example, after this step the false corner
area marked in Figure 2(b) will get smooth
along 45
◦
. The MC code after this step
=000000777776666665544444444333322222
1111, depicting the convex hull of the figure
smoothing all the small edges in the direction
of the dominant slope.
4.3 Avoid False Corners
Let for pixel position i, If MC
i
6= MC
i−1
, then
it is called the first occurrence of MC code.
If the first occurrence MC
i
= MC
i±n(n=1,2,...,l)
,
then the i
th
position is not a corner.
For our example, N(BoundaryLength) =
44; l = 2.56, and the MC code =
0000007777766666655444454443333222121211,
then its first occurrence MC code positions are
(1, 6, 11, 17, 19, 23, 24, 27, 31, 34, 35, 36, 37, 39). The
MC code at (35, 36, 37, 39, 40)
th
position already ex-
ists in previous or next codes within a neighborhood
of l = 2.56, and thus are positions of false corners
and not marked.
4.4 Find True Corners
The curvature of the curve is obtained by calculating
the first derivative of the MC code. The first deriva-
tive of the MC code, obtained by first difference of
the MC code, is a rotation-invariant boundary descrip-
tion. The curvature at current pixel i is δφ
i
= φ
i+1
−φ
i
,
which is calculated as
DC
i
= mod
8
(MC
i+1
− MC
i
+ 8) (3)
The first order difference code (DC) on the MC
codes represents this curvature or turning angle from
the previous point. If DC
i±l
= 0 it is an edge. Let
P
i
denotes the position of isolated non-zero DC
in a sequence of zero DC
0
s. If P
i
− P
i−1
≥ l (the
difference between consecutive positions of isolated
non zero DC’s). Then there are true corners at P
i
and P
i−1
positions. For our example, the MC code =
(0000007777766666655444454443333222121211),
its DC = (00000700007000007070001700700070071
7170)(DC code is calculated by treating the MC code
as a circular chain). The non-zero DC positions P
i
are (1, 6, 11, 17, 19, 23, 24, 27, 31, 34, 35, 36, 37, 39).
The difference between non zero DC positions
≥ l(= 2.57), at (1, 6, 11, 17, 19, 23, 24, 27, 31, 34)
th
positions hence they are identified as true corners as
shown in Figure 2(b).
5 TEST RESULTS
A corner detection algorithm must be tested on a va-
riety of shapes for its proper evaluation. Our test
images include most variety of variations in curva-
ture, corner sharpness and noise/irregularities along
the boundary curves. Such variations are expected in
real life images. Our corner detector gives single, lo-
calized and accurate response to corners. Compari-
son is also done with two popular algorithms namely
Harris (Harris and Stephens, 1988) and Yung (He and
Yung, 2004) with their default parameters. Table 2
and Figures 3, 4 and 5 shows the results. Both Harris
and Yung miss true corners on small curvature curves.
Our corner detector gives excellent results even in the
presence of noise like Gaussian, Poisson, and Speckle
etc., while both Harris (Harris and Stephens, 1988)
and Yung (He and Yung, 2004) are not invariant to
noise. They eliminate some true corners and also in-
troduce false corners due to noise. Noisy test images
are generated by adding Gaussian noise with 0 mean
and 0.01 variance as default values. Poisson noise is
generated from the image data following Poisson dis-
tribution. Salt-and-Pepper noise is generated with a
noise density of 0.02, and Speckle noise is a multi-
plicative uniformly distributed noise with 0 mean and
variance 0.04. Our algorithm is invariant to Gaussian,
Poisson and Speckle noise and extracts all true cor-
ners as shown in Figure 6. Though it generates some
GRAPP 2008 - International Conference on Computer Graphics Theory and Applications
130