invmoments.m
上传用户:zslfgd
上传日期:2010-04-06
资源大小:115k
文件大小:1k
- %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
- %% %%
- %% Prof. Sclaroff's CS585 Image avd Video Processing %%
- %% Project ONE %%
- %% C H A R A C T E R R E C O G N I T I O N %%
- %% %%
- %% by Stanislav Rost %%
- %% ID: 31764117 %%
- %% %%
- %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
- function mvec = invmoments(matrix)
- % INVMOMENTS.M
- %
- % function [ m1, m2, m3 ] = invmoments(matrix)
- %
- % Returns 2 invariant moments for matrix "matrix"
- %
- [ h w ] = size(matrix);
- nc20 = ncmoment(2,0,matrix,w,h);
- nc02 = ncmoment(0,2,matrix,w,h);
- nc30 = ncmoment(3,0,matrix,w,h);
- nc03 = ncmoment(0,3,matrix,w,h);
- nc12 = ncmoment(1,2,matrix,w,h);
- nc21 = ncmoment(2,1,matrix,w,h);
- nc11 = ncmoment(1,1,matrix,w,h);
- mvec(1) = nc20 + nc02;
- mvec(2) = (nc20 - nc02)^2 + 4*nc11^2;
- mvec(3) = ( nc30 - 3 * nc12 ) ^2 + (3 * nc21 - nc03 ) ^2;