OCV 4.5; C++, Visual Studio 2017; MFC; Windows 10
The KeyPoint.size is given as
'diameter of the meaningful keypoint neighborhood ’
I want to make sure that I am using this ‘diameter’ correctly in order to calculate area to compare to minArea and maxArea. Can I assume that this ‘diameter’ is given in pixels?
With the code lines:
Ptr<SimpleBlobDetector> detector = SimpleBlobDetector::create(params); detector->detect(matThresholded, keypoints);
say I get a keypoints.at(1).size of 2, that would be a diameter of 2 pixels. Correct?
Since I am looking for more or less circular blobs then, using the standard formula for the area of a circle I would divide by 2 to get the radius and then get Pi X r2 ie
float fRadius = keypoints.at(i).size / 2; // In this example it is a radius of 1 float fArea = 3.14 * (fRadius*fRadius); // In this example this would be an area of 3.14
My questions is: Is this a near correlation to what SimpleBlobDetector is using when it calculates area to compare with minArea and maxArea?
In the source file OpenCV_453\opencv\sources\modules\features2d\src\blobdector.cpp it arrives at the area via
Moments moms = moments(contours[contourIdx]); double area = moms.m00;
So if m00 is a spatial moment, given a true circle, wouldn’t this be the same (more or less) as my area of a circle calculation above?
Is there a way, from the return in the KeyPoint object, for me to calculate a similar m00 Moment?