C# Class Accord.Imaging.BlobCounter

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

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

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

For blobs' searching the class supports 8 bpp indexed grayscale images and 24/32 bpp color images that are at least two pixels wide. Images that are one pixel wide can be processed if they are rotated first, or they can be processed with RecursiveBlobCounter. See documentation about BlobCounterBase for information about which pixel formats are supported for extraction of blobs.

Sample usage:

// create an instance of blob counter algorithm BlobCounter bc = new BlobCounter(); // process binary image bc.ProcessImage(image); // process blobs foreach (Rectangle rect in bc.GetObjectsRectangles()) { // ... }
Inheritance: BlobCounterBase
Afficher le fichier Open project: accord-net/framework Class Usage Examples

Méthodes publiques

Méthode Description
BlobCounter ( ) : System

Initializes a new instance of the BlobCounter class.

Creates new instance of the BlobCounter class with an empty objects map. Before using methods, which provide information about blobs or extract them, the BlobCounterBase.ProcessImage(Bitmap), BlobCounterBase.ProcessImage(BitmapData) or BlobCounterBase.ProcessImage(UnmanagedImage) method should be called to collect objects map.

BlobCounter ( Bitmap image ) : System

Initializes a new instance of the BlobCounter class.

BlobCounter ( BitmapData imageData ) : System

Initializes a new instance of the BlobCounter class.

BlobCounter ( UnmanagedImage image ) : System

Initializes a new instance of the BlobCounter class.

Méthodes protégées

Méthode Description
BuildObjectsMap ( UnmanagedImage image ) : void

Actual objects map building.

The method supports 8 bpp indexed grayscale images and 24/32 bpp color images.

Method Details

BlobCounter() public méthode

Initializes a new instance of the BlobCounter class.
Creates new instance of the BlobCounter class with an empty objects map. Before using methods, which provide information about blobs or extract them, the BlobCounterBase.ProcessImage(Bitmap), BlobCounterBase.ProcessImage(BitmapData) or BlobCounterBase.ProcessImage(UnmanagedImage) method should be called to collect objects map.
public BlobCounter ( ) : System
Résultat System

BlobCounter() public méthode

Initializes a new instance of the BlobCounter class.
public BlobCounter ( Bitmap image ) : System
image System.Drawing.Bitmap Image to look for objects in.
Résultat System

BlobCounter() public méthode

Initializes a new instance of the BlobCounter class.
public BlobCounter ( BitmapData imageData ) : System
imageData System.Drawing.Imaging.BitmapData Image data to look for objects in.
Résultat System

BlobCounter() public méthode

Initializes a new instance of the BlobCounter class.
public BlobCounter ( UnmanagedImage image ) : System
image UnmanagedImage Unmanaged image to look for objects in.
Résultat System

BuildObjectsMap() protected méthode

Actual objects map building.
The method supports 8 bpp indexed grayscale images and 24/32 bpp color images.
Unsupported pixel format of the source image. Cannot process images that are one pixel wide. Rotate the image /// or use .
protected BuildObjectsMap ( UnmanagedImage image ) : void
image UnmanagedImage Unmanaged image to process.
Résultat void