Title: Raster to Vector Conversion
1 DEPARTMENT OF COMPUTER SCIENCE UNIVERSITY OF
JOENSUU JOENSUU, FINLAND
- Raster to Vector Conversion
2Raster-to-Vector conversion
Raster data
Vectorization
Vector data
Raster map 4400?4100
3History
? Digitizing with a tablet operator manually
traces all the lines from his hardcopy map
using a pointer device. Very slow
10-20 days for complex map Accuracy
40 DPI ? Heads-up digitizing operator traces
lines on the computer screen using the
scanned raster image as background.
Accuracy gt 200 DPI ? Interactrive tracing
automatic tracing an individual line under
the guidance of the operator ? (Semi?) Automatic
conversion
4Three steps of raster-to-vector conversion
x
5Scheme of raster-to-vector conversion
.
Binarization
Thinning
Vectorization (tracingapproximation)
Analysis Interpretation
61. Binarization with global threshold
.
a)
b)
71. Binarization with local threshold
Image
Global binarization
Locally adaptive binarization
81. Partition of input image into blocks
50x50
150x150
91. Locally adaptive thresholding
Input image
Binary image
Thr
Histogram
101. Block with a small object a
Input image
Binary image
Thr
Histogram
111. Block with a small object b
Input image
Binary image
Thr
Filtering
Histogram
121. Masking of image for histogram calc.
Input image
131. How to detect empty blocks?
Non-empty block
Thr
Empty block
Thr
If ? lt Thr block is empty
141. What to do with the empty blocks?
151. Local threshold for point (x,y)
Bilinear interpolation from 4 neigbouring blocks
162. Vectorization How to do?
1) Thinning-based methods 2) Contour-based
methods 3) Graph-structure based methods 4)
Orthogonal zig-zag methods
172. Thinning-based vectorization
skeletonization
Vectorization (tracing approximation)
182. Thinning by iterative shrinking
- black pel - black/white pel
- white pel
Thinning is an iterative shrinking process each
contour pixel is analysed. If certain criteria
are satisfied, that pixel is deleted. Pixels
removal continues until no changes.
Number of iterations width_max/2
192. Distance Transform-based algorithm 1 run
1st run Detect skeletal points
0 0 0 0 0 0 1 0 0 0 0 0 1 1 1 1 1 1 1 1 1 1 1 1
2 2 2 2 2 2 2 2 2 2 2 2 3 3 3 3 3 3 3 3 3 3 3
3 4 4 4 4 4 4 4 4 4 4 4 4 3 3 3 3 3 3 3 3 3 3 3
3 2 2 2 2 2 2 2 2 2 2 2 2 1 1 1 1 1 1 1 1 1 1 1
1 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0
0
3 3 3 4 4 4 3 3 3
- as local maximum
0 1 0 1 1 1 2 2 2
- to preserve connectivity
1 1 1 2 2 2 3 3 3
- What we can say about this pattern?
1 1 1 2 2 2 3 3 3
- The central point is supposed to be the
skeletal one.
202. DT-based skeletonization algorithm 1 run
1st run Detect skeletal points
0 0 0 0 0 0 1 0 0 0 0 0 1 1 1 1 1 1 1 1 1 1 1 1
2 2 2 2 2 2 2 2 2 2 2 2 3 3 3 3 3 3 3 3 3 3 3
3 4 4 4 4 4 4 4 4 4 4 4 4 3 3 3 3 3 3 3 3 3 3 3
3 2 2 2 2 2 2 2 2 2 2 2 2 1 1 1 1 1 1 1 1 1 1 1
1 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0
0
3 3 3 4 4 4 3 3 3
- as local maximum
0 1 0 1 1 1 2 2 2
- to preserve connectivity
1 1 1 2 2 2 3 3 3
- What we can say about this pattern?
1 1 1 2 2 2 3 3 3
- Central point is supposed to be the skeletal
one.
212. DT-based skeletonization algorithm 2 run
2nd run Restore connectivity
0 0 0 0 0 0 1 0 0 0 0 0 1 1 1 1 1 1 1 1 1 1 1 1
2 2 2 2 2 2 2 2 2 2 2 2 3 3 3 3 3 3 3 3 3 3 3
3 4 4 4 4 4 4 4 4 4 4 4 4 3 3 3 3 3 3 3 3 3 3 3
3 2 2 2 2 2 2 2 2 2 2 2 2 1 1 1 1 1 1 1 1 1 1 1
1 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0
0
3 3 3 2 2 2 1 1 1
4 4 4 3 3 3 2 2 2
222. DT-based skeletonization algorithm 2 run
2nd run Restore connectivity
0 0 0 0 0 0 1 0 0 0 0 0 1 1 1 1 1 1 1 1 1 1 1 1
2 2 2 2 2 2 2 2 2 2 2 2 3 3 3 3 3 3 3 3 3 3 3
3 4 4 4 4 4 4 4 4 4 4 4 4 3 3 3 3 3 3 3 3 3 3 3
3 2 2 2 2 2 2 2 2 2 2 2 2 1 1 1 1 1 1 1 1 1 1 1
1 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0
0
3 3 3 2 2 2 1 1 1
3 3 3 2 2 2 1 1 1
4 4 4 3 3 3 2 2 2
4 4 4 3 3 3 2 2 2
232. Distance Transform-based algorithm
1st run top-down, left right
2nd run bottom-up, right-left
Number of runs Iterative shrinking
width_max/2 DT-based skeletonization 2
242. DT skeleton for different metrics
a) b)
c) d)
a) Binary image (w9) Skeleton for the metrics
b) Chessboard c) Euclidean d) City-block.
253. Presentation of skeletal lines chain code
2
1
3
P
4
0
y1
7
5
6
x1
Chain code C01110111212111210707777767666666
Digitized curve P (x1,y1), (x2,y2),
(x3,y3),..., (xn,yn)
263. Tracing of skeletal lines with LUT
Ck1 LUTSCk
S 0000101012 2110 Ck1 LUT211 7 Ck1
LUT213 5
S 0000111002 2810 Ck1 LUT281 0 Ck1
LUT284 5
273. Start and End of digitized curve
Start of curve(s)
End
Crossroad
If (Start_of_curve) is detected, Start tracing
the curve. If (Crossroad or End_of_curve) is
detected, Stop the tracing.
283. Partition of the skeleton into digitized curves
294. Polygonal approximation of digitized curves
P1 (x1,1,y1,1),..., (x1,n,y1,n1) P2
(x2,1,y2,1),..., (x2,n,y2,n2)
PK (xK,1,yK,1),..., (xK,n,yK,nK)
Q1, Q2, , QK
304. How to control approximation?
?Error tolerance ? lt width/2
31Summary
1. Locally adaptive binarization 2. Thinning 3.
Tracing 4. Polygonal approximation (jatkuu)
32References
1 S.Ablameyko, T.Pridmore, Machine
interpretation of line drawing images,
Springer, 2000. 2 A.Kolesnikov, Efficient
algorithms for vectorization and polygonal
approximation, PhD Thesis, CS Dept, University of
Joensuu, 2003. (list of references)