File Exchange

image thumbnail

Hu Moments of order 3

version 1.0.0.0 (1.95 KB) by Ishrat Badami
Calculates first 8 moments of order 3 of an image.

5 Downloads

Updated 10 Mar 2012

View License

It takes gray image as an input and outputs vector of first 8 hu moments of order 3

Cite As

Ishrat Badami (2019). Hu Moments of order 3 (https://www.mathworks.com/matlabcentral/fileexchange/35552-hu-moments-of-order-3), MATLAB Central File Exchange. Retrieved .

Comments and Ratings (7)

Needs updating to fix errors. I think 3 or 4 have mistakes

Fixed versions I believe:

I_one = mu_20 + mu_02;
I_two = (mu_20 - mu_02)^2 + 4*mu_11^2;
I_three = (mu_30 - 3*mu_12)^2 + (3*mu_21 - mu_03)^2;
I_four = (mu_30 + mu_12)^2 + (mu_21 + mu_03)^2;
I_five = (mu_30 - 3*mu_12)*(mu_30 + mu_12)*((mu_30 + mu_12)^2 - 3*(mu_21 + mu_03)^2) + (3*mu_21 - mu_03)*(mu_21 + mu_03)*(3*(mu_30 + mu_12)^2 - (mu_21 + mu_03)^2);
I_six = (mu_20 - mu_02)*((mu_30 + mu_12)^2 - (mu_21 + mu_03)^2) + 4*mu_11*(mu_30 + mu_12)*(mu_21 + mu_03);
I_seven = (3*mu_21 - mu_03)*(mu_30 + mu_12)*((mu_30 + mu_12)^2 - 3*(mu_21 + mu_03)^2) - (mu_30 - 3*mu_12)*(mu_21 + mu_03)*(3*(mu_30 + mu_12)^2 - (mu_21 + mu_03)^2);
I_eight = mu_11*((mu_30 + mu_12)^2 - (mu_03 + mu_21)^2) - (mu_20 - mu_02)*(mu_30 + mu_12)*(mu_21 + mu_03);

Also you forgot parenthesis in I_eight. It should be
I_eight = mu_11*((mu_30 + mu_12)^2 - (mu_03 + mu_21)^2) - (mu_20 - mu_02)*(mu_30 + mu_12)*(mu_21 + mu_03);

Thanks for sharing!

dd

Also I_six should have a mu_11 term after the 4* term.

It looks like you forgot to square mu_11 in your implementation. For I_two it should be 4*mu_11^2

MATLAB Release Compatibility
Created with R2011b
Compatible with any release
Platform Compatibility
Windows macOS Linux