Digital Signal Processing Reference
In-Depth Information
1:
CombinedContourLabeling ( I )
I : binary image
11 Regionen in Binarbildern
Algorithmus 11.3
Kombinierte Konturfindung und
Regionenmarkierung. Die Prozedur
CombinedContourLabeling erzeugt
aus dem Binarbild I eine Menge von
Konturen sowie ein Array mit der Re-
gionenmarkierung aller Bildpunkte.
Wird ein neuer Konturpunkt (außere
oder innere Kontur) gefunden, dann
wird die eigentliche Kontur als Folge
von Konturpunkten durch den Aufruf
von TraceContour (Zeile 20 bzw.
Zeile 27) ermittelt. TraceContour
selbst ist in Alg. 11.4 beschrieben.
2:
Create an empty set of contours: C←{}
3:
Create a label map LM of the same size as I and initialize:
4:
for all ( u, v ) do
5:
LM ( u, v ) 0
label map LM
6:
R ← 0
region counter R
7:
Scan the image from left to right, top to bottom:
8:
for v ← 0 ...N− 1 do
9:
L c 0
current label L c
10:
for u ← 0 ...M− 1 do
11:
if I ( u, v )isa foreground pixel then
12:
if ( L c
=0) then
continue existing region
13:
LM ( u, v )
L
14:
else
15:
L c ← LM ( u, v )
16:
if ( L c =0) then
hit new outer contour
17:
R ← R +1
18:
L c ← R
19:
x S ( u, v )
20:
C outer TraceContour( x S , 0 ,L c ,I,LM )
21:
C←C∪{C outer }
collect new contour
22:
LM ( u, v ) ← L c
23:
else
I ( u, v ) is a background pixel
24:
if ( L =0) then
25:
if ( LM ( u, v )=0) then
hit new inner contour
26:
x S ( u− 1 ,v )
27:
C inner TraceContour( x S , 1 ,L c ,I,LM )
28:
C←C∪{C inner }
collect new contour
29:
L ← 0
30:
return ( C, LM ).
return the set of contours and the label map
Fortsetzung in Alg. 11.4
Zunachst wird das Bild I ( pixelMap ) und das zugehorige label
map LM ( labelMap ) an allen Randern um ein zusatzliches Pixel
vergroßert, wobei im Bild I diese Pixel als Hintergrund markiert
werden. Dies vereinfacht die Verfolgung der Konturen, da bei der
Behandlung der Rander nun keine besonderen Vorkehrungen mehr
notwendig sind.
Die gefundenen Konturen werden in einem Objekt der Klasse Con-
tourSet zusammengefasst, und zwar getrennt in außere und innere
Konturen. Diese sind wiederum Objekte der Klassen OuterContour
bzw. InnerContour mit der gemeinsamen Uberklasse Contour .Jede
Kontur besteht aus einer geordneten Folge von Koordinatenpunkten
der Klasse Node (Definition auf S. 199). Als dynamische Datenstruk-
tur fur die Koordinatenpunkte sowie fur die Menge der außeren und
Search WWH ::




Custom Search