Closed nartmal closed 9 years ago
Thank you. This is a good catch.
To summarize my current thinking: You have caught a good bug, but the solution is slightly different. I will use a different fix.
Thank you.
Sorry, there is a mismatch here. because p goes from 0..c, it should be p - cm[1].
I think there is no mismatch since the number of elements in a row is equivalent to the number of columns in a matrix. The number of elements in a column of the matrix is equivalent to r. If else, your matrix multiplication sizes will be invalid.
(Img_ij * (p - cm[0]))**p0
but 'cm[1]' is the centre of mass coordinate in the index-1 direction. It may even be greater than 'c'.
I think the fix is to change the next line to raise it to 'p1' instead of 'p0'.
When its first order and you are trying to calculate central moments:
\sum_{ij} { img[i,j](i - c0)_p0 } = dot(img, (p - cm[0]) _ p0)
not p1 as stated in code (I'm still very new to Image Processing so I may be mistaken)
As proposed, I was able to get First order central moments to be near zero while I wasn't able to do so the way you have it. I can send you the snippet of code i isolated and some sample image runs and their results if you want.