ovl.math.shape_fill_ratios module

ovl.math.shape_fill_ratios.circle_fill_ratio(contour: numpy.ndarray) → Tuple[float, float][source]

Returns the ratio between the contour and the smallest enclosing circle.

Parameters:contour – The contour to be compared
Returns:the ratio, the radius of the enclosing circle
Return type:float
ovl.math.shape_fill_ratios.rectangle_fill_ratio_straight(contour, reverse_div=False)[source]

Returns the ratio between the contour and the straight bounding rectangle.

Parameters:
  • contour – The contour to be compared
  • reverse_div – If the rectangle’s area should be divided by the contour.
Returns:

the ratio, the width of the bounding rectangle, the height of the bounding rectangle

Return type:

float

ovl.math.shape_fill_ratios.rotating_rectangle_fill_ratio(contour: numpy.ndarray) → Tuple[float, float, float][source]

Returns the ratio between the contour and the smallest bounding rectangle.

Parameters:contour – The contour to be compared
Returns:the ratio, the width of the bounding rectangle, the height of the bounding rectangle
Return type:float, float, float
ovl.math.shape_fill_ratios.triangle_fill_ratio(contour, triangle=None) → float[source]

Returns the ratio between a given contour and the smallest enclosing rectangle

Parameters:
  • contour – numpy array
  • triangle – convex hull for the minEnclosingTriangle function, can be ignored
Returns:

returns the ratio between the contour and the bounding triangle

Return type:

float