Base class for different blob counting algorithms.

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


public abstract class BlobCounterBase


The class is abstract and serves as a base for different blob counting algorithms. Classes, which inherit from this base class, require to implement BuildObjectsMap(UnmanagedImage) method, which does actual building of object's label's map.

For blobs' searcing usually all inherited classes accept binary images, which are actually grayscale thresholded images. But the exact supported format should be checked in particular class, inheriting from the base class. For blobs' extraction the class supports grayscale (8 bpp indexed) and color images (24 and 32 bpp).

Sample usage:

// create an instance of blob counter algorithm
BlobCounterBase bc = new ...
// set filtering options
bc.FilterBlobs = true;
bc.MinWidth  = 5;
bc.MinHeight = 5;
// process binary image
bc.ProcessImage( image );
Blob[] blobs = bc.GetObjects( image, false );
// process blobs
foreach ( Blob blob in blobs )
    // ...
    // blob.Rectangle - blob's rectangle
    // blob.Image - blob's image

Inheritance Hierarchy

See Also