Blob counter - counts objects in image, which are separated by black background.

Namespace:  AForge.Imaging
Assembly:  AForge.Imaging (in AForge.Imaging.dll) Version: 2.1.2.0 (2.1.2.0)

Syntax

C#
public class BlobCounter : BlobCounterBase

Remarks

The class counts and extracts stand alone objects in images using connected components labeling algorithm.

Note:The algorithm treats all black pixels as background, but not an object. This means that all objects, which could be located by the algorithm, must have other than black color.

For blobs' searching the class supports 8 bpp indexed grayscale images and 24/32 bpp color images. See documentation about BlobCounterBase for information about which pixel formats are supported for extraction of blobs.

Sample usage:

CopyC#
// create an instance of blob counter algorithm
BlobCounter bc = new BlobCounter( );
// process binary image
bc.ProcessImage( image );
Rectangle[] rects = bc.GetObjectsRectangles( );
// process blobs
foreach ( Rectangle rect in rects )
{
    // ...
}

Inheritance Hierarchy

System..::.Object
  AForge.Imaging..::.BlobCounterBase
    AForge.Imaging..::.BlobCounter

See Also