How is a blob measured in Simple Blob Detector? The equation for detecting the blob size seems to be as follows: Math.PI * (kp.Size / 2) ^ 2) . According to OpenCV: OpenCV: cv::KeyPoint Class Reference it seems kp.Size is keypoint size which seems to be the keypoint diameter? Why would a blob be measured based on diameter? Blobs are not a perfect circle and can have tentacles that stretch out or even stay connected via a few pixels. Is there a better way to determine blob size in pixels^2? Or just number of pixels would be fine.
I am working on a project where there is a MinArea input that should be a lower filter on the size of blob output. This is my current code:
Private Shared Sub FindColorBlobs(UseUDTempSettings As Boolean)
Dim MinThreshold, MaxThreshold
MinThreshold = 100
MaxThreshold = 200
Dim sbdParams As New SimpleBlobDetectorParams
bAngleNaN = False
bAngleInvalid = False
bAnglePass = False
dAngle = 0.0
sAngle = ""
sbdParams.MinThreshold = MinThreshold
sbdParams.MaxThreshold = MaxThreshold
sbdParams.ThresholdStep = 20
sbdParams.FilterByArea = True
If UseUDTempSettings Then
sbdParams.MinArea = fSettings.RhtMinArea
Else
sbdParams.MinArea = AppSettings.GetInt("Rotation_Param_RhtMinArea")
End If
sbdParams.MaxArea = 100000
sbdParams.FilterByCircularity = False
sbdParams.MinCircularity = 0.1
sbdParams.FilterByConvexity = False
sbdParams.MinConvexity = 0.37
sbdParams.FilterByInertia = False
sbdParams.MinInertiaRatio = 0.01
sbdParams.FilterByColor = False
sbdParams.blobColor = 255
Dim sbdR As New SimpleBlobDetector(sbdParams)
kpRight = sbdR.Detect(RhtImage)
FindTopBlob(MarkerTypes.Cross, kpRight, ptRTop)
If UseUDTempSettings Then
sbdParams.MinArea = fSettings.LftMinArea
Else
sbdParams.MinArea = AppSettings.GetInt("Rotation_Param_LftMinArea")
End If
Dim sbdL As New SimpleBlobDetector(sbdParams)
kpLeft = sbdL.Detect(LftImage)
FindTopBlob(MarkerTypes.Diamond, kpLeft, ptLTop)
dX = ptRTop.X - ptLTop.X
dY = ptRTop.Y - ptLTop.Y
If UseUDTempSettings Then
bDiffXPass = (dX >= fSettings.DiffXMin) And (dX <= fSettings.DiffXMax)
bDiffYPass = (dY >= fSettings.DiffYMin) And (dY <= fSettings.DiffYMax)
Else
bDiffXPass = (dX >= AppSettings.GetInt("Rotation_Param_DiffXMin") And dX <= AppSettings.GetInt("Rotation_Param_DiffXMax"))
bDiffYPass = (dY >= AppSettings.GetInt("Rotation_Param_DiffYMin") And dY <= AppSettings.GetInt("Rotation_Param_DiffYMax"))
End If
If kpRight.Count > 0 And kpLeft.Count > 0 Then
If dX <> 0.0 Then
Dim Min, Max As Double
dAngle = Math.Atan(dY / dX) * 180.0 / Math.PI
If dX < 0.0 Then
dAngle = dAngle + 180.0
ElseIf dY < 0.0 Then
dAngle = dAngle + 360.0
End If
sAngle = dAngle.ToString("##0.0")
If UseUDTempSettings Then
Min = fSettings.AngleMin
Max = fSettings.AngleMax
Else
Min = AppSettings.GetInt("Rotation_Param_AngleMin")
Max = AppSettings.GetInt("Rotation_Param_AngleMax")
End If
If Min < 0 Then
Min = 360.0 + Min
bAnglePass = (dAngle >= Min Or dAngle <= Max)
Else
bAnglePass = (dAngle >= Min And dAngle <= Max)
End If
Else
sAngle = "Nan"
bAngleNaN = True
End If
Else
sAngle = "INV"
bAngleInvalid = True
End If
End Sub
End Class
Why are the KeyPoint’s size (the output) less than the MinArea (input)?
What is MinArea and what is Size for Kp? Is there a difference in Units or is something else awry?
Thanks in advance.