SimpleBlobDetector and zero moment

asked 2015-05-07 02:03:07 -0600

LBerger gravatar image

updated 2015-05-07 02:16:32 -0600

Hi,

I use SimpleBlobDetector and I have got an exception when there is a line in Mat img at row 0 or img.rows-1 or column 0 or img.cols-1. An example of such image is here

In one of previous case all moments m00, m10, .... are equal to 0. When SimpleBlobDetector is used at line 270 it is written

center.location = Point2d(moms.m10 / moms.m00, moms.m01 / moms.m00);

There is no check about m00 here. There is check at line 290 but it's too late Is it right?

Thanks for your answer

edit retag flag offensive close merge delete

Comments

yes, ofc. the check has to go before that.

(btw, i'm still wondering, why it finds a contour in that place at all. did you find out anything about that yet ?)

berak gravatar imageberak ( 2015-05-07 03:19:31 -0600 )edit
1

Yes I have made this image with Libreoffice draw and I forget to delete boundaries around rectangle and circle (that is the reason that I have deleted one of my post). You can see a small blue line at border image. But this problem (m00=0) occurs too for pixel region.

LBerger gravatar imageLBerger ( 2015-05-07 03:28:36 -0600 )edit

ah, ok.

(and right, it does not matter, where or how it finds a 0pixel area. if it can happen, the check has to go before the divide)

berak gravatar imageberak ( 2015-05-07 03:34:00 -0600 )edit
1

i have created a bug report 4321

LBerger gravatar imageLBerger ( 2015-05-07 05:08:30 -0600 )edit