Professional Documents
Culture Documents
Original Image
3. TYPES OF NOISE
Different noise will affect the image to an entirely different extent. In the report, only the most common noises will be
taken into consideration.
• Gaussian Noise
• Poisson Noise
• Salt & pepper Noise (Impulse Noise)
• Speckle Noise
Above listed are not all the noises, but these noises are the most common ones.
3.1 Gaussian Noise
Gaussian noise is a noise having a pdf that of the Normal distribution. It is a type of additive noise as each pixel is
changed such that a specific distribution is added to every pixel. The most commonly seen is the Gaussian distribution. It
is caused because of inefficient lighting while capturing the picture or high temperatures. The pdf is given by the formula
b) Wiener filter
The Wiener filter is an adaptive kind of filter for processing signals. When the variance is small, wiener performs better
blurring, and when the variance is high, Weiner shows little blurring. The Wiener filter is typically more selective than the
average filter as it retains edges and high-frequency elements of a picture as well.
Wiener Filter in the Fourier Domain;
c) Median filter
The median filter is a non-linear filter that replaces the intensity level by the median of the intensity values of pixels in a
neighborhood. The Median filter is famous for denoising without smoothing edges of the image. Its edge saving nature
makes it quite useful. This filter reduces the intensity variation between pixels of an image. In this filter, the pixel value of
the image is replaced with the median value. Intensities of the neighboring pixels are arranged in the ascending order,
and the =n median is calculated by picking up the middle element.
𝑓𝑓^(𝑥𝑥,𝑦𝑦) = 𝑚𝑚𝑚𝑚𝑚𝑚𝑚𝑚𝑚𝑚𝑚𝑚{𝑔𝑔(𝑠𝑠,𝑡𝑡)} 𝑤𝑤ℎ𝑒𝑒𝑒𝑒𝑒𝑒 (𝑠𝑠,𝑡𝑡) ∈ 𝑆𝑆𝑆𝑆𝑆𝑆
5. Performance Parameters:
a) Mean Square Error (MSE)
The MSE is the cumulative square error between the processed image and the original image. It is defined by:
Where f is the original image, and g is the processed image. The dimension of the image is m X n. Thus, MSE should be as
low as possible for higher effectiveness.
b) Peak Signal to Noise ratio or PSNR
PSNR is the ratio between the maximum possible intensity of a signal and the power of distorting noise, which affects the
quality of its representation. The following formula defines it:
6. Results
PSNR and MSE value for gaussian noise
Filtering Technique PSNR MSE
Distorted img 23.51966448 0.00444665
Mean 26.96109534 0.00201321
Median 27.39441356 0.00182204
Wiener 24.10291577 0.00388784
PROCESSED IMAGES AND PYTHON CODE FOR THE SAME ARE AT THE END OF THE REPORT.
7. Conclusion
Denoising of a noisy digital image is a critical task in image processing. So, a known artificial noise is added to the picture
just to understand the algorithms of denoising and their effectiveness. In this report, we have discussed different types
of noises in images during image acquisition or transmission arising due to various limitations. We have also discussed
the causes of the common noises and their primary sources. We have also discussed different commonly used filtering
methods that can be used to filter the images. Major conclusions;
• After observing the PSNR and MSE values, We can say that the median filter works better in denoising the
image in all the noise models.
• We also find that the Median filter filters noticeably well for S&P noise and Gaussian noise.
• Since the Wiener Filter preserves edges from different angles, hence, it can be used for restoring the blurred
image.
•
APPLYING DIFFERENT FILTERS ON GAUSSIAN NOISE
import numpy as np
from skimage import filters
from skimage import restoration
import matplotlib.pyplot as plt
import cv2
import random
def rgb2gray(rgb):
return np.dot(rgb[...,:3], [0.333, 0.333, 0.333])
def noisy(noise_typ,image):
if noise_typ == "gauss":
row,col= image.shape
mean = 0
var = 0.003
sigma = var**0.5
gauss = np.random.normal(mean,sigma,(row,col))
gauss = gauss.reshape(row,col)
noisy = image + gauss
return noisy
elif noise_typ == "s&p":
row,col = image.shape
s_vs_p = 0.5
amount = 0.006
out = np.copy(image)
# Salt mode
num_salt = np.ceil(amount * image.size * s_vs_p)
coords = [np.random.randint(0, i - 1, int(num_salt))
for i in image.shape]
out[coords] = 1
# Pepper mode
num_pepper = np.ceil(amount* image.size * (1. - s_vs_p))
coords = [np.random.randint(0, i - 1, int(num_pepper))
for i in image.shape]
out[coords] = 0
return out
elif noise_typ == "poisson":
vals = len(np.unique(image))
vals = 1.5**np.ceil(np.log2(vals))
noisy = np.random.poisson(image * vals) / float(vals)
return noisy
elif noise_typ =="speckle":
row,col = image.shape
gauss = 0.1*np.random.randn(row,col)
gauss = gauss.reshape(row,col)
noisy = image + image * gauss
return noisy
selem=np.ones((3,3))
#denoised = filters.median(noisy, selem)
denoised = filters.rank.mean(noisy, selem)
plt.show()
REFERENCES
• Digital Image Processing 4th Edition by Rafael C. Gonzalez Richard E. Woods
• https://www.tutorialspoint.com/image-processing-in-python
• Dr. Philippe Cattin (2012-04-24). "Image Restoration: Introduction to Signal and Image
Processing". MIAC, University of Basel.
• https://stackabuse.com/introduction-to-image-processing-in-python-with-opencv/