Hi all,
According to the wikipedia page on image moments, central moments and raw moments are related as in this link: http://en.wikipedia.org/wiki/Image_moment#Central_moments
I’ve been trying to examine these relationships using the skimage.measure module.
I created an ellipse image as per the measure region properties example (http://scikit-image.org/docs/dev/auto_examples/plot_regionprops.html#example-plot-regionprops-py) and rotated it.
Then I ran the following script:
from skimage.measure import regionprops, moments, moments_central
from skimage.morphology import label
props = regionprops(image) # where `image` is the rotated ellipse
x_bar, y_bar = props.centroid
raw_moments = moments(image)
central_moments = moments_central(image, x_bar, y_bar)
Now according to the wikipedia page, central_moments[2,0] should be equal to:
raw_moments[2,0] - x_bar * raw_moments[1,0]
But that’s not working out. In fact, the value yielded by the above formula is much larger than what skimage says it should be.
What am I missing?
Thanks!