Filtering Noisy (Salt & Pepper) Image Using Median Filter

You might also like

Download as docx, pdf, or txt
Download as docx, pdf, or txt
You are on page 1of 4

[FILTERING SALT & PEPPER NOISY IMAGE]

November 24, 2016

[1]
SirajAnis
Filtering Noisy (Salt & Pepper) Image Using Median Filter
Department of Avionics, College of Engineering, Pakistan Air Force Karachi Institute of Economics and
Technology.
Email: [1]sirajanis@gmail.com

ABSTRACT

Denoising is an important problem in signal and image processing. In this paper a denoising filter is proposed which eliminates
salt and pepper noise from highly corrupted digital images. Several methods have been introduced to remove fixed value impulse
noise (salt and pepper noise) from digital images such as median filter (MF), adaptive median filter (AMF), Decision based
algorithms (DBA) etc. Many of these algorithms fail while removing the noise at high density and do not preserve fine details of
the image. The proposed filter (MF) shows better results than existing filtering methods.

Keywords: Salt & Pepper Noise, Impulse Noise, Image Denoising, Median Filter


1. Introduction

Image processing is a method to perform some operations on


an image, in order to get an enhanced image or to extract some
useful information from it. It is a type of signal processing in
which input is an image and output may be image or
characteristics/features associated with that image. Nowadays,
image processing is among rapidly growing technologies. It
forms core research area within engineering and computer
science disciplines too.

Image processing basically includes the following three steps:


 Importing the image via image acquisition tools;
 Analyzing and manipulating the image
 Output in which result can be altered image or report that is
based on image analysis. Digital Image:

There are two types of methods used for image


processing namely, “Analogue” and “Digital image”
processing.
Analogue image processing can be used for the hard copies
like printouts and photographs. Image analysts use various
fundamentals of interpretation while using these visual
techniques.
An image is a two-dimensional function f(x,y), where x and y
are the spatial (plane) coordinates, and the amplitude of
function f at any pair of coordinates (x,y) is called the
intensity of the image at that level. If x,y and the amplitude
values of f are finite and discrete quantities, we call the image
a Digital image. A digital image is composed of a finite
number of elements called pixels, each of which has a
particular location and value. Digital image processing
techniques help in manipulation of the digital images by using
computers.
2. RGB vs Grayscale Image:
Analogue Image:
The RGB color model is an additive color model in
which red, green and blue light are added together in various
ways to reproduce a broad array of colors. The name of the

1
[FILTERING SALT & PEPPER NOISY IMAGE]
November 24, 2016

model comes from the initials of the three additive primary variation of brightness or color information in images, is
colors, red, green and blue. usually an aspect of electronic noise. Noise is always presents
in digital images during image acquisition, coding,
The main purpose of the RGB color model is for the sensing,
transmission, and processing steps.
representation and display of images in electronic systems,
such as televisions and computers, though it has also been
It is very difficult to remove noise from the digital images
used in conventional photography. Before the electronic age,
without the prior knowledge of noise model. That is why,
the RGB color model already had a solid theory behind it,
review of noise models are essential in the study of image
based in human perception of colors.
denoising techniques. These noise models can be selected by
analysis of their origin. Noise can be produced by the sensor
and circuitry of a scanner or digital camera. The most common
noise induced in digital images is known as salt & pepper
noise, which disturbs the actual image and displays only a
small amount of information by sophisticated processing

Salt & Pepper Noise:


Salt and pepper noise is a typical type of noise in images. This
noise is caused by errors in data transmission or faulty
memory location in hardware. Each pixel in an image has the
probability of p/2 (0<p<1) being contaminated by either a
white dot (salt) or a black dot (pepper) but in some
applications, noisy pixels are not simply black or white, which
makes the impulse noise removal problem more difficult.

Grayscale images are distinct from one-bit bi-tonal black-and- An image containing salt-and-pepper noise will have dark
white images, which in the context of computer imaging are pixels in bright regions and bright pixels in dark regions. This
images with only two colors, black and white (also called bi- type of noise can be caused by analog-to-digital
level or binary images). converter errors, bit errors in transmission, etc. Usual and
effective noise reduction method for this type of noise
In photography and computing, a grayscale digital image is an involves the usage of median filter. This algorithm proves
image in which the value of each pixel is a single sample, it quite effective when the noise level is low. However, when the
carries only intensity information. Images of this sort, also noise level is higher than 50%, edges and details cannot be
known as black-and-white, are composed exclusively of well preserved.
shades of gray, varying from black at the weakest intensity to
white at the strongest.
Noisy (Salt & Pepper) Image:

