Connected components labeling.

The filter performs labeling of objects in the source image. It colors each separate object using different color. The image processing filter treats all none black pixels as objects' pixels and all black pixel as background.

The filter accepts 8 bpp grayscale images and 24/32 bpp color images and produces 24 bpp RGB image.

Sample usage:

// create filter var filter = new ConnectedComponentsLabeling(); // apply the filter Bitmap newImage = filter.Apply(image); // check objects count int objectCount = filter.ObjectCount;

Initial image:

Result image:

Inheritance: BaseFilter
Beispiel #1
0
        private void SetFilter()
        {
            ImageType = ImageTypes.Rgb24bpp;
            Af.ConnectedComponentsLabeling newFilter = new Af.ConnectedComponentsLabeling();
            newFilter.MinWidth  = (int)width.T0;
            newFilter.MaxWidth  = (int)width.T1;
            newFilter.MinHeight = (int)height.T0;
            newFilter.MaxHeight = (int)height.T1;

            newFilter.CoupledSizeFiltering = coupled;
            newFilter.FilterBlobs          = blobs;

            imageFilter = newFilter;
        }