How to approach detecting and filling in spots that don't have a precise location?

Without breaking NDA I’ll try to explain what I am aiming for:

In a captured grayscale video frame (.tif image), there is going to be spots of light shining on what is otherwise a completely black area. A frame from this feed is fed to the code every interval for analysis. This is a small area, so the dots are easy to point out visually. There is no way to know exactly where they will be or exactly how big they will be; however, size and relative location don’t fluctuate too much.

This looks like a job for FindContours, but I don’t know whether I start with that or what steps I’d need to do before it. Has anyone tried something similar before?

try SimpleBlobDetector instead. it’s made for that. no need for contours.

1 Like

Yep, does the trick, and I fill in the keypoints. Thank you!

I don’t know what your light spots look like, and I’m not sure how the blob detector handles different intensities, but you might get more accurate results if you do a weighted average based on pixel intensity in your blob. And you might do better if you have a background image of the scene (unless it’s truly completely black) without any light blobs (and do image subtraction to account for that). And you might even do better if you take into account camera gamma when doing your subtraction and weighted average. But these extra steps are only warranted if you need higher precision in your locations than you can get with the straightforward approach.