A digital image containing salt & pepper noise.

3. Noise
What is Noise? In digital image processing noise means any 4. Filter
unwanted signal; random (not present in the object imaged)

2
[FILTERING SALT & PEPPER NOISY IMAGE]
November 24, 2016

In image processing, filtering is a technique for modifying or An image histogram is a chart that shows the distribution of
enhancing an image. A filter is a device or process that intensities in an indexed or grayscale image. A MATLAB
removes some unwanted components or features from an function named imhist creates a histogram plot by defining
image. An image can be filtered to emphasize certain features and equally spaced bins, each representing a range of data
or remove other features. The defining feature of filters being values, and then calculating the number of pixels within each
the complete or partial suppression of some aspect of the range. The histogram by default shows a peak at around 100,
image. Image processing operations implemented with corresponding to the dark gray background in the image
filtering include smoothing, sharpening, and edge
enhancement. Creating Histogram of Original and Filtered image

Median Filter: clc; clear all; close all;


Original=(imread('7067.jpg')); %Read Image on MATLAB
The median filter is a nonlinear digital filtering technique, %Applying 2D Median Filter
often used in image processing to reduce "salt and pepper" Filtered = medfilt2(Original); %Filter Noisy Image
noise. Such noise reduction is a typical pre-processing step to
improve the results of later processing (for example, edge % Comparing Histogram
detection on an image). Median filtering is very widely used in
digital image processing because a median filter is more figure %Creating a New Output Screen
effective than convolution when the goal is to simultaneously subplot(211); %Plotting Image on Figure
reduce noise and preserve edges. imhist(Original); %Displaying Histogram
title('Histogram Of Original'); %Name the Image
MATLAB code:
xlabel('Intensity'); %Label x-axis
Denoising salt & pepper noised image by using median filter. ylabel('Contrast'); %Label y-axis
subplot(212); %Plotting Image on Figure
clc; clear all; close all; imhist(Filtered); %Displaying Histogram
Original=(imread('7067.jpg')); %Read Image on MATLAB title('Histogram Of Filtered Noise'); %Name the Image
imshow(uint8(Original)); %Output Image on MATLAB xlabel('Intensity'); %Label x-axis
Figure ylabel('Contrast'); %Label y-axis
title('Original Image') %Name the Image
%Applying 2D Median Filter
Filtered = medfilt2(Original); %Filter Noisy Image
figure %Creating a New Output Screen
imshow(uint8(Filtered)); %Output Image on MATLAB Figure
title('2D Median Filter') %Name the Image
xlabel('Noise Filtered Out') %Label x-axis

5. Histogram Conclusions

3
[FILTERING SALT & PEPPER NOISY IMAGE]
November 24, 2016

Median filters do not replace linear discrete ones. Fields of


applications are compliant with basic characteristics of them.
The filters could be applied in case of Digital Image
processing, diagnostic in healthcare systems, or impulse errors
in industry environment. etc. High speed signal processing is
characteristic for median filters because of their simple
technical realization. In this paper median filter was seem to
be useful in removing unwanted noise in a digital image.

Salt & Pepper noise creates a huge obstacle in retrieving the


useful information from the image, so the best filter in digital
processing for low density is the median filter which reduces
the noise effect and shows an enhanced image.

Acknowledgement
Very thankful to Engr. Noor-ul-Ain and Danyal Hussain of
PAF-KARACHI INSTITUTE OF ECONOMICS AND
TECHNOLOGY for the valuable support and suggestion and
for their constant encouragement.

Reference

1) Digital Signal Processing: Principles, Algorithms,


and Applications. Written by: John G. Proakis &
Dimitris G. Manolakis.
2) Digital Filters Design for Signal and Image
Processing. Editor: Mohamed Najim.
3) https://www.mathworks.com/help/images/ref/medfilt
2.html
4) https://en.wikipedia.org/wiki/Median_filter

You might also like