Machine Vision

cancel
Showing results for 
Search instead for 
Did you mean: 

How to detect multiple laser spots on image

Solved!
Go to solution

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.

0 Kudos
Message 1 of 7
(4,603 Views)

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.

Randall Pursley
0 Kudos
Message 2 of 7
(4,596 Views)

@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.

0 Kudos
Message 3 of 7
(4,587 Views)
Solution
Accepted by topic author A.Low

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

Bruce Ammons
Ammons Engineering
0 Kudos
Message 4 of 7
(4,581 Views)

 


@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?

 

0 Kudos
Message 5 of 7
(4,579 Views)

Look for particle analysis.

 

Bruce

Bruce Ammons
Ammons Engineering
0 Kudos
Message 6 of 7
(4,575 Views)

@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.

0 Kudos
Message 7 of 7
(4,570 Views)