F=fft2(f,256,256); %零填充为256×256矩阵
figure,imshow(log(abs(F)),[-1 5],'notruesize');colormap(jet);
F2= fftshift(log(1+abs(F))); %将图像频谱中心由矩阵原点移至矩阵中心 figure,imshow(log(abs(F2)),[-1 5],'notruesize');colormap(jet);
D) 利用傅立叶变换分析两幅图像的相关性,定位图像特征。读入图像‘eurotext.tif’,
抽取其中的字母‘a’。 bw=imread('eurotext.tif'); a=bw(177:203, 424:444); imshow(bw);
figure,imshow(a);
C=real(ifft2(fft2(bw).*fft2(rot90(a,2), 800,1024)));%求相关性 figure,imshow(C,[]);
thresh=max(C(:));
figure,imshow(C>thresh-10)
figure,imshow(C>thresh-15)