Hello, so I’m trying to use the find_template function to detect if a clear water droplet is on a surface. I have good lighting, so the droplet is quite visible and distinct from the background. I’m having trouble with getting the function’s sensitivity down. If I set it too low (lets say 0.6), I get too many false positives, but bumping it up by 0.1 does not detect it at all.
Hi, can you attach an image of the surface with and without the droplet ?
Here are the photos. I can’t dye the droplets so find_blobs using color is out of the question.
Hi, you need to do some image preprocessing to increase the obvious of the droplets. Is the camera in a fixed position in relation to what you are looking at? If so, then see the frame differencing example scripts for how to subtract the background. This will give you a blob then you can use find_blobs() on quite easily.
Thanks, I’m getting better results. The rectangles appear to surround the droplet (i.e. boxes on the reflected portions rather than the entire droplet). Is there any way to get the whole droplet to show up? It’s probably difficult since they aren’t distinct colors.
Also, how does get.similarity compare to blobs and templates? I might look into using that as well. My end goal is to make sure that all 3 droplets are there and give a warning if one of them isn’t
Hi, use the merge=True feature of find_blobs() and set the margin=5 or higher. This will merge all the rects nearby into one. This should do what you want.
Once you’ve reduced the list of blobs to 3ish… Then filter out blobs which don’t have a squarish shape. I.e make sure the width() and height () are similar. The easiest way to do this is to take the max() of both… square that, and then compare to the width() * height (). The larger the difference the less square.
Anyway, once you have the blob locations detected well then use get_stats() on each blobs ROI to get color details. You can use this info to verify that you don’t see random stuff.
Get similarlity compares images to images… Um, you can just use template matching after you find the blob location on the next image from snapshot().
Anyway, I think you are almost there.