Open In App

Noise addition using in-built Matlab function

Noise in an image: Digital images are prone to various types of noise that makes the quality of the images worst. Image noise is random variation of brightness or color information in the captured image. Noise is basically the degradation in image signal caused by external sources such as camera. Images containing multiplicative noise have the characteristic that the brighter the area the noisier it. But mostly it is additive. There are several ways to introduce noise into an image, depending on how the image is created. For example:

To simulate the effects of some of the problems listed above, the toolbox provides the in-built imnoise function in MATLAB, which you can use to add various types of noise to an image.



Various kind of noise that can be introduced by MATLAB inbuilt function are:

Below is the Matlab code for adding noise in an image:




% For adding various kind of noise
clear;
I = rgb2gray(imread("flowers.jpg"));
subplot(2, 2, 1),
imshow(I);
title("Original image");
  
% adding salt and pepper noise
s = imnoise(I, "salt & pepper", 0.20);
subplot(2, 2, 2),
imshow(s);
title("Salt and Pepper noise");
  
% adding Gaussian noise
g = imnoise(I, "gaussian", 0.20);
subplot(2, 2, 3),
imshow(g);
title("Gaussian noise");
  
% adding Speckle noise
sp = imnoise(I, "speckle", 0.20);
subplot(2, 2, 4),
imshow(sp);
title("Speckle noise");

Output :



Article Tags :