Machine Vision

cancel
Showing results for 
Search instead for 
Did you mean: 

Is there a more robust imaq centroid alternative

Hello all,
 
I am seeking a more robust solution to imaq-centroid.  Currently I am trying to analyze a laser beam spot image as shown in the link.  The green box is the ROI, the red spot (next to the laser 2 label) is where centroid spits out its result, and the red spot is the ideal location.  In past implementations, the image was converted to an array, and then an external C code was called to do a gaussian peak fit, which sometimes failed to converge.  I am shamefully hoping for possibly (although not very likely) a solution implemented within the VISION suite that might perform similarly?
 
Thanks in advance!
Ming
0 Kudos
Message 1 of 6
(5,638 Views)
Dear Ming,

I would recommend using the Vision Assistant Express VI. With this VI, you can easily add some image processing before calculating the centroid, and I believe this will give you much more accurate results. Here is a summary of the steps I took in Vision Assistant:

1. Extract Luminance color plane (not needed if you already have a grayscale image)
2. Erode
3. Threshold
4. Particle Filter based on area
5. Centroid Calculation

See the attached picture for the results of this process on your sample image. I've attached the Vision Assistant 8.5 script that I used to process the image as well. Please let me know if you have a different version and I'll post again for that version.

Best Regards,

~Nate
________________________
Applications Engineer
 
Download All
0 Kudos
Message 2 of 6
(5,606 Views)

Hi,

LabView Vision module has IMAQ Centroid VI that calculates centroid - see attached picture 1. Centroid calculations are pretty sensitive to image noise and/or any thresholding operations performed on image. Special care shall be taken when applying any morphological/particle-based operations. Quite often these operations make image binary and all intensity information is lost. If Centroid VI is applied to that type of image, it will give GEOMETRICAL center of the spot (assuming uniform density), and not its actual intensity-weighted centroid.

Attached pictures 2 and 3 illustrate the situation. Image is sum of 2 gaussian functions separated by 100 pixels in X:

I(x,y) = 3*EXP(-( (x-x01)^2+(y-y01)^2 )/w1^2) + (EXP(-( (x-x02)^2+(y-y02)^2 )/w2^2) and scaled to Imax = 255 

  y01 = y02 = 0,  w1 = w2 =60,  x01 = -50,  x02 = +50

It's easy to show analytically that image centroid shall be located at (-25.0 = (3*-50 + 1*50)/4,   0.0) pixels.

Centroid VI applied to that image gives pretty close result of (-25.03, 0.0) and its location is indicated by Green circle.

When image is thresholded at 128, Centroid VI calculates wrong centroid location at (-43.02, 0.0) even when intensity values above threshold are kept same as in original image (see Picture 2). When intensity values above threshold are replaced by max=255, centroid location is calculated at (-42.20, 0.0) - see Picture 3. Wrong centroid location is maked by Red circle in both pictures.

Correct image centroid location is strongly effected by image tail and may be quite apart from the image brightest spot.

 

 

Download All
0 Kudos
Message 3 of 6
(5,588 Views)

Hi all

 

I am new to Labview and I am using it to do image recognition. I got that working but now my problem is that I need to get the centroid of the image that it had recognized. I understand that the image mask input on th IMAQ Centroid block provides a boundary search area to calculate the centroid. But I dont know how to connect it up. I need the centroid of the object that I had recognized.

 

Please if someone could attach an image on how to wire this block up it will be a major help for my mechatronics project or email it to me shiraubayd@gmail.com

 

Thank you in advance

 

0 Kudos
Message 4 of 6
(4,481 Views)

For help learning how to appropriately use a subVI I suggest using the Context Help (CTRL+H) which will give an overview of what the subVI does and what the inputs and outputs are. This works by hovering over the subVI in question. If you need additional help, follow the Detailed Help link that comes up in the Context Help. This will give more information about each input and how to use it.

 

If you have more questions I recommend creating a new thread on the Machine Vision Forum. This thread has not been posted on in 5 years. Newer threads with fewer posts will get more attention from other users.

Cameron T
Applications Engineer
National Instruments
0 Kudos
Message 5 of 6
(4,473 Views)

Thanks. I used all those help options that is why I am consulting the forum because I need an example of some sort maybe just on how to connect my image mask to create a defined area for labview to do the centroid calculation. I shall create a new thread.

 

Thank you.

0 Kudos
Message 6 of 6
(4,471 Views)