02-16-2013 04:26 PM - edited 02-16-2013 04:37 PM
Hello,
I am trying to solve a task, where I need to exclude blobs in binary image based on the blob size,
the size treshold changes with the blob position.
Since this is not doable through the standard particle filter, I made mask out of results.
The algorithm is not fast enough + it keeps bad blobs if the later bounding boxes overlap them.
Please suggest some other method.
Bublina
Solved! Go to Solution.
02-18-2013 04:11 AM
Hi Bublina!
Your method is a really good start, I would like to add a few ideas to it. First of all, you can add many objects (rectangles, ovals, points, etc.) to a single ROI descriptor, so it's easier to have all removed objects listed in a single ROI, then you can do the masking all at once. You can also fasten execution by using Particle Analysis.vi, which only performs the measurements selected by you, not all of them.
Here's some example code of these changes: (sorry for the picture instead of a snippet, my LV is acting up a bit)
Just replace the code at the red arrow with your decision-making code and it should work.
As you can see it is still quite a simple filter (it masks bounding rectangles), so if you have strangely shaped particles or your particles are too close together, some useful data might be erased. So if you need a more precise approach you could go by labeling your particles (so assigning a different color to each one), then deleting colors from the image based on criteria you specify.
I hope this helps.
Best regards:
Andrew Valko
NI Hungary
02-18-2013 05:13 AM
Very nice,
it indeed works twice faster or more. Unfortunately, I get too many good blobs residing in bad blobs removed.
I am trying to use cvBlob library now.
Good advice anyway, have to remember the Particle Analysis.vi
02-18-2013 06:28 AM
Dear Bublina!
If masking rectangles away does not work properly, you can still try my other suggestion: Labeling particles and filtering them by label. Here's the core idea:
Particle analysis returns particles in the same logical order (first pixel scanned from top to bottom, left to right) as IMAQ Label. For every particle returned, you can define whether to keep it or throw it away, then based on this decision you create an integer (1 or 0 respecively) and load the array created from these integers into a user-defined Look-Up Table.
For me this approach worked pretty well.
Best regards:
Andrew Valko
02-18-2013 07:36 AM - edited 02-18-2013 07:37 AM
I was allways wondering what is that user LookUp good for 🙂
So I managed to do some extra 2 hours of work implementing that library
Thanks a lot !
Anyone reading this, keep in mind you have to put extra element in the array start as for the background !
02-18-2013 07:48 AM
Dear Bublina!
Thanks for posting your solution code! Best of luck with your application.
Cheers:
Andrew V.