Blob counter based on recursion.

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

Syntax

C#
public class RecursiveBlobCounter : BlobCounterBase

Remarks

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

Note:The algorithm treats all pixels with values less or equal to BackgroundThreshold as background, but pixels with higher values are treated as objects' pixels.

Note:Since this algorithm is based on recursion, it is required to be careful with its application to big images with big blobs, because in this case recursion will require big stack size and may lead to stack overflow. The recursive version may be applied (and may be even faster than BlobCounter) to an image with small blobs - "star sky" image (or small cells, for example, etc).

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
RecursiveBlobCounter bc = new RecursiveBlobCounter( );
// 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..::.RecursiveBlobCounter

See Also