04-18-2012 04:10 AM - edited 04-18-2012 04:11 AM
Consider I have a dark image with several bright laser spots. I'd like to detect the centroid of each laser spot and return the coordinates of each spot.
Currently, I managed to detect a single spot by grabbing an image, setting the threshold (IMAQ Threshold) and finding the centroid (IMAQ Centroid).
However, when I have multiple bright spots, this method gives me the centroid of all spots combined. What technique should I use to detect each individual laser's centroid?
Thanks in advance.
Solved! Go to Solution.
04-18-2012 09:48 AM - edited 04-18-2012 09:49 AM
I have a similar application and I do the following
1. Thresholding
2. Circle Detection to identify the individual centers of the thresholded spots
3. Use the center point as a reference to extract subimages that encompass each spot
4. Process each individually (IMAQ Centroid for you)
My spots have a gaussian shape so I actually use the Optimization functions to do a 2D gaussian approximation, but your laser spots are probably saturated.
04-18-2012 09:03 PM - edited 04-18-2012 09:11 PM
@rpursley8 wrote:
I have a similar application and I do the following
1. Thresholding
2. Circle Detection to identify the individual centers of the thresholded spots
3. Use the center point as a reference to extract subimages that encompass each spot
4. Process each individually (IMAQ Centroid for you)
My spots have a gaussian shape so I actually use the Optimization functions to do a 2D gaussian approximation, but your laser spots are probably saturated.
Hi,
I suppose by Circle Detection, you meant using IMAQ Find Circles?
I'm not too sure why, but there are too many false detection even when there is only one single laser spot. Increasing the Min Radius doesn't help either. It seems that IMAQ Find Circles cannot be used to detect laser spots.
Furthermore, it slows down my acquisition from 15fps to around 1fps.
04-18-2012 10:21 PM
Try using blob analysis. Do a quick threshold, which should give you a spot for each laser. Use blob analysis to get the center of each blob. Use the centroid function to locate the exact centroid, if the blob center is not good enough.
You should be able to save some time by storing the previous values of the centroids. Unless the lasers are moving very quickly, their new locations should be close to their old locations.
If this is still too slow, figure out which part is taking the most time. If it is the centroid, I may be able to suggest some other ideas.
Bruce
04-18-2012 10:22 PM
@BruceAmmons wrote:
Try using blob analysis. Do a quick threshold, which should give you a spot for each laser. Use blob analysis to get the center of each blob. Use the centroid function to locate the exact centroid, if the blob center is not good enough.
You should be able to save some time by storing the previous values of the centroids. Unless the lasers are moving very quickly, their new locations should be close to their old locations.
If this is still too slow, figure out which part is taking the most time. If it is the centroid, I may be able to suggest some other ideas.
Bruce
Hi Bruce,
Where can i find Blob Analysis?
04-18-2012 11:00 PM
Look for particle analysis.
Bruce
04-19-2012 02:42 AM
@BruceAmmons wrote:
Look for particle analysis.
Bruce
Okay VI is currently working now.
1. Threshold
2. Particle Analysis (centre of mass x and centre of mass y output is exactly what i need)
Thank you very much.