FilterBySize — filters out blobs that have less pixels than a lower bound or more pixels than an upper bound.
FilteredImage = FilterBySize(Image, MinArea); FilteredImage = FilterBySize(Image, MinArea, MaxArea);
2D matrix of type uint32 or int32, should be generated by SearchBlobs
minimum number of pixels a blobs can have
maximum number of pixels a blob can have. This parameter is optional.
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.
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)