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
[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));

Function Lowpass

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

matlab code

a = imread('penang.jpg')
f = rgb2gray(a);
k = imnoise(f,'gaussian')
noise = uint8(real(aflpi));

This is the image that i used. input image

And running the code, this is what I get.

enter image description here

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.

  • $\begingroup$ Can't you use Median filter? Its best for salt and pepper noise $\endgroup$ – Failed Scientist May 17 '16 at 0:23
  • $\begingroup$ Actually, very interesting result :-). $\endgroup$ – Royi May 17 '16 at 5:37
  • $\begingroup$ actually,my research is about using butterworth low pass filter to remove noise. So, i am trying to make some code of butterworth low pass filter to remove this type of noise. $\endgroup$ – user18199 May 18 '16 at 17:05
  • $\begingroup$ Why would you use such filter for Denoising of images? $\endgroup$ – David Jun 25 '19 at 20:37

First things first: If you use fftshift, you have to undo it before doing the ifft. Try


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

| improve this answer | |
  • $\begingroup$ i try using your suggestion but there is nothing come out. I put the code, then i use "imshow (aflpi)", only white output come out. Can you point out what is wrong with my code? $\endgroup$ – user18199 May 18 '16 at 17:07
  • $\begingroup$ Check your image. Is it really one value everywhere? Is imshow the problem, i.e. you tried imshow(..., []) or any boundary values instead of []? Have you tried to use abs() instead of real()? $\endgroup$ – M529 May 18 '16 at 18:24
  • $\begingroup$ Yes, use of fftshift in the middle there would explain the oscillating noise. $\endgroup$ – Peter K. May 18 '16 at 19:08
  • $\begingroup$ @PeterK. fftshift translates everything by N/2, which is a steep linear phase in the conjugated space. And since he is taking the real part, half of the signal is in the imaginary part. So I am quite certain that this is - at least one of - the problem(s). $\endgroup$ – M529 May 18 '16 at 21:02
  • $\begingroup$ @M529 : We are in violent agreement, then! $\endgroup$ – Peter K. May 18 '16 at 21:08

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.