www.pudn.com > P-zernike.zip > P_zernike_demos.m, change:2012-04-06,size:1159b


clear 
echo off 
As=10000; 
n=0:9;%n=0:9,55; 
Na=16; 
zernike_D=zeros(Na,10); 
figure; 
for i = 1:Na 
     s=num2str(eval('i')); 
    fn=[s,'.bmp']; 
    Im=imread(fn); 
    [rr,ss]=size(Im); 
    m000 = w_imgmoments(Im, 0, 0) ; 
    m100 = w_imgmoments(Im, 1, 0) ; 
    m010 = w_imgmoments(Im, 0, 1) ; 
    Xco=(ss+1)/2; 
    Yco=(rr+1)/2; 
    cofx =Xco- m100/m000 ; 
    cofy =Yco- m010/m000 ; 
    I1=w_imgshift(Im,cofx,cofy); 
    F1=I1(:); 
    Am=sum(F1); 
    cc=fix(rr/sqrt(Am/As));   
    dd=fix(ss/sqrt(Am/As)); 
    I2=imresize(I1,[cc,dd]); 
 
    F=I2(:); 
    m00=sum(F); 
    iimg=invariant(I2,'m00 -translation 0'); 
    [A_nm,zmlist,cidx,V_nm] = P_zernike(iimg,n); 
    zernike_abs(i,:)=abs(A_nm/m00) 
%    subplot(4,4,i),plot(zernike_abs(i,:),'m-'); 
end 
 
for i=1:Na 
zernike_D(i,1)=zernike_abs(i,4); 
zernike_D(i,2)=zernike_abs(i,8); 
%13, 
zernike_D(i,3)=zernike_abs(i,19); 
zernike_D(i,4)=zernike_abs(i,23); 
zernike_D(i,5)=zernike_abs(i,32); 
zernike_D(i,6)=zernike_abs(i,34); 
zernike_D(i,7)=zernike_abs(i,41); 
zernike_D(i,8)=zernike_abs(i,42); 
zernike_D(i,9)=zernike_abs(i,50); 
zernike_D(i,10)=zernike_abs(i,52); 
end 
zernike_D