Ask Your Question

SimpleBlobDetector Threshold

asked 2015-04-22 08:28:06 -0500

dgbwolf gravatar image

Hi everyone

I'm trying to detect the position of some bright (infrared) LEDs on a dark background with the SimpleBlobDetector. I can get it to work, but I don't really understand what kind of values the threshold parameters (minThreshold, maxThreshold) need. I somewhat understand what the parameters mean but my question is, in what range can you enter values for them?


edit retag flag offensive close merge delete


have a look in the this nicely explained tutorial, regarding the SimpleBlobDetector() class parameters.

theodore gravatar imagetheodore ( 2015-04-22 17:31:18 -0500 )edit

I am aware of this tutorial but it sadly doesn't answer my question regarding the range of values.

dgbwolf gravatar imagedgbwolf ( 2015-04-23 04:30:05 -0500 )edit

1 answer

Sort by ยป oldest newest most voted

answered 2015-04-23 08:57:19 -0500

Those threshold parameters, according to the tutorial mentioned by @theodore, are to be used in grayscale images (have in mind that your IR image is a grayscale image).

The minThreshold sets pixels bellow that value to zero. The maxThreshold sets pixels above that value to zero.

Imagine your minThreshold = 10 and maxThreshold = 200. In your grayscale image the pixels with value bellow 10 will be set to zero, and pixels with value above 200 will also be set to zero.

In your problem, since you have a dark area with very bright spots, the maxThreshold shouldn't be used (set it to 255 which is maximum for grayscale 8bit images), and minThreshold should be rather high (i'd start at 40 and go up till my bright spots start to disappear), to ignore most dark areas and keep only the bright spots in the image.

You want this threshold to discard everything but the bright spots, so you have to set minThreshold to as high as you can without compromising bright spots.

edit flag offensive delete link more


That seems about right, thank you! I still get some weird behaviour (when I set minThreshold below 30 or so bright spots won't get recognised anymore) but it works.

dgbwolf gravatar imagedgbwolf ( 2015-04-23 13:24:50 -0500 )edit
Login/Signup to Answer

Question Tools

1 follower


Asked: 2015-04-22 08:28:06 -0500

Seen: 7,202 times

Last updated: Apr 23 '15