Aller au contenu principal

raygeo.geo.algo.hull

Hull computation from binary images.

Provides convex and concave (shrink-wrap) hull generation from boolean images, using contour tracing and Bézier gravity attraction. Coordinates are returned in image pixel space (y increases downward).

Functions

get_concave_hull()

get_concave_hull(boolean_image: numpy.ndarray, gravity: float = 0.1) -> Geometry | None

Compute a concave (shrink-wrap) hull with Bézier gravity.

Returns: Concave hull as Geometry in pixel coords, or None.

ParameterTypeDescription
boolean_imagenumpy.ndarray2D boolean array.
gravityfloat = 0.1Shrink-wrap factor 0.0-1.0. 0 gives convex hull.
Returns`GeometryNone`

get_enclosing_hull()

get_enclosing_hull(boolean_image: numpy.ndarray) -> Geometry | None

Compute a single convex hull enclosing all content.

Returns: Convex hull as Geometry in pixel coords, or None.

ParameterTypeDescription
boolean_imagenumpy.ndarray2D boolean array.
Returns`GeometryNone`

get_hulls_from_image()

get_hulls_from_image(boolean_image: numpy.ndarray) -> list[Geometry]

Compute a separate convex hull for each distinct component.

Returns: List of Geometry objects in pixel coords.

ParameterTypeDescription
boolean_imagenumpy.ndarray2D boolean array.
Returnslist[Geometry]