Skip to content

Commit

Permalink
fixed issue with isolated pixels in find_contours
Browse files Browse the repository at this point in the history
  • Loading branch information
simedw committed Sep 21, 2020
1 parent 9b66c6f commit a8a5e08
Show file tree
Hide file tree
Showing 4 changed files with 3,071 additions and 2,455 deletions.
7 changes: 7 additions & 0 deletions tests/test_find_contours.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,13 @@
from upolygon import draw_polygon, find_contours


def test_single_pixel():
mask = np.array([[0, 1, 0, 0, 0], [0, 0, 0, 0, 0], [0, 1, 0, 0, 0], [0, 0, 0, 0, 0]], dtype=np.uint8)
_labels, external_paths, internal_paths = find_contours(mask)
assert len(external_paths) == 1
assert len(internal_paths) == 0


def test_finds_singular_outer_path():
mask = np.array([[0, 0, 0, 0, 0], [0, 1, 1, 1, 1], [0, 1, 1, 1, 0], [0, 0, 1, 0, 0]], dtype=np.uint8)
_labels, external_paths, internal_paths = find_contours(mask)
Expand Down
Loading

0 comments on commit a8a5e08

Please sign in to comment.