Image.labels_MSER#

Image.labels_MSER(**kwargs: Any) tuple[Any, int][source]#

Blob labelling using MSER

Parameters:

kwargs – arguments passed to MSER_create

Returns:

label image, number of regions

Return type:

Image, int

Compute labels of connected components in the input greyscale image. Regions are sets of contiguous pixels that form stable regions across a range of threshold values.

The method returns the label image and the number of labels N, so labels lie in the range [0, N-1].The value in the label image in an integer indicating which region the corresponding input pixel belongs to. The background has label 0.

Example:

>>> from machinevisiontoolbox import Image
>>> img = Image.Squares(2, size=15)
>>> img.print()
   0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
   0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
   0 0 1 1 1 1 0 0 1 1 1 1 0 0 0
   0 0 1 1 1 1 0 0 1 1 1 1 0 0 0
   0 0 1 1 1 1 0 0 1 1 1 1 0 0 0
   0 0 1 1 1 1 0 0 1 1 1 1 0 0 0
   0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
   0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
   0 0 1 1 1 1 0 0 1 1 1 1 0 0 0
   0 0 1 1 1 1 0 0 1 1 1 1 0 0 0
   0 0 1 1 1 1 0 0 1 1 1 1 0 0 0
   0 0 1 1 1 1 0 0 1 1 1 1 0 0 0
   0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
   0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
   0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
>>> labels, N = img.labels_MSER()
>>> N
0
>>> labels.print()
   0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
   0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
   0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
   0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
   0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
   0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
   0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
   0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
   0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
   0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
   0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
   0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
   0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
   0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
   0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
References:
Seealso:

labels_binary labels_graphseg blobs opencv.MSER_create