Click or drag to resize
Accord.NET (logo)

RecursiveBlobCounter Class

Blob counter based on recursion.
Inheritance Hierarchy
SystemObject
  Accord.ImagingBlobCounterBase
    Accord.ImagingRecursiveBlobCounter

Namespace:  Accord.Imaging
Assembly:  Accord.Imaging (in Accord.Imaging.dll) Version: 3.8.0
Syntax
public class RecursiveBlobCounter : BlobCounterBase
Request Example View Source

The RecursiveBlobCounter type exposes the following members.

Constructors
  NameDescription
Public methodRecursiveBlobCounter
Initializes a new instance of the RecursiveBlobCounter class.
Public methodRecursiveBlobCounter(Bitmap)
Initializes a new instance of the RecursiveBlobCounter class.
Public methodRecursiveBlobCounter(BitmapData)
Initializes a new instance of the RecursiveBlobCounter class.
Public methodRecursiveBlobCounter(UnmanagedImage)
Initializes a new instance of the RecursiveBlobCounter class.
Top
Properties
  NameDescription
Public propertyBackgroundThreshold
Background threshold's value.
Public propertyBlobsFilter
Custom blobs' filter to use.
(Inherited from BlobCounterBase.)
Public propertyCoupledSizeFiltering
Specifies if size filtering should be coupled or not.
(Inherited from BlobCounterBase.)
Public propertyFilterBlobs
Specifies if blobs should be filtered.
(Inherited from BlobCounterBase.)
Protected propertyImageHeight
Gets the height of the image.
(Inherited from BlobCounterBase.)
Protected propertyImageWidth
Gets the width of the image.
(Inherited from BlobCounterBase.)
Public propertyMaxHeight
Maximum allowed height of blob.
(Inherited from BlobCounterBase.)
Public propertyMaxWidth
Maximum allowed width of blob.
(Inherited from BlobCounterBase.)
Public propertyMinHeight
Minimum allowed height of blob.
(Inherited from BlobCounterBase.)
Public propertyMinWidth
Minimum allowed width of blob.
(Inherited from BlobCounterBase.)
Public propertyObjectLabels
Objects' labels.
(Inherited from BlobCounterBase.)
Public propertyObjectsCount
Objects count.
(Inherited from BlobCounterBase.)
Public propertyObjectsOrder
Objects sort order.
(Inherited from BlobCounterBase.)
Top
Methods
  NameDescription
Protected methodBuildObjectsMap
Actual objects map building.
(Overrides BlobCounterBaseBuildObjectsMap(UnmanagedImage).)
Public methodDispose
Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources.
(Inherited from BlobCounterBase.)
Protected methodDispose(Boolean)
Releases unmanaged and - optionally - managed resources.
(Inherited from BlobCounterBase.)
Public methodEquals
Determines whether the specified object is equal to the current object.
(Inherited from Object.)
Public methodExtractBlobsImage(Bitmap, Blob, Boolean)
Extract blob's image.
(Inherited from BlobCounterBase.)
Public methodExtractBlobsImage(UnmanagedImage, Blob, Boolean)
Extract blob's image.
(Inherited from BlobCounterBase.)
Protected methodFinalize
Allows an object to try to free resources and perform other cleanup operations before it is reclaimed by garbage collection.
(Inherited from Object.)
Public methodGetBlobsEdgePoints
Get list of object's edge points.
(Inherited from BlobCounterBase.)
Public methodGetBlobsLeftAndRightEdges
Get list of points on the left and right edges of the blob.
(Inherited from BlobCounterBase.)
Public methodGetBlobsTopAndBottomEdges
Get list of points on the top and bottom edges of the blob.
(Inherited from BlobCounterBase.)
Public methodGetHashCode
Serves as the default hash function.
(Inherited from Object.)
Public methodGetObjects(Bitmap, Boolean)
Get blobs.
(Inherited from BlobCounterBase.)
Public methodGetObjects(UnmanagedImage, Boolean)
Get blobs.
(Inherited from BlobCounterBase.)
Public methodCode exampleGetObjectsInformation
Get objects' information.
(Inherited from BlobCounterBase.)
Public methodGetObjectsRectangles
Get objects' rectangles.
(Inherited from BlobCounterBase.)
Public methodGetType
Gets the Type of the current instance.
(Inherited from Object.)
Protected methodMemberwiseClone
Creates a shallow copy of the current Object.
(Inherited from Object.)
Public methodProcessImage(Bitmap)
Build objects map.
(Inherited from BlobCounterBase.)
Public methodProcessImage(BitmapData)
Build objects map.
(Inherited from BlobCounterBase.)
Public methodProcessImage(UnmanagedImage)
Build object map from raw image data.
(Inherited from BlobCounterBase.)
Public methodToString
Returns a string that represents the current object.
(Inherited from Object.)
Top
Extension Methods
  NameDescription
Public Extension MethodHasMethod
Checks whether an object implements a method with the given name.
(Defined by ExtensionMethods.)
Public Extension MethodIsEqual
Compares two objects for equality, performing an elementwise comparison if the elements are vectors or matrices.
(Defined by Matrix.)
Public Extension MethodTo(Type)Overloaded.
Converts an object into another type, irrespective of whether the conversion can be done at compile time or not. This can be used to convert generic types to numeric types during runtime.
(Defined by ExtensionMethods.)
Public Extension MethodToTOverloaded.
Converts an object into another type, irrespective of whether the conversion can be done at compile time or not. This can be used to convert generic types to numeric types during runtime.
(Defined by ExtensionMethods.)
Top
Remarks

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

Note 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 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:

// 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())
{
    // ...
}
See Also