**Poisson Noise:**

**Matlab’s 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)

**Salt and pepper noise:**

**Matlab’s 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)

**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.

**Matlab’s 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 mean
% p4 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)

**Speckle Noise:**

**Matlab’s 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)

### Like this:

Like Loading...