Blobs.label_image#

Blobs.label_image(image: Any = None) Any[source]#

Create label image from blobs

Parameters:

image (Image, optional) – image to draw into, defaults to new image

Returns:

greyscale label image

Return type:

Image

The perimeter information from the blobs is used to generate a greyscale label image where the greyvalue of each region corresponds to the blob index.

Example:

>>> from machinevisiontoolbox import Image
>>> im = Image.Read("sharks.png")
>>> blobs = im.blobs()
>>> labels = blobs.label_image()
>>> labels.disp(colorbar=True)

(Source code)

../../_images/machinevisiontoolbox-Blobs-label_image-1_00.png

(png, hires.png, pdf)#

../../_images/machinevisiontoolbox-Blobs-label_image-1_01.png

(png, hires.png, pdf)#

Note

The label image is reconstituted from the OpenCV contours that are saved within the Blobs object.

Seealso:

labels_binary