1 | initial version |
You could compute all individual moments for each contour and then average them, but this wouldn't be the true moment-value. I'd have done it the same way you did, i.e. merging all contours and then computing the moments. Of course these moments (achieved from contours of certain areas) differ to the moments of the complete areas (once you just regard the borders and once the whole areas).
So, I guess it all depends on your purpose: For what do you need the complete image moments? Maybe you actually want the individual moments for features?