Blobs.aligned_box#

Blobs.aligned_box(**kwargs: Any) Any#

Compute rectangle aligned with ellipse axes for blobs

Returns:

tuple of area, centroid, vertices of the aligned box

Return type:

tuple or list of tuples

Compute the minimal enclosing box whose sides are parallel to the axes of the equivalent ellipse. Return a list of vertices (not closed) and a list of box centroids.

Example:

>>> from machinevisiontoolbox import Image
>>> im = Image.Read("sharks.png")
>>> blobs = im.blobs()
>>> blobs[0].aligned_box()  # downward shark
(np.float64(33400.45483235071), array([[266.5466],
       [418.1671]]), array([[144.8118, 385.8605, 388.2814, 147.2327, 144.8118],
       [351.0131, 346.8004, 485.3212, 489.5339, 351.0131]]))
Seealso:

plot_aligned_box plot_axes plot_box plot_centroid