Hi please any one know how to calculate Hu's Moment Invariant to compare tow images Iuse this function but I don't know if it's true or no?? and thank you
2 views (last 30 days)
Show older comments
if true
function inv_moments = Hu_Moments(eta)
inv_moments(1) = eta(3,1) + eta(1,3);
inv_moments(2) = (eta(3,1) - eta(1,3))^2 + (4*eta(2,2)^2);
inv_moments(3) = (eta(4,1) - 3*eta(2,3))^2 + (3*eta(3,2) - eta(1,4))^2;
inv_moments(4) = (eta(4,1) + eta(2,3))^2 + (eta(3,1) + eta(1,4))^2;
inv_moments(5) = (eta(4,1) - 3*eta(2,3))*(eta(4,1) + eta(2,3))*((eta(4,1) + eta(2,3))^2 - 3*((eta(3,2) + eta(1,4))^2)) + (3*(eta(3,2) - eta(1,4)))*(eta(3,2) + eta(1,4))*(3*(eta(4,1) + eta(2,3))^2 - (eta(3,2) + eta(1,4))^2);
inv_moments(6) = (eta(3,1) - eta(1,3))*((eta(4,1)+eta(2,3))^2 - (eta(3,2)+ eta(1,4))^2) + 4*eta(2,2)*((eta(4,1) + eta(2,3))*(eta(3,2) + eta(1,4)));
inv_moments(7) = (3*eta(3,2) - eta(1,4))*(eta(4,1) + eta(2,3))*((eta(4,1) + eta(2,3))^2 - 3*(eta(3,2)-eta(1,4))^2) - (eta(4,1) - 3*eta(2,3))*(eta(3,2) + eta(1,4))*(3*(eta(4,1) + eta(2,3))^2 - (eta(3,2) + eta(1,4))^2);
M=[inv_moments(1) inv_moments(2) inv_moments(3) inv_moments(4) inv_moments(5) inv_moments(6) inv_moments(7)]';
end
0 Comments
Answers (1)
Image Analyst
on 30 Apr 2016
The University of Arizona has code. See link for their web site on their YouTube demo of Hu's image moments: http://www.youtube.com/watch?v=Nc06tlZAv_Q
2 Comments
Andres Morales
on 28 Dec 2022
I haven't been able to find the code in their website: http://www.loft.optics.arizona.edu/
I have downloaded their open-source program (SAGUARO), but haven't been able to find any mention of moments in their documentation/program.
See Also
Products
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!