=1;Р h2=1+0.5;Р elseР h1=0;Р h2=0.5;Р endР g1(i,j)=h1*g(i,j);Р g2(i,j)=h2*g(i,j);Р endРendРg1=ifftshift(g1);Рg1=uint8(real(ifft2(g1)));Рsubplot(2,3,2);imshow(g1); %显示理想高通滤波结果Рxlabel('(b)显示理想高通滤波');Рg2=ifftshift(g2);Рg2=uint8(real(ifft2(g2)));Рsubplot(2,3,3);imshow(g2); %显示理想高通加强滤波结果Рxlabel('(c)显示理想高通加强滤波');Рn=2;Рd0=20;Рfor i=1:M %进行Butterworth高通滤波和Butterworth高通加强滤波Р for j=1:NР d=sqrt((i-n1)^2+(j-n2)^2);Р if d==0Р h1=0;Р h2=.5;Р elseР h1=1/(1+(d0/d)^(2*n));Р h2=1/(1+(d0/d)^(2*n))+0.5;Р endР gg1(i,j)=h1*g(i,j);Р gg2(i,j)=h2*g(i,j);Р endРendРgg1=ifftshift(gg1);Рgg1=uint8(real(ifft2(gg1)));Рsubplot(2,3,4);imshow(gg1); %显示Butterworth高通滤波Рxlabel('(d)Butterworth高通滤波');Рgg2=ifftshift(gg2);Рgg2=uint8(real(ifft2(gg2)));Рsubplot(2,3,5);imshow(gg2); %显示Butterworth高通加强滤波Рxlabel('(e)Butterworth高通加强滤波');