Name

FilterBySize — filters out blobs that have less pixels than a lower bound or more pixels than an upper bound.

Calling Sequence

FilteredImage = FilterBySize(Image, MinArea);

FilteredImage = FilterBySize(Image, MinArea, MaxArea);

Parameters

Image

2D matrix of type uint32 or int32, should be generated by SearchBlobs

MinArea

minimum number of pixels a blobs can have

MaxArea

maximum number of pixels a blob can have. This parameter is optional.

Description

This function filters out objects from a blob image that have less pixels than a lower bound or more pixels than an upper bound. Image should be generated by SearchBlobs.

Examples

Image = rand(9, 9) // generate random image

Threshold = CalculateOtsuThreshold(Image); // calculate a threshold

BinaryImage = SegmentByThreshold(Image, Threshold) // segment image

BlobImage = SearchBlobs(BinaryImage) // blob image is generated

FilteredBlobImage = FilterBySize(BlobImage, 3, 60)

See also

SearchBlobs, CreateFeatureStruct, AnalyzeBlobs, CreateSizeHistogram, CumulateSizeHistogram, CreatePixelIndexList