Title: Chain and Crackcodes
1Chain and Crack-codes
21) Vectorization of digitized curves
Raster image
Digitized curves
Vector data
3Digitized curves
Digitized curve P(x1,y1), (x2,y2), , (xn,yn)
(10,11), (11,11), (12, 12),
48-directional chain (or Freeman) code
2
1
3
P
4
0
y1
7
5
6
x1
C01110111212111210707777767666666
Chain codes represent a digitized curve by a
connected sequence of straight-line segments of
specified length and direction Typically this
representation is based on a 4- or
8-connectivity The direction of each segment
is coded by numbers and the resulting chain code
is a sequence of numbers.
54-directional chain (or Freeman) code
1
0
2
3
8-directional chain code 076666553321212
4-directional chain code 0033333323221211101101
6Inner border of region on binary images
4-connected inner border
7Outer border of region on binary images
(See Sonka, Hlavac, and Boyle book)
8Inner or outer borders of adjacent regions on
color images?
Inner borders Outer borders
9Border of adjacent regions on color images?
10How many regions (objects)?
112) Vectorization of planar subdivision
Given raster image, construct vector
presentation of the planar subdivision (result
of raster image segmention).
12Raster data planar subdivision
Input image
One pixel
Fragment of the raster image
13Crack codes generation
1) Starting point (0.5, 2.5)
3 2 1 0
0
0
0
3
1
2
3
1
2
2
0 1 2 3 4
2) Crack codes for the shape 0 0 0 3 3 2 2 1 2 1
14Crack codes to vector data
x y 1) 0.5 2.5 2) 1.5 2.5 3) 2.5 2.5 4) 3.5 2.5
5) 3.5 1.5 6) 3.5 0.5 7) 2.5 0.5 8) 1.5 0.5 9) 1.5
1.5 10) 0.5 1.5 11) 0.5 2.5
3 2 1 0
0 1 2 3 4
Crack codes 0 0 0 3 3 2 2 1 2 1
15Border of adjacent regions
Inner borders Outer borders Border with
crack-codes
16Border of regions with holes
To preserve topological properties of the regions
with holes use counterclockwise order for
external border and clockwise order for internal
borders (holes).
17How many regions (objects)?How many holes?
18How many regions (objects)? How many holes?
R2, H0 R4 H1
R4 H1
1 2 4
4 4
19Digitized borders of regions
Raster image planar subdivision
Digitized borders of the regions
20Polygonal approximation of borders
Polygonal approximation of region borders
individually WRONG!
Polygonal approximation of borders from junction
point to junction point.
21Region border Example
22Region border