3. Noise in Images

Noise in images are generated mainly due to image sensor and sometimes during transferring or processing. Noise in image is a random variation of brightness or color information in to captured images. Image noise can vary from imperceptible specks on digital photograph taken in good light, to optical and radioastronomical images that are almost entirely noise, from which a small amount of information can be derived by sophisticated processing. Such a noise level would be unacceptable in a photograph since it would be impossible even to determine the subject. Mostly the noise in images are additive. In this lab we discuss three different types of noise in an image i.e, salt-and-pepper, Gaussian and speckle. Here we implement using Scikit-image toolbox using random_noise() function. This function returns a floating-point image data on the range of [0,1] or [-1, 1] depending whether the input image was unsigned or signed respectively.

Salt and Pepper Noise

Salt and pepper noise is a type of impulse noise. Salt noises are added to an image by adding bright pixels (255 value) randomly all over the image. Similarly, Pepper noise are added to an image by adding dark pixels (0 value) in random all over the image. Random addition of bright pixels and dark pixels to an image together is known as salt and pepper noise. Here we implement using random_noise() function with image and ‘amount’ as input parameters. ‘amount’ controls the proportion of image pixels to replace with noise on range between 0 and 1. Its default is set to 0.05.

import cv2
from skimage.util import random_noise

# Read the image
im = cv2.read("google_campus.jpg")
cv2.imshow("Original Image", im)

# Add Salt and Pepper Noise
noise_image = random_noise(im, mode='s&p', amount=0.1)
cv2.imshow("Noise Image with amount=0.1", noise_image)
cv2.waitKey(0)

The output looks like this

Addition of two images

For different amount values

Addition of two images

Gaussian Noise

Gaussian Noise is a statistical noise with probability density function equal to Gaussian distribution/Normal distribution. This means that the noise values are normally distributed.

The probability density function p of Gaussian random variable z is given by

$$p_{G}(z)={\frac {1}{\sigma {\sqrt {2\pi }}}}e^{{-{\frac {(z-\mu )^{2}}{2\sigma ^{2}}}}}$$

where z represents the grey level, $\mu$ represents the mean gray value and $\sigma$ its standard deviation.

In order to generate noise, random Gaussian function is added to image. The magnitude or amount of Gaussian noise depends on the standard deviation ($\sigma$). The value of standard deviation ($\sigma$) is directly proportional to magnitude of Gaussian noise.

import cv2
from skimage.util import random_noise

# Read the image
im = cv2.read("google_campus.jpg")
cv2.imshow("Original Image", im)

# Add Salt and Pepper Noise
noise_image = random_noise(im, mode='gaussian', mean=0, var=0.01)
cv2.imshow("Noise Image with mean=0 and sigma=0.01", noise_image)
cv2.waitKey(0)

The output looks like this

Addition of two images

For different mean and standard deviation values

Addition of two images

Speckle Noise

Speckle noise is generated during image reconstruction process - a fundamental problem in optical and digital holography. It is a granular noise which inherently exists in an image and results in poor quality images. Speckle noise can be generated by multiplying random pixel values with different pixels of an image.

out = image + n*image, where ‘n’ is uniform noise with specified mean & variance.

import cv2
from skimage.util import random_noise

# Read the image
im = cv2.read("google_campus.jpg")
cv2.imshow("Original Image", im)

# Add Salt and Pepper Noise
noise_image = random_noise(im, mode='speckle', mean=0, var=0.01)
cv2.imshow("Noise Image with mean=0 and sigma=0.01", noise_image)
cv2.waitKey(0)

The output looks like this

Addition of two images

For different mean and standard deviation values

Addition of two images

Students are highly encouraged to not use the skimage library and try to write from scratch with the theoretical understanding of noise concepts. For reference please go through this url, this will help to better understand.

Previous
Next