ovl.target_filters.shape_filters.rotated_square_filter module

ovl.target_filters.shape_filters.rotated_square_filter.rotated_square_filter(contour_list, min_area_ratio: Union[float, ovl.helpers.types.RangedNumber.<locals>.Hint] = 0.8, min_ratio: Union[float, ovl.helpers.types.RangedNumber.<locals>.Hint] = 0.95, max_ratio: Union[float, ovl.helpers.types.RangedNumber.<locals>.Hint] = 1.05)[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
  • max_ratio – maximum ratio between radius and sides of bounding rectangle
  • min_ratio – minimum ratio between radius and sides of bounding rectangle
  • min_area_ratio – minimum ratio between the area of the contours and the bounding shape
Returns:

the contour list filtered.