How do I calculate the centroid of a distribution of light?

Hi All,

I have a 2 dimensional (X,Y) array of data points (pixels) that represent brightness in a star field. For any given star field I need to be able to pinpoint the center of the distribution of light.

I've found many algorithms regarding the centroid of geometric objects, but I can find none that relate to the distribution of light.

Does anyone know of an algorithm for such a calculation? FYI, I will be implementing this into a computer program so pseudo-code would be just fine.

Best regards.