The Wayback Machine - https://web.archive.org/web/20240723002157/https://www.geeksforgeeks.org/noise-addition-using-in-built-matlab-function/
Open In App

Noise addition using in-built Matlab function

Last Updated : 17 Aug, 2020
Comments
Improve
Suggest changes
Like Article
Like
Save
Share
Report

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:

  • If the image is scanned from a photograph made on film, the film grain can be the source of noise. Noise can also be the result of damage to the film, or be introduced by the scanner fluctuations itself.
  • If the image is acquired directly in digital format, the mechanism for gathering the data (such as a CCD detector) can introduce noise.
  • Electronic transmission of digital image data can also introduce noise.

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:

  • Salt and Pepper noise: Salt and pepper noise refers to a wide variety of processes that result in the image degradation. In Salt and Pepper noise only few pixels are noisy, but they are very noisy. The effect is similar to sprinkling white and black dots on the image.
    X = imnoise(Image, 'salt & pepper', percentage_distortion)

    Above in-built function adds “salt and pepper” noise to an image named Image, where percentage_distortion is the noise density. The default for percentage_distortion is 0.05.

  • Gaussian noise: Gaussian Noise is a statistical noise having a probability density function equal to normal distribution, also known as Gaussian Distribution. It is also called electronic noise because it arises in amplifiers or detectors.
    X = imnoise(Image, 'gaussian', percentage_distortion)
  • Speckle noise: Speckle is a noise that inherently exists in an image and degrades its quality. Speckle noise can be generated by multiplying random pixel values with different pixels of an image.
    X = imnoise(Image, 'speckle', percentage_distortion)

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 :


Previous Article
Next Article

Similar Reads

How to add White Gaussian Noise to Signal using MATLAB ?
In this article, we are going to discuss the addition of "White Gaussian Noise" to signals like sine, cosine, and square wave using MATLAB. The white Gaussian noise can be added to the signals using MATLAB/GNU-Octave inbuilt function awgn(). Here, "AWGN" stands for "Additive White Gaussian Noise". AWGN is a very basic noise model commonly used in t
4 min read
Estimation of gaussian noise in noisy image using MATLAB
Noise is something that is unwanted and makes it difficult to observe the details in the image. Image noise is a random variation of brightness or color information in images and is usually an aspect of electronic noise. It can be produced by the image sensor and circuitry of a scanner or digital camera. An undesirable electrical fluctuation is als
5 min read
How to Remove Salt and Pepper Noise from Image Using MATLAB?
Impulse noise is a unique form of noise that can have many different origins. Images are frequently corrupted through impulse noise due to transmission errors, defective memory places, or timing mistakes in analog-to-digital conversion. Salt-and-pepper noise is one form of impulse noise that can corrupt the image, in which the noisy pixels can take
4 min read
How to Remove Noise from Digital Image in Frequency Domain Using MATLAB?
Noise is defined as aberrant pixels. In other words, noise is made up of pixels not correctly representing the color or exposure of the scene. In this article, we will how to remove noise from the digital images in the frequency domain. There are two types of Noise sources Image acquisitionImage transmissionIn digital image processing different typ
5 min read
Edge detection using in-built function in MATLAB
Edge detection: In an image, an edge is a curve that follows a path of rapid change in intensity of that image. Edges are often associated with the boundaries of the object in a scene environment. Edge detection is used to identify the edges in an image to make image processing easy. Edge detection works by detecting discontinuities in brightness.
2 min read
Matlab | Edge Detection of an image without using in-built function
Problem Statement: Write a matlab code for edge detection of a grayscale image without using in-built function of edge detection. About Edge Detection: Edge detection is an image processing technique for finding the boundaries of objects within images. It works by detecting discontinuities in brightness. Edge detection is used for image segmentatio
3 min read
Adaptive Filtering - Local Noise Filter in MATLAB
On the degraded image, which contains both the original image and noise, an adaptive filter is applied. With a predetermined mxn window region, the mean and variance are the two statistical measures on which a locally adaptive filter depends. Adaptive Filters:adaptive filters are also Digital filters that change their coefficients with the intentio
4 min read
Wand noise() function - Python
The noise() function is an inbuilt function in the Python Wand ImageMagick library which is used to add noise to the image. Syntax: noise(noise_type, attenuate, channel) Parameters: This function accepts three parameters as mentioned above and defined below: noise_type: This parameter is used to store the noise type. Some of the available noise typ
2 min read
Salt and Pepper Noise removal using C++
Salt-and-pepper noise is a form of noise sometimes seen on images. It is also known as impulse noise. This noise can be caused by sharp and sudden disturbances in the image signal. It presents itself as sparsely occurring white and black pixels. An effective noise reduction method for this type of noise is a median filter or a morphological filter.
3 min read
Noise removal using Median filter in C++
Median filtering is a nonlinear process useful in reducing impulsive, or salt-and-pepper noise. The median filter is also used to preserve edge properties while reducing the noise. Also, the smoothing techniques, like Gaussian blur is also used to reduce noise but it can't preserve the edge properties. The median filter is widely used in digital im
3 min read
three90RightbarBannerImg