Question
How are centroids calculated?
Answer
Sensor Model | G2xxx, G3xxx |
Firmware Version | 3.x, 4.x |
SDK Version | n/a |
Centroid 2D returns (X,Y), where X is the average of the X positions of all the points in the region of interest (ROI) and Y is the average of the Y positions of all the points in the ROI.
Centroid 3D returns (X,Y) where X is the Z-weighted average of the X positions of all the points in the ROI and Y is the Z-weighted average of the Y positions of all the points in the ROI (weighted arithmetic mean, where the weights are the Z values; see http://en.wikipedia.org/wiki/Weighted_arithmetic_mean.)
This means that the 3D centroid is shifted toward the point where the target is the "highest" (i.e., highest Z value).
Here is a simple example. Let's say you have a profile with 4 points in (X, Z)-coordinates (like in Gocator's Profile Mode) and those points are (1,1), (2,2), (3,3), and (4,4).
Then the 2D centroid is (X1 + X2 + X3 + X4) / 4 = (1 + 2 + 3 + 4) / 4 = 2.5.
And the 3D centroid is (X1*Z1 + X2*Z2 + X3*Z3 + X4*Z4) / (Z1 + Z2 + Z3 + Z4) = (1*1 + 2*2 + 3*3 + 4*4) / (1 + 2 + 3 + 4) = 3.
Comments
0 comments
Please sign in to leave a comment.