Skip to main content
. 2020 Apr 3;20(7):2025. doi: 10.3390/s20072025
Algorithm 1 Cascading flood-fill
1: procedure GET_SEED(box,mask,ϵ) ▹ Seeds initial values.
2:  cx,cybox ▹ Get center for box.
3:  seed
4:  seedfind_closest_max(box,mask) ▹ Find closest max pixel within bounds.
5:  if seedseedvalueϵ then
6:   seedidboxid ▹ Set seed id to box id
7:   return seed ▹ Return seed if value greater than ϵ
8:  end if
9:  return ▹ No valid seed was found.
10: end procedure
11: procedure FILL_NEIGHBOURS(seed,θ) ▹ Recursively fill free neightbours with same or lower values.
12:  for each nseedneightbours do ▹ For every neighboring mask pixel.
13:   if nid=nvalueseedvaluenvalue>θ then
14:    nidseedid ▹ Set neighbor to same id as seed.
15:    FILL_NEIGHBOURS(n) ▹ Call recursively.
16:   end if
17:  end for
18: end procedure
19: bounding_boxessort_confidence(bounding_boxes) ▹ Sort bounding boxes by confidence.
20: for each boxbounding_boxes do ▹ For each bounding box b
21:  seedGET_SEED(box,ϵ)
22:  if seedthen
23:   FILL_NEIGHBOURS(seed,θ)
24:  end if
25: end for