background image

(α)

(β)

Σχήμα 3.5: Στο σχήμα (α) βλέπουμε ένα δισδιάστατο περιβάλλον που χωρίζεται στην μέση από ένα
τείχος εμποδίων. Στο (β) βλέπουμε πως ο αλγόριθμος εντοπίζει τις δύο μη συνδεδεμένες περιοχές.

Result: Connected Component Labeling
// First Pass
for

(each element of the data by row) do

for

(each element of the data by column) do

if

(the cell is not in the background) then

if

(the cell has neighboors) then

get the neighboring elements of the current element
find the neighbor with the smallest label and assign it to the

current element

store the equivalence between neighboring labels

if

(the cell does not have neighboors) then

uniquely label the current element and continue

end

end
// Second Pass
for

(each element of the data by row) do

for

(each element of the data by column) do

if

(the cell is not in the background) then

relabel the element with the lowest equivalent label

end

end

Αλγόριθμος 1: Αλγόριθμος εύρεσης συνδεδεμένων στοιχείων στο επίπεδο εδά-
ϕους.

3.5

Εύρεση ελάχιστης απόστασης μεταξύ μη συνδεδεμένων πε-

ριοχών στο τρισδιάστατο επίπεδο

Αϕού έχουν εντοπιστεί οι μη συνδεδεμένες περιοχές του περιβάλλοντος στο επί-

πεδο εδάϕους, είναι απαραίτητη η εύρεση του μονοπατιού που τις ενώνει με το

36