Skip to content

Commit

Permalink
Add comments
Browse files Browse the repository at this point in the history
  • Loading branch information
kwinkunks committed Oct 10, 2023
1 parent be48e5a commit aef6893
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions gio/closure.py
Original file line number Diff line number Diff line change
Expand Up @@ -120,13 +120,18 @@ def find_closures(arr: ArrayLike,

# Capture all contours that are high enough.
for contour in contours:

y_, x = contour.T # y_ is row *from top* of array
contour = np.stack([x, y_, np.ones_like(x)*level]).T
p = Polygon(contour)

# Do various tests.
if p.area < min_area: continue
if not is_high(arr_, p): continue
if any([p.within(c) for c in all_contours]): continue
if (closure_height(arr_, contour) - level) < min_height: continue

# What's left is a good closure.
all_contours.append(p)

return all_contours

0 comments on commit aef6893

Please sign in to comment.