The problem is that I need a simplified version of algorithm, which can calculate centroid of several white contours in a binary image. For example, if there is only one white contour, coordinates Xc and Yc of the contour center are calculated using formula:
where M is the sum of intense m_i, m_i is the pixel intense value, x_i and y_i are pixel location on the image, n is the total number of pixels.
Can anyone suggest something similar to work with several contours, or how to ignore others while calculating one of them using same formula?
M
probably is defined as the total weight. (I was confusing it withn
.) – Geoff