[Solved] Transformation with High Pass Filter [closed]


n1=rgb2gray(imread('fin.jpg'));
imshow(n1);

F=fft2(double(n1));

%Calculate Size of Image

[M,N]=size(F);

%Distance Radius Size

D0=50;
n=2;
u=0:(M-1);
v=0:(N-1);
idx=find(u>M/2);
u(idx)=u(idx)-M;
idy=find(v>N/2);
v(idy)=v(idy)-N;
[V,U]=meshgrid(v,u);

%Distance Calculation for High Pass Filter using Distance Formula

D=sqrt(U.^2+V.^2);

H=double(D>D0);
subplot(2,1,1);
imshow(fftshift(H));
G=H.*F;
g=real(ifft2(double(G)));
[a,b]=size(g);
for x=1:a
    for y=1:b
        sharpen_image(x,y)=(g(x,y))*(-1)^((x)+(y));
    end
end
figure
imshow(sharpen_image);

OUTPUT

enter image description here

solved Transformation with High Pass Filter [closed]