Graphics Reference
In-Depth Information
Since for a closed contour there is a possibility of missing the first key pixel,
we need to examine a few more points after the starting point is reached to
enable us to get the same back.
Step 1: Set
i
1. Find the initial direction code between
P
i
and
P
i
+1
according to Freeman's chain code system. Let it be
d
1
.
Step 2: Increment
i
←
1,
count
←
i
+ 1; if i = n, go to step 7; otherwise, find the
directional code between
P
i
and
p
i
+1
;letitbe
d
2
.
Step 3: If
d
1
=
d
2
, go to step 2; otherwise, if
d
1
div
2=0and
d
2
div
2=0
or if
←
|
d
1
−
d
2
|
=3
or
5, then return (
x
i
,y
i
).
Step 4: Set
i
i
+ 1; if i = n, go to step 7; otherwise, find the direction
code between
P
i
and
P
i
+1
;letitbe
d
3
.
Step 5: If
d
3
=
d
2
, then count
←
←
count+1 and go to step 4; otherwise,
if
|
d
1
−
d
3
|
=0
or
1, then set count
←
1,
d
1
←
d
3
, and go to step 2
else do step 6.
Step 6: If count
div
2 =0, then return (
x
i− count/
2
,y
i− count/
2
); otherwise
return (
x
i− count div
2
,y
i− count div
2
).
Step 7: Stop.
1.5.2 Detection of Inflection Points
It is rather dicult to detect the points of inflection in a digital or discrete
contour (a string of pixels). Due to discretization of an analog curve or con-
tour, many inflection points (in the analytical sense) may be present, although
all of them may not be properly justified from the standpoint of discrete ge-
ometry in relation to discrete straight line [143, 32, 176]. It is possible to find
inflection points between two key pixels in a way somewhat similar to that
in the analytical plane. Detection of inflection points also helps in maintain-
ing the curvature of the contour during reconstruction and, as a result, the
reconstruction quality is improved.
P
3
/
P
P
/
1
/
P
P
2
/
2
P
= G (P )
i
i
P
1
Fig. 1.9.
Gaussian circle and its image detecting points of inflection.
Search WWH ::
Custom Search