Class for extracting blobs from an image
The class implements a simple algorithm for extracting blobs from an
image:
- Convert the source image to binary images by applying thresholding
with several thresholds from
MinThreshold
(inclusive) to
MaxThreshold
(exclusive) with distance ThresholdStep
between
neighboring thresholds.
- Extract connected components from every binary image by
cv.findContours and calculate their centers.
- Group centers from several binary images by their coordinates. Close
centers form one group that corresponds to one blob, which is
controlled by the
MinDistBetweenBlobs
parameter.
- From the groups, estimate final centers of blobs and their radiuses
and return as locations and sizes of keypoints.
This class performs several filtrations of returned blobs. You should
set FilterBy*
to true/false to turn on/off corresponding filtration.
Available filtrations:
- By color. This filter compares the intensity of a binary image at
the center of a blob to
BlobColor
. If they differ, the blob is
filtered out. Use BlobColor = 0
to extract dark blobs and
BlobColor = 255
to extract light blobs.
- By area. Extracted blobs have an area between
MinArea
(inclusive)
and MaxArea
(exclusive).
- By circularity. Extracted blobs have circularity
(
(4*pi*area)/(perimeter*perimeter)
) between MinCircularity
(inclusive) and MaxCircularity
(exclusive).
- By ratio of the minimum inertia to maximum inertia. Extracted
blobs have this ratio between
MinInertiaRatio
(inclusive) and
MaxInertiaRatio
(exclusive).
- By convexity. Extracted blobs have convexity
(area / area of blob convex hull) between
MinConvexity
(inclusive)
and MaxConvexity
(exclusive).
Default values of parameters are tuned to extract dark circular blobs.