ovl.target_filters.shape_filters.straight_square_filter module

ovl.target_filters.shape_filters.straight_square_filter.straight_square_filter(contour_list, min_area_ratio: Union[float, ovl.helpers.types.RangedNumber.<locals>.Hint] = 0.8, min_len_ratio: Union[float, ovl.helpers.types.RangedNumber.<locals>.Hint] = 0.95)[source]

Receives a list of contours and returns only the ones that are approximately square Relation checked is [minimum ratio < (Circle radius / width * height * (square root of 2)) < maximum ratio]

Parameters:
  • contour_list – List of Contours to filter
  • min_len_ratio – maximum ratio between radius and sides of bounding rectangle
  • min_area_ratio – the minimum ratio between the area of the contour and the area of the bounding shape
Returns:

the contour list filtered.