Skip to main content

find_contours

def find_contours(mask: Any) -> List[List[List[float]]]
Find all contours in the given binary mask, including inner contours. Returns polygons in GeoJSON format: triple nested list where:
  • Top level = polygon
  • Second level = list of rings (first is outer contour, rest are inner/holes)
  • Third level = flat list of coordinates [x1, y1, x2, y2, …]
Arguments:
  • mask - np.ndarray
Returns: List of polygons in GeoJSON format