- % clear all;
- % tic
- % I=imread('finger.jpg');
- % I=I(:,:,1);
- % % I1=im2double(I(1:128,1:128));
- % % I2=im2double(I(31:158,31:158));
- % I1=I(1:128,1:128);
- % I2=I(51:178,51:178);
- % F1=fft2(I1);
- % F2=fft2(I2);
- % F2=conj(F2);
- % F=ifft2(F1.*F2/norm(F1.*F2));
- % F=abs(F);
- % F_max=max(max(F));
- % [m,n]=find(F==F_max)
- % figure,mesh(1:128,1:128,abs(F))
- % toc
- clear all;
- tic
- I1=imread('fingerprint1.bmp');
- I2=imread('fingerprint2.bmp');
- I3=I1(131:258,151:278);
- I4=I2(134:261,201:328);
- F1=fft2(I3);
- F2=fft2(I4);
- F2=conj(F2);
- F=ifft2(F1.*F2/norm(F1.*F2));
- F=abs(F);
- F_max=max(max(F));
- [m,n]=find(F==F_max)
- % figure,mesh(abs(F))
- [Height,Width]=size(I3);
- mos_Height=Height+m-1;
- mos_Width=Width+n-1;
- A=uint8(255*ones(mos_Height,mos_Width));
- for i=1:mos_Height
- if i<m
- for j=1:Width
- A(i,j)=I3(i,j);
- end
- elseif i>m-1&i<Height+1
- for j=1:mos_Width
- if j<n
- A(i,j)=I3(i,j);
- else
- A(i,j)=I4(i-m+1,j-n+1);
- end
- end
- else
- for j=n:mos_Width
- A(i,j)=I4(i-m+1,j-n+1);
- end
- end
- end
- imshow(A)
-
- toc
复制代码 |