Gaussian filter
Noise is a parasite that randomly presents in the image for physical (brightness, noise in hardware, sensor temperature, etc.) or digital (during image processing) reasons.
The Gaussian filter is a filter well known in the field of image processing which makes it possible to eliminate noise from a noisy image. It is based on a mathematical function g(x), which is frequently employed in statistical distributions.
In the case of a two-dimensional picture, x, and y:
With σ: standard derivation: presents the Gaussian bell width.- Sigma <1 is used to reduce noise in an image
- Sigma> 1 is used to make an image for use in the unsharp mask.
Implementation Using Python
In this part, we show how to apply a Gaussian filter to a noisy image using a basic demonstration, altering the radius value each time.
Steps
- The first step is to import the libraries to use;
from PIL import Image
from PIL import ImageFilter
from PIL import ImageFilter
- The next step is to import the images;
img1=Image.open("lena_original.png")
img2=Image.open("lena_bruit_gaussien.png")
img1.show()
img2.show()
- The last step is to apply the gaussian filter on the images using different threshold.
#--------------------------------- filtre gaussien------------------
img2.filter(ImageFilter.GaussianBlur(radius=2)).show()
img2.filter(ImageFilter.GaussianBlur(radius=3)).show()
img2.filter(ImageFilter.GaussianBlur(radius=4)).show()
0 Comments: