-label

This command generally surveys single channel, binary images, identifies and enumerates distinct, connected regions, assigning each region a unique shade of gray that constitutes the region's numeric label. It is not uncommon to harness -map to assign these regions color, as was done on the image on the left, so that human beings can quickly recognize regions.

Label usuallly plays an early role in feature detection pipelines. Upstream logic of some sort identifies pixels having particular characteristics and makes a single channel, binary (1, 0; 'True', 'False') image identifying the pixels with those characteristics. From this binary image, -label produces a gray scale dataset that enumerates distinct, connected regions. -label tries to detect one region, the 'background', which tends to encompass all other regions. If it finds that one region serves as the background, it gives the region an enumeration of '0'. Otherwise, label assigns 'O' to the first identified region. All other regions are assigned successive numerals until all pixels have been assigned to a region. The -label command stores the region number in each pixel, giving it a shade of gray unique to the region. As the command generally works from left to right, top to bottom, regions toward the bottom of the output image appear as lighter shades of gray, since these generally have higher enumerations.

Once the -label command has completed its work, the maximum intensity (iM) of the output image acquires additonal significance: It holds the count of distinct regions that the -label command has identified, this stemming from the fact that the command assigns successive levels of gray to distinct regions as it finds them; the last region found receives the highest region label, which also becomes the image's maximum intensity, iM. Downstream feature extraction logic can locate a particular region, say 18, with the snippet -eq[-1] 18. This will produce a binary image of region 18 pixels and only region 18 pixels, as the enumeration is unique.

The format of the command is:

-label tolerance>=0,is_high_connectivity={ 0 | 1 }

Garry Osgood