- Data Structure
- Networking
- RDBMS
- Operating System
- Java
- MS Excel
- iOS
- HTML
- CSS
- Android
- Python
- C Programming
- C++
- C#
- MongoDB
- MySQL
- Javascript
- PHP
- Physics
- Chemistry
- Biology
- Mathematics
- English
- Economics
- Psychology
- Social Studies
- Fashion Studies
- Legal Studies
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
Denoising techniques in digital image processing using MATLAB
In digital image processing, denoising is a process of reducing or removing the unwanted noise from a digital image. The primary objective of this process is to enhance the visual quality of an image.
Before discussing the different denoising techniques in digital image processing, let us first get an overview of the basics of denoising.
What is Denoising in Digital Image Processing?
In a digital image, any kind of variation that is unwanted is termed as noise. Noise in a digital image can occur due to different reasons such as environmental conditions, hardware malfunctioning, transmission errors, etc. The process of removing this unwanted noise from an image is referred to as denoising.
Denoising is mainly used to improve the visual quality of a digital image. Denoising makes a digital image ready to analyze and display.
An efficient denoising technique is one that preserves all the important characteristics of the image while reducing the unwanted noise.
In a digital image, there can be different types of noises such as Gaussian noise, salt and pepper noise, speckle noise, etc. To remove a specific type of noise, a specific denoising technique is used.
Let us now discuss the different types of denoising techniques in digital image processing using MATLAB.
Denoising Techniques in Digital Image Processing Using MATLAB
MATLAB provides various types of denoising techniques to remove or reduce the unwanted noise from a digital image. Some commonly used denoising techniques in digital image processing are explained below with the help of examples in MATLAB.
Denoising Using Median Filter
Median filter is considered the simplest denoising technique in digital image processing. This technique is used to reduce or remove the salt and pepper noise from a digital image.
In MATLAB, the "medfilt2()" function is used to apply the median filter to an image.
Syntax
denoised_img = medfilt2(noisy_img, filter_size);
The step-by-step process to perform denoising of an image using median filter is explained below.
Step (1) − Read the noisy image using the "imread" function.
Step (2) − Convert the input noisy image to grayscale using the "rgb2gray" function.
Step (3) − Perform denoising through the median filter using the "medfilt2()" function.
Step (4) − Display the denoised image using the "imshow" function.
Example
Let us see an example to understand the implementation of these steps in MATLAB −
% MATLAB code to perform denoising using median filter % Read the noisy image noisy_img = imread('noisy_image.jpg'); % Replace the URL with noisy image % Convert the input image to grayscale if necessary gray_img = rgb2gray(noisy_img); % Perform denoising using the median filter denoised_img = medfilt2(gray_img, [3, 3]); % Display the noisy and denoised images figure; subplot(1, 2, 1); imshow(gray_img); title('Noisy Image'); subplot(1, 2, 2); imshow(denoised_img); title('Denoised Image');
Output
When you run this code, it will produce the following output −
Denoising using Gaussian Filter
In digital image processing, the Gaussian filtering is another commonly used denoising technique. This denoising technique is used to remove the Gaussian noise from a digital image.
To apply the Gaussian filter to a digital image, we use the "imgaussfilt" function in MATLAB.
Syntax
denoised_img = imgaussfilt(noisy_img, standard_deviation);
The following steps are involved in denoising an image using the Gaussian filter in MATLAB.
Step (1) − Read the noisy image using the "imread" function.
Step (2) − Convert the input image to grayscale if necessary.
Step (3) − Perform denoising using the Gaussian filter.
Step (4) − Display the denoised image using the "imshow" function.
Example
Let us take an example in MATLAB to understand denoising using Gaussian filter −
% MATLAB code to perform denoising using Gaussian filter % Read the noisy image noisy_img = imread('noisy_image.jpg'); % Replace the URL with noisy image % Convert the input image to grayscale if necessary gray_img = rgb2gray(noisy_img); % Perform denoising using the median filter sigma = 2; % Adjust standard deviation as per noise characteristics denoised_img = imgaussfilt(gray_img, sigma); % Display the noisy and denoised images figure; subplot(1, 2, 1); imshow(gray_img); title('Noisy Image'); subplot(1, 2, 2); imshow(denoised_img); title('Denoised Image');
Output
When you run this code, it will produce the following output −
Denoising Using Wiener Filter
In digital image processing, there is another denoising technique named "Wiener Filter" that is used to remove noise from an image. It is a deconvolution based denoising technique.
In MATLAB, there is a built-in function "wiener2" that is used to perform denoising through Wiener filtering.
Syntax
denoised_img = wiener2(noisy_img, filterSize);
The steps involved in denoising through wiener filter are same as that of the above techniques.
Example
Here is an example to demonstrate denoising using the wiener filter in MATLAB −
% MATLAB code to perform denoising using Wiener filter % Read the noisy image noisy_img = imread('noisy_image.jpg'); % Convert the input image to grayscale gray_img = rgb2gray(noisy_img); % Perform denoising using the Wiener filter denoised_img = wiener2(gray_img, [5, 5]); % Display the noisy and denoised images figure; subplot(1, 2, 1); imshow(gray_img); title('Noisy Image'); subplot(1, 2, 2); imshow(denoised_img); title('Denoised Image');
Output
When you run this code, it will produce the following output −
Non-Local Means (NLM) Denoising Technique
In digital image processing, there is a denoising technique named Non-Local Means (NLM) which is used to remove unwanted noise from an image. This denoising technique is efficient in preserving image details while reducing unwanted noise in the image.
In MATLAB, we can perform denoising through NLM technique by using the "imnlmfilt" function.
Syntax
denoised_img = imnlmfilt(noisy_img, 'DegreeOfSmoothing', value, 'SearchWindowSize', WindowSize);
Here, the parameter "DegreeOfSmoothing" controls the degree of smoothing during noise reduction and the parameter "SearchWindowSize" specifies the size of the filter window.
Example
Here is an example that shows the steps involved in denoising through non-local means denoising technique.
% MATLAB code to perform denoising using NLM technique % Read the noisy image noisy_img = imread('Noisy_Image.jpg'); % Convert input image to grayscale gray_img = rgb2gray(noisy_img); % Perform denoising using Non-Local Means (NLM) denoised_img = imnlmfilt(gray_img, 'DegreeOfSmoothing', 30, 'SearchWindowSize', 11); % Display the noisy and denoised images subplot(1, 2, 1); imshow(gray_img); title('Noisy Image'); subplot(1, 2, 2); imshow(denoised_img); title('Denoised Image');
Output
When you run this code, it will produce the following output −
Conclusion
In conclusion, denoising means removing the unwanted from a digital image. In MATLAB, we have different types of denoising techniques. In this tutorial, I explained all the commonly used denoising techniques in digital image processing using MATLAB with the help of examples.
To Continue Learning Please Login
Login with Google