Machine Vision

cancel
Showing results for 
Search instead for 
Did you mean: 

Why is the centroid calculating incorrectly?

Solved!
Go to solution

I have an image which is a signed int16 with no mask hooked up (externally masked). The IMAQ centroid vi is reporting the center of the ROI instead of providing the answer to the centroid. Why is it doing this?

0 Kudos
Message 1 of 5
(6,034 Views)

Unable to reproduce - seems to be works as expected:

 

07-01-2014 00-13-46 centroid.png

Andrey.

0 Kudos
Message 2 of 5
(6,022 Views)

You have a perfect image. The centroid calculation works perfectly with a simulated Guassian beam. It is when a real image from a camera is used that the centroid is calculated incorrectly. Turns out that it is not the ROI, but happened to be the ROI the one time I showed it to someone else.

0 Kudos
Message 3 of 5
(5,992 Views)
Solution
Accepted by Steve_Block

@Steve_Block wrote:

You have a perfect image. The centroid calculation works perfectly with a simulated Guassian beam. It is when a real image from a camera is used that the centroid is calculated incorrectly...


In general Centroid is pretty simple and straight forward operation - this should be independent from the image's content.

 

If you get feeling that in some cases this computes incorrectly, then you can compute it with pure LabVIEW primitives something like that:

07-01-2014 17-23-46 centr 4.png

In comparison with IMAQ this will be a bit slow, but you will check that IMAQ centroid calculated correctly or not for your images.

 

Andrey.

0 Kudos
Message 4 of 5
(5,978 Views)

I can believe the this a little more. I was concerned about something like overflow or truncation altering the results.

0 Kudos
Message 5 of 5
(5,960 Views)