|
Algorithm 2
UpdateNeighbourhood
|
-
1:
ifthen ▹ Select based on whether A (previous B) is an object pixel
-
2:
▹ Next value of
-
3:
else
-
4:
▹ Next value of
-
5:
end if
-
6:
-
7:
▹ Look up position C in the row buffer
-
8:
ifthen ▹ An object pixel is coming into neighbourhood
-
9:
if
then ▹ It is the first object pixel after a background pixel
-
10:
▹ First lookup in merger table
-
11:
if
then ▹ Label was representative label
-
12:
-
13:
else
-
14:
▹ Second lookup in merger table to get representative label
-
15:
if
then ▹ Label change on second lookup indicates a chain
-
16:
▹ Update merger table to unlink the chain
-
17:
end if
-
18:
end if
-
19:
else ▹ Part of a run of consecutive pixels
-
20:
▹ Repeat latest label
-
21:
if
then ▹ Label has changed, indicating a chain of mergers
-
22:
▹ Update merger table to unlink the chain
-
23:
end if
-
24:
end if
-
25:
else
-
26:
▹ Lookup of background is unnecessary
-
27:
end if
|