Name

AnalyzeBlobs — calculates features of blobs

Calling Sequence

BlobStatistics = AnalyseBlobs(BlobImage, IsCalculated)

Parameters

BlobImage

2D matrix of type uint32, should be generated using SearchBlobs or FilterBySize

IsCalculated

struct that specifies whether or not a feature shall be calculated. This struct must have the following components of type boolean:

  • BoundingBox: column vector with the four elements [upper left column; upper left row; witdth; height].

  • Centroid: vector with the elements [center_column, center_row].

  • PixelIndexList: column vector that contains linear indices of all pixels belonging to the blob.

  • PixelList: matrix with two columns, first column contains the column, second component the rows of all pixels belonging to the current blob.

BlobStatistics

list that contains as many elements as there are blobs in BlobImage. Each elements contains a struct with components that have the same names as the true-valued components of IsCalculated.

Description

This function calculates blob features. For each blob a struct is generated and stored in a list. The features that shall be calculated must be specified. The first input parameter is a blob image. The second parameter is a struct with boolean components. This struct can be initialized using the function CreateFeatureStruct.

Examples

RGB = imread('lena.png'); // This image should reside in the current directory.

Image = rgb2gray(RGB);

ThresholdedImage = SegmentbyThreshold(Image, 200);

BlobImage = SearchBlobs(ThresholdedImage);

FilteredBlobImage = FilterBySize(BlobImage, 100); // Small objects are removed.

IsCalculated = GenerateFeatureStruct(%f); // Feature struct is generated.

IsCalculated.BoundingBox = %t; // The bounding box shall be calculated for each blob.

BlobStatistics = AnalyzeBlobs(FilteredBlobImage, IsCalculated);