I'd like to take an photograph, subdivide it into a tesselation, either of squares, or (ideally), hexagons, and then find the centre of gravity (or, if you prefer, centre of mass) of each cell of the tesselation.
The output, for any image, would be a matrix of points. For the attached diagram, something like this (in polar coordinates - $(r,\theta)$ ):
(5,5Π/4) (0,0) (1,7Π/4) (1,5Π/4) (5,3Π/4) (0,0) (5,Π/2) (0.0) (0,0) (0.0) (0,0)
I've attached an image showing what I mean.
My question, to put it simply, is the best method to use to calculate the cog, in this tessellation... For squares, it'd be easy to calculate the weighted mean for each row, but that would be too rough an approximation. What's a good way to iterate either a general tessellation (ideal), or an hexagonal one?