You are on page 1of 5

Noise

We may define noise to be any degradation in the image signal, caused by external disturbance. If an image is being sent electronically from one place to another, via satellite or wireless transmission, or through networked cable, we may expect errors to occur in the image signal. These errors will appear on the image output in different ways depending on the type of disturbance in the signal. Usually we know what type of errors to expect, and hence the type of noise on the image; hence we can choose the most appropriate method for reducing the effects. Cleaning an image corrupted by noise is thus an important area of image restoration.

Types of noise
We will look at four different noise types, and how they appear on an image. 'gaussian' Gaussian white noise with constant mean and variance 'poisson' Poisson noise using the Poisson Distribution probability. 'salt & pepper' 'speckle' Multiplicative noise We shall be using the built-in imnoise function to add noise into an Image as well as the manual process to apply noise using the Algorithm used by Matlab.

Poisson Noise:
Generates Poisson noise from the data instead of adding artificial noise to the data. In order to respect Poisson statistics, the intensities of uint8 and uint16 images must correspond to the number of photons (or any other quanta of information). Double-precision images are used when the number of photons per pixel can be much larger than 65535 (but less than 10^12); the intensities values vary between 0 and 1 and correspond to the number of photons divided by 10^12.
By Sufiyan Ghori

Matlabs Algorithm:
Adding Poisson Noise into an Image using imnoise

I = imread('2.jpg'); J = rgb2gray(I); J = IMNOISE(J,'poisson')


Adding Poisson Noise Manually

I = imread('2.jpg'); a = rgb2gray(I); a = im2double(a); sizeA = size(a); % Matrix in MxN form a = a(:); b=zeros(size(a)); idx1=find(a<50); % Matrix Positions whose pixels intensities are

less than 50

t=ones(size(idx1)); % Matrix having all ones, the size is equal to idx size em=-ones(size(idx1)); %Matrix having all -ones, the size is equal to idx size idx2= (1:length(idx1))'; % Put values in idx2 equal to length of idx1 if (~isempty(idx1)) % if such pixels exists then g=exp(-a(idx1)); % take Exponential of the values at those pixel positions while ~isempty(idx2) em(idx2)=em(idx2)+1; t(idx2)=t(idx2).*rand(size(idx2)); idx2 = idx2(t(idx2) > g(idx2)); end b(idx1)=em; end idx1=find(a>=50); % Cases where pixel intensities are more than 49 units if (~isempty(idx1)) b(idx1)=round(a(idx1)+sqrt(a(idx1)).*randn(size(idx1))); end b = reshape(b,sizeA); imshow(b)
By Sufiyan Ghori

Salt and pepper noise: Also called impulse noise, shot noise, or binary noise. This degradation can be caused by sharp, sudden disturbances in the image signal; its appearance is randomly scattered white or black (or both) pixels over the image. Matlabs Algorithm:

Adding Salt n Pepper Noise into an Image using imnoise

I = imread('2.jpg'); J = rgb2gray(I); K = IMNOISE(J,'salt & pepper',0.05); figure, imshow(J), figure, imshow(K)


MANUAL Addition OF Salt n Pepper Noise

% p3 = density I = imread('2.jpg'); J = rgb2gray(I); p3= 0.05; x = rand(size(J)); d = find(x < p3/2); J(d) = 0; % Minimum value d = find(x >= p3/2 & x < p3); J(d) = 255; % Maximum (saturated) value imshow(J)

By Sufiyan Ghori

Gaussian Noise: Gaussian noise is an idealized form of white noise, which is caused by random fluctuations in the signal. We can observe white noise by watching a television which is slightly mistuned to a particular channel. Gaussian noise is white noise which is normally distributed. The effect can again be demonstrated by the imnoise function. Matlabs Algorithm: b = a + sqrt(p4)*randn(sizeA) + p3;
% ADDING GAUSSIAN NOISE INTO AN IMAGE USING IMNOISE

I = imread('2.jpg'); J = rgb2gray(I); K = imnoise(J,'gaussian', 0.05); figure, imshow(J), figure, imshow(K)


% MANUAL ADDITION OF GAUSSIAN NOISE % % p3 p4 mean variance

I = imread('2.jpg'); J = rgb2gray(I); p3= 0; p4 = 0.05; J = im2double(J); b = J + sqrt(p4)*randn(size(J)) + p3; imshow(b)

By Sufiyan Ghori

Speckle Noise: Whereas Gaussian noise can be modeled by random values added to an image; speckle noise (or more simply just speckle) can be modeled by random values multiplied by pixel values, hence it is also called multiplicative noise. Speckle noise is a major problem in some radar applications. As above, imnoise can do speckle, Matlabs Algorithm:
% MANUAL ADDITION OF SPECKLE NOISE

p3 = variance

I = imread('2.jpg'); J = rgb2gray(I); p3= 0.05; J = im2double(J); b = J + sqrt(12*p3)*J.*(rand(size(J))-.5); imshow(b)


% ADDING SPECKE NOISE AUTOMATICALLY

I = imread('2.jpg'); J = rgb2gray(I); K = imnoise(J,'speckle', 0.5); figure, imshow(J), figure, imshow(K)

*While using imnoise function the affecting image must be placed in work directory of a Matlab. Or get the user to select the file to be read using uigetfile function as following, >> [fn,pn]=uigetfile({'*.TIFF,*.jpg,*.bmp','Image files'}, 'Select image'); >> I = imread(fullfile(pn,fn)); *fn = file name , pn = path name

By Sufiyan Ghori