Ask Your Question

Reference system in SimpleBlobDetector

asked 2017-11-03 05:38:51 -0500

Ema90 gravatar image

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 flag offensive close merge delete



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

berak gravatar imageberak ( 2017-11-03 05:48:20 -0500 )edit

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 );<float>( 0 ) = 1;<float>( 1 ) = 2;<float>( 2 ) = 1;
Moments m = moments(tst);
cout<<m.m01/m.m00<<" "<<m.m10/m.m00<<"\n";

prints "0 1"

Tetragramm gravatar imageTetragramm ( 2017-11-03 09:50:38 -0500 )edit

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?

Ema90 gravatar imageEma90 ( 2017-11-07 02:40:56 -0500 )edit

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.

Tetragramm gravatar imageTetragramm ( 2017-11-07 17:52:45 -0500 )edit

1 answer

Sort by ยป oldest newest most voted

answered 2017-11-09 02:10:07 -0500

Ema90 gravatar image

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 ?

edit flag offensive delete link 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.

Tetragramm gravatar imageTetragramm ( 2017-11-09 17:53:54 -0500 )edit

Question Tools

1 follower


Asked: 2017-11-03 05:38:51 -0500

Seen: 198 times

Last updated: Nov 03 '17