C# Класс Accord.Imaging.RecursiveBlobCounter

Blob counter based on recursion.

The class counts and extracts stand alone objects in images using recursive version of 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.

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:

// create an instance of blob counter algorithm var bc = new RecursiveBlobCounter(); // process binary image bc.ProcessImage(image); // process blobs foreach (Rectangle rect in bc.GetObjectsRectangles()) { // ... }
Наследование: BlobCounterBase
Показать файл Открыть проект

Открытые методы

Метод Описание
RecursiveBlobCounter ( ) : System

Initializes a new instance of the RecursiveBlobCounter class.

Creates new instance of the RecursiveBlobCounter 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.

RecursiveBlobCounter ( Bitmap image ) : System

Initializes a new instance of the RecursiveBlobCounter class.

RecursiveBlobCounter ( BitmapData imageData ) : System

Initializes a new instance of the RecursiveBlobCounter class.

RecursiveBlobCounter ( UnmanagedImage image ) : System

Initializes a new instance of the RecursiveBlobCounter class.

Защищенные методы

Метод Описание
BuildObjectsMap ( UnmanagedImage image ) : void

Actual objects map building.

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

Приватные методы

Метод Описание
LabelColorPixel ( byte pixel, int labelPointer ) : void
LabelPixel ( byte pixel, int labelPointer ) : void

Описание методов

BuildObjectsMap() защищенный Метод

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.
protected BuildObjectsMap ( UnmanagedImage image ) : void
image UnmanagedImage Unmanaged image to process.
Результат void

RecursiveBlobCounter() публичный Метод

Initializes a new instance of the RecursiveBlobCounter class.
Creates new instance of the RecursiveBlobCounter 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 RecursiveBlobCounter ( ) : System
Результат System

RecursiveBlobCounter() публичный Метод

Initializes a new instance of the RecursiveBlobCounter class.
public RecursiveBlobCounter ( Bitmap image ) : System
image System.Drawing.Bitmap Image to look for objects in.
Результат System

RecursiveBlobCounter() публичный Метод

Initializes a new instance of the RecursiveBlobCounter class.
public RecursiveBlobCounter ( BitmapData imageData ) : System
imageData System.Drawing.Imaging.BitmapData Image data to look for objects in.
Результат System

RecursiveBlobCounter() публичный Метод

Initializes a new instance of the RecursiveBlobCounter class.
public RecursiveBlobCounter ( UnmanagedImage image ) : System
image UnmanagedImage Unmanaged image to look for objects in.
Результат System