# Reference system in SimpleBlobDetector

Trying the SimpleBlobDetection to identify circumferences in low-resolution images, i'm in doubt about the meaning of the x and y properties of the returned keypoints. In particular, since i need to map from the pixel domain to a physical domain (in my problem every pixel has a side length expressed in meters), i believed that keypoint.x = 0 and keypoint.y = 0 indicated to the upper left corner of the upper left pixel, instead it seams that keypoint.x = 0 and keypoint.y = 0 refer to the center of the upper left pixel. Is my impression right?

edit retag close merge delete

1

integer pixels are used here, no subpixel accuracy, so there is no "upper left corner" of a pixel

1

In most cases, the integer value of a pixel represents the center of the pixel. For example

Mat tst(1,3,CV_32F);
tst.setTo( 0 );
tst.at<float>( 0 ) = 1;
tst.at<float>( 1 ) = 2;
tst.at<float>( 2 ) = 1;
Moments m = moments(tst);
cout<<m.m01/m.m00<<" "<<m.m10/m.m00<<"\n";


prints "0 1"

The x property of the SimpleBlobDetector keypoint is of type float. Therefore, when keypoint.x = 1.5, do it indicate a point between a pair of pixels?

1.5 would be exactly on the dividing line between two pixels. For example, if you make that 1 2 2 1 instead, you'll get 1.5, ie: the middle of the four pixels, or right between the middle two.

Sort by » oldest newest most voted

Thanks a lot!!! Now it's clear to me. Only one last curiosity: following this convention, the upper left corner of the upper left pixel has x = -0.5 and y = -0.5 ?

more

Yes. Of course, you can't really get anything there, unless you're doing things like reflecting the border. Because to get sub-pixel measurements on something, you have to interpolate between pixels, and there's nothing above or left of (0,0).

On the other hand, who knows what anyone is actually using this stuff for, so sure.

Official site

GitHub

Wiki

Documentation