MCPcopy Create free account
hub / github.com/VitoHowe/glm-coding / connected_components

Function connected_components

app/services/tenvision_adapter.py:133–141  ·  view source on GitHub ↗
(mask, min_area=4)

Source from the content-addressed store, hash-verified

131 if area < min_area:
132 continue
133 comps.append({'bbox': (int(x), int(y), int(w), int(h)), 'area': int(area)})
134 return comps
135
136
137def bbox_from_mask(mask):
138 ys, xs = np.where(mask > 0)
139 if xs.size == 0:
140 return None
141 x1 = int(xs.min())
142 x2 = int(xs.max()) + 1
143 y1 = int(ys.min())
144 y2 = int(ys.max()) + 1

Callers 3

choose_best_maskFunction · 0.85
split_mask_to_boxesFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected