Spaces:
Running
Running
Sagar Bharadwaj
commited on
Commit
·
4fc760f
1
Parent(s):
9faa18b
Made sure island_fills and island_borders have correspondence
Browse files
colorbynumber/gen_islands.py
CHANGED
@@ -55,8 +55,7 @@ class GenerateIslands:
|
|
55 |
cleaned_up_contours = self._get_cleaned_up_contours(this_component, area_threshold_perc)
|
56 |
|
57 |
contour_border_coords = np.where(cleaned_up_contours == 0)
|
58 |
-
|
59 |
-
self.island_borders[color_index].append((color_index, contour_border_coords))
|
60 |
|
61 |
|
62 |
def get_islands(self, border_padding=2, area_threshold_perc=0.05):
|
@@ -66,6 +65,7 @@ class GenerateIslands:
|
|
66 |
# Flatten the list of borders
|
67 |
island_borders_list = []
|
68 |
for color_id in self.island_borders:
|
69 |
-
|
|
|
70 |
|
71 |
return island_borders_list
|
|
|
55 |
cleaned_up_contours = self._get_cleaned_up_contours(this_component, area_threshold_perc)
|
56 |
|
57 |
contour_border_coords = np.where(cleaned_up_contours == 0)
|
58 |
+
self.island_borders[color_index].append((color_index, contour_border_coords))
|
|
|
59 |
|
60 |
|
61 |
def get_islands(self, border_padding=2, area_threshold_perc=0.05):
|
|
|
65 |
# Flatten the list of borders
|
66 |
island_borders_list = []
|
67 |
for color_id in self.island_borders:
|
68 |
+
if len(self.island_borders[color_id][1]) > 0:
|
69 |
+
island_borders_list += self.island_borders[color_id]
|
70 |
|
71 |
return island_borders_list
|