2D Digital Signal Processing - Applying High Pass on and Image I have been doing my research on 2D digital signal processing. What I am doing is about noise removal of digital image:

Type of noise that I want to remove from an images is like the Gaussian noise and 'salt and pepper'. For your information, I intend to use the butterworth lowpass filter to remove the noise. This is my code that I used in matlab.

Function Highpass

function [ out ] = butterhp( im,d,n )
%UNTITLED Summary of this function goes here
%   Detailed explanation goes here
h=size(im,1);
w=size(im,2);
[x,y]=meshgrid(-floor(w/2):floor(w-1)/2); -floor(h/2):floor(h-1)/2;
out= 1./(1.+(d./(x.^2+y.^2).^0.5).^(2*n));
 end


Function Lowpass

function [ out] = butterlp( im,d,n)
%UNTITLED Summary of this function goes here
%   Detailed explanation goes here
out=1-butterhp(im,d,n);
end


matlab code

a = imread('penang.jpg')
f = rgb2gray(a);
k = imnoise(f,'gaussian')
lp=butterlp(k,15,1);
af=fftshift(fft2(k));
aflp=af.*lp;
aflpi=ifft2(aflp)
noise = uint8(real(aflpi));
imshow(noise)


This is the image that i used.


And running the code, this is what I get.



So,my problem is when I try to filter it to make it looks more clear by adjusting the number of 'n-th order' and 'cutoff frequency', it seems it does not work. It still gives me blur picture just like that.
First things first: If you use fftshift, you have to undo it before doing the ifft. Try 

af=fftshift(fft2(k));
aflp=af.*lp;
aflpi=ifft2(ifftshift(aflp))


The result should improve, especially this checkerboard-overlay should go away.