How to remove gaussian noise from an image in MATLAB?

shwartz picture shwartz · Dec 23, 2011 · Viewed 18.7k times · Source

I'm trying to remove a Gaussian noise from an image. I've added the noise myself using:

nImg = imnoise(img,'gaussian',0,0.01);

I now need to remove the noise using my own filter, or at least reduce it. In theory, as I understand, using a convolution matrix of ones(3)/9 should help and using a Gaussian convolution matrix like [1 2 1; 2 4 2; 1 2 1]/9 or fspecial('gaussian',3) should be better. Yet, they really don't do the trick so well: enter image description here

Am I missing something important? I need to use convolution, by the way.

Answer

Andrey Rubshtein picture Andrey Rubshtein · Dec 23, 2011

You are not missing anything! Obviously, you can't remove the noise completely. You can try different filters, but all of them will have a tradeoff:

More Noise + Less blur VS Less Noise + More blur

It becomes more obvious if you think of this in the following way:

Any convolution based method assumes that all of the neighbors have the same color.

But in real life, there are many objects in the image. Thus, when you apply the convolution you cause blur by mixing pixels from different adjacent objects.

There are more sophisticated denoising methods like:

  • Median denoising
  • Bilateral filter
  • Pattern matching based denoising

They are not using only convolution. By the way, even they can't do magic.