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:
Am I missing something important? I need to use convolution, by the way.
Removing Gaussian noise involves smoothing the inside distinct region of an image. For this classical linear filters such as the Gaussian filter reduces noise efficiently but blur the edges significantly.
The Median filter is a nonlinear digital filtering technique, often used to remove noise.
Use the Median Filter block to eliminate the black and white speckles in the image. Use the default parameters. The Median Filter block replaces the central value of the 3-by-3 neighborhood with the median value of the neighborhood. This process removes the noise in the image.
Description. y = awgn( x , snr ) adds white Gaussian noise to the vector signal x . This syntax assumes that the power of x is 0 dBW.
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:
They are not using only convolution. By the way, even they can't do magic.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With