Hi, instead of:
x_bar, y_bar = props.centroid
it must be:
y_bar, x_bar = props.centroid
Hope that helps? Johannes Am 06.01.2014 um 13:11 schrieb Jaidev Deshpande <deshpande.jaidev@gmail.com>:
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...) 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!
-- JD
-- You received this message because you are subscribed to the Google Groups "scikit-image" group. To unsubscribe from this group and stop receiving emails from it, send an email to scikit-image+unsubscribe@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.