Available Online at www.ijcsmc.
com
International Journal of Computer Science and Mobile Computing
A Monthly Journal of Computer Science and Information Technology
ISSN 2320–088X
IJCSMC, Vol. 2, Issue. 4, April 2013, pg.138 – 145
RESEARCH ARTICLE
Comparative Analysis and Implementation of Image
Enhancement Techniques Using MATLAB
Er. Nancy1, Er. Sumandeep Kaur2
1
Student, UCoE, Punjabi University, Patiala, India
2
Assistant Professor, UCoE, Punjabi University, Patiala, India
Abstract— Image Enhancement Is As Much An Art As It Is A Science.” Image enhancement is one of the
key issues in high quality pictures such as digital cameras. The main purpose of image enhancement is to
bring out detail that is hidden in an image or to increase contrast in a low contrast image. This technique
provides a multitude of choices for improving the visual quality of images. This is the main reason that image
enhancement is used in a huge number of applications with important challenges such as noise reduction,
degradations, blurring etc. This paper will provide an overview of underlying concepts, along with algorithms
commonly used for image enhancement. The paper focuses on spatial domain techniques for image
enhancement, with particular reference to point processing methods and on spatial filtering.
Key Terms: - Digital Image Processing; Histogram; Image Enhancement; Image restoration; MSE; PSNR;
Spatial and Frequency Domain
I. INTRODUCTION
A. Image Enhancement
Image enhancement is to improve the interpretability or perception of information in the images to provide
better input for other automated image processing steps. The image acquired from natural environment with
high dynamic range includes both dark and bright regions. Due to exceed in dynamic range of human eyes
sensing, those images are difficult to perceive by human eyes. Image enhancement is a common approach to
improve the quality of those images in terms of human visual perception. Enhancement techniques can be
divided into two categories namely:
• Spatial domain methods
• Transform domain methods.
Spatial domain technique enhances an image by directly dealing with the intensity value in an image.
Transform domain enhancement techniques involve transforming the image intensity data into a specific
domain by using methods such as DFT, DCT, etc. and the image is enhanced by altering the frequency content
of the image.
Image enhancement is applied in every field where images are ought to be understood and analyzed. For
example, medical image analysis, analysis of images from satellites etc. Image enhancement simply means,
transforming an image f into image g using T. (Where T is the transformation. The values of pixels in images f
and g are denoted by r and s, respectively. As said, the pixel values r and s are related by the expression,
s = T(r) ………………(1)
Where T is a transformation that maps a pixel value r into a pixel value s. The results of this transformation
are mapped into the grey scale range as we are dealing here only with grey scale digital images. So, the results
© 2013, IJCSMC All Rights Reserved 138
Nancy et al, International Journal of Computer Science and Mobile Computing Vol.2 Issue. 4, April- 2013, pg. 138-145
are mapped back into the range [0, L-1], where L=2k, k being the number of bits in the image being considered.
So, for instance, for an 8-bit image the range of pixel values will be [0, 255].
Figure 1. Showing the effect of Image Enhancement
This paper provides an overview of underlying concepts along with the algorithms commonly used for image
enhancement and focuses on spatial domain techniques for image enhancement, with particular reference to
point processing methods.
B. Image Restoration
Image restoration refers to removal or minimization of known degradations in an image. This includes de-
blurring of images degraded by the limitations of a sensor or its environment, noise filtering and correction of
non-linearities due to sensors. Image restoration is a process that attempts to reconstruct and recover an image
that has been degraded by using the phenomenon of degradation. In this technique an inverse process is used to
restore the original image. This technique involves formulating certain criteria of goodness that gives the
optimal estimate of the desired result.
The objective of restoration is to obtain an estimate f^(x,y) of the original image. We want to estimate to be as
close as possible to the original input image and in general the more we know about H and η, the closer f^(x,y)
will be to f(x,y). If H is a linear position-invariant process, then the degraded image is given the spatial domain
by:
g(x,y)= h(x,y)*f(x,y)+ η(x,y)……………..(2)
where h(x,y) is the spatial representation of the degradation function and the symbol * indicates spatial
convolution,
g(x,y) is the degraded image and η(x,y) is the noise term.
In Frequency Domain, Equation(2) can be written as:
G(u,v)= H(u,v)F(u,v)+N(u,v)……………..(3)
Figure 2: A model of the image degradation/restoration process
II. IMAGE ENHANCEMENT TECHNIQUES
A. Gray level transformations
The dynamic range of an image is defined as the difference between the smallest and largest pixel values
within the image. We can define certain functional transforms or mappings that alter the effective use of the
dynamic range. These transforms are primarily applied to improve the contrast of the image. This improvement
is achieved by altering the relationship between the dynamic range of the image and the grey-scale (or color)
values that are used to represent the values.
© 2013, IJCSMC All Rights Reserved 139
Nancy et al, International Journal of Computer Science and Mobile Computing Vol.2 Issue. 4, April- 2013, pg. 138-145
a) Image Negative:- The most basic and simple operation in digital image processing is to compute the
negative of an image. The pixel gray values are inverted to compute the negative of an image. For example, if an
image of size R x C, where R represents number of rows and C represents number of columns, is represented by
I(r, c). The negative N(r, c) of image I(r, c) can be computed as:
N(r, c) = 255 – I(r, c)…………………..(4)
where 0 <= r <= R and 0 <= c <= C
It can be seen that every pixel value from the original image is subtracted from the 255. The resultant image
becomes negative of the original image. Negative images are useful for enhancing white or grey detail
embedded in dark regions of an image.
(a) Original Image (b) Negative Image
(c) Original Image Histogram (d) Output Image Histogram
Figure 3: Image Negation and corresponding Histograms
b) Log Transformation :- The general form of the log transformation is
s = c * log (1 + r)……………………..(5)
The log transformation maps a narrow range of low input grey level values into a wider range of output
values. We would use this transformation to expand the values of dark pixels in an image while compressing
the higher-level values. The inverse log transformation performs the opposite transformation. We usually set c
to 1. Grey levels must be in the range [0.0, 1.0].
(a) Original Image (b) Transformed Image1 (c)Transformed Image2
© 2013, IJCSMC All Rights Reserved 140
Nancy et al, International Journal of Computer Science and Mobile Computing Vol.2 Issue. 4, April- 2013, pg. 138-145
(d)Original Image (e) Transformed Image1 (f) Transformed Image2
Histogram Histogram Histogram
Figure 4: Log Transformation and its histograms
c) Exponential Transformation :- The exponential transform is the inverse of the logarithmic transform.
Here, the mapping function is defined by the given base e raised to the power of the input pixel value:
Ioutput(i,j)=e Iinput(i,j) ……………………(6)
where I(i,j) is the value of a pixel at a location (i,j) in image I. This transform enhances detail in high-value
regions of the image (bright) whilst decreasing the dynamic range in low-value regions (dark) – the opposite
effect to the logarithmic transform. The choice of base depends on the level of dynamic range compression
required. In general, base numbers just above 1 are suitable for photographic image enhancement.
Ioutput(i,j)=c[(1+α)Iinput(i,j) -1]………….(7)
Here, (1+α) is the base and c is the scaling factor required to ensure the output lies in an appropriate range. As
is apparent when Ioutput(i,j)=0 , this results in Ioutput(i,j)=c unless we add in the -1 to counter this potential offset
appearing in the output image.
(a) Original Image (b) Transformed Image1 (c) Transformed Image2
(d) Original Image (e) Transformed Image1 (f) Transformed Image2
Histogram Histogram Histogram
Figure 5: Exponential Transformation and its histograms
d) Power-law Transformation: An alternative to both the logarithmic and exponential transforms is the ‘raise
to a power’ or power-law transform in which each input pixel value is raised to a fixed power:
Ioutput(i,j)=c(Ioutput(i,j))γ…………………………(8)
Where c and γ are constants, a value of γ > 1 enhances the contrast of high-value portions of the image at the
expense of low-value regions, whilst we see the reverse for γ< 1. This gives the power-law transform properties
similar to both the logarithmic (γ < 1) and exponential (γ > 1) transforms. The constant c performs range scaling.
© 2013, IJCSMC All Rights Reserved 141
Nancy et al, International Journal of Computer Science and Mobile Computing Vol.2 Issue. 4, April- 2013, pg. 138-145
(a) (b) (c)
(d) Original Image Histogram (e) Transformed Image1 Histogram (f) TransformedImage2 Histogram
Figure 6: Power- Law Transformations and its corresponding histograms
e). Gray Level Slicing:- Its purpose is to highlight a specific range of gray values. For this, fixed threshold
values are taken. Two different approaches can be adopted for this. They are:
i. Gray-Level Slicing Without Preserving Background:- This displays high values for range of interest
and low values in other areas. The main drawback of this approach is that the background information
is discarded.
ii. Gray-Level Slicing with Background:-Its objective is to display high values for the range of interest
and original gray level values in other areas. It preserves the background of an image.
(a) (b)
© 2013, IJCSMC All Rights Reserved 142
Nancy et al, International Journal of Computer Science and Mobile Computing Vol.2 Issue. 4, April- 2013, pg. 138-145
(c) (d)
Figure 7: Gray- Level Slicing
f). Contrast Enhancement:- This is one of the simplest piecewise linear function. Low contrast images can
result from poor illumination, lack of dynamic range in image sensor or even wrong setting of lens aperture
during image acquisition. The idea behind this technique is to increase the dynamic range of gray levels in the
image being processed.
(a) Original Image (b) Enhanced Image
(c) Original Image Histogram (d) Enhanced Image Histogram
Figure 8: Contrast Enhancement and its corresponding histograms
B. Spatial Filtering
a) Mean Filter:- The mean filter is perhaps the simplest linear filter and operates by giving equal weight to
all pixels in the neighborhood. A weight of Wk=1/(NM) is used for an N×M neighborhood and has the effect of
smoothing the image, replacing every pixel in the output image with the mean value from its N×M
neighborhood. Mean filters can be used as a method to suppress noise in an image. Mean Filters works well for
Salt noise but fails for pepper noise.
b) Median Filter:- Median filtering overcomes the main limitations of the mean filter, but at the expense of
greater computational cost. As each pixel is addressed, it is replaced by the statistical median of N×M
neighborhood rather than the mean. The median filter is superior to the mean filter in that it is better at
preserving sharp high-frequency detail (i.e. edges) whilst also eliminating noise, especially isolated noise spikes
(such as ‘salt and pepper’ noise). The median operator requires an ordering of the values in the pixel
neighborhood at every pixel location. This increases the computational requirement of the median operator.
© 2013, IJCSMC All Rights Reserved 143
Nancy et al, International Journal of Computer Science and Mobile Computing Vol.2 Issue. 4, April- 2013, pg. 138-145
(a) (b) (c) (d)
(e) (f) (g) (h)
Figure 9: (a) Original Image (b) Noise Added Image (c) Median Filter Output (d) Mean Filter Output
AND Corresponding histograms fig.(e-h).
III. PERFORMANCE ANALYSIS
The PSNR block computes the peak signal-to-noise ratio, in decibels, between two images. This ratio is often
used as a quality measurement between the original and a compressed image. The higher the PSNR, the better
the quality of the compressed or reconstructed image.
The Mean Square Error (MSE) and the Peak Signal to Noise Ratio (PSNR) are the two error metrics used to
compare image compression quality. The MSE represents the cumulative squared error between the compressed
and the original image, whereas PSNR represents a measure of the peak error. The lower the value of MSE, the
lower the error. To compute the PSNR, the block first calculates the mean-squared error using the following
equation:
…………..(9)
In the previous equation, M and N are the number of rows and columns in the input images, respectively.
Then the block computes the PSNR using the following equation:
…………………(10)
© 2013, IJCSMC All Rights Reserved 144
Nancy et al, International Journal of Computer Science and Mobile Computing Vol.2 Issue. 4, April- 2013, pg. 138-145
Table1: Comparison of Different Measuring Parameters for an image
Sr. No. Technique MSE PSNR
1 Image Negation 3.7355e+004 2.4073
2 Log transform 8.9773e+003 9.0046
3 Exponential 6.0269 40.3298
transform
4 Power law transform 0.4139 51.9616
5 Gray level slicing 1.5810e+003 16.1414
6 Contrast 3.4371 42.7688
enhancement
7 Mean filter 362.5145 22.5375
8 Median filter 355.5241 22.6221
IV. CONCLUSION
This paper presents a short description of various image enhancement techniques in order to make familiar
with the enhancement of a blurred image, noise removal, setting the brightness, contrast of images. The point
processing methods are used primarily for contrast enhancement. Image Negative is suited for enhancing white
detail embedded in dark regions and has applications in medical imaging. Power-law transformations are useful
for general purpose contrast manipulation and for a dark image; an expansion of gray levels is accomplished
using this transformation with a fractional exponent. Log Transformation is useful for enhancing details in the
darker regions of the image at the expense of detail in the brighter regions the higher-level values. For an image
having a washed-out appearance, a compression of gray levels is obtained using a power-law transformation
with γ>1. The histogram of an image (i.e., a plot of the gray level frequencies) provides important information
regarding the contrast of an image. Filters are used to remove noise from an image. Mean filter suppress
Gaussian noise well and the median filter is best suited for removing salt and pepper noise as compared to mean
filter.
REFERENCES
[1] A. K. Jain, “Fundamentals of Digital Image Processing” , Prentice Hall of India, First Edition,1989.
[2] Rafael C.Gonzalez and Richard E. woods, “Digital Image Processing”, Pearson Education, Second Edition,2005.
[3] S.Annadurai and R.Shanmugalakshmi, ”Fundamentals of Digital Image Processing”,Pearson,2007.
[4] W. K. Pratt,“Digital image processing”, Prentice Hall, 1989.
[5] Gajanand Gupta, “Algorithm for Image Processing Using Improved Median Filter and Comparison of Mean,
Median and Improved Median Filter” , International Journal of Soft Computing and Engineering (IJSCE) ISSN:
2231-2307, Volume-1, Issue-5, November 2011.
[6] Chris Solomon, “Fundamentals of Digital Image Processing” , John Wiley & Sons Ltd.
[7] R. Jain, R. Kasturi and B.G. Schunck, “ Image Processing Fundamentals”, McGraw-Hill International Edition,
1995.
[8] Jafar Ramadhan Mohammed, “An Improved Median Filter Based on Efficient Noise Detection for High Quality
Image Restoration,”,IEEE Int. Conf ,PP. 327 – 331, May 2008.
[9] Raman Maini and Himanshu Aggarwal “A Comprehensive Review of Image Enhancement Techniques”, Journal of
Computing, Volume 2, Issue 3, March 2010,pp.8-13.
[10] Sunita Dhariwal, “Comparative Analysis of Various Image Enhancement Techniques”, International Journal of
Electronics & Communication Technology (IJECT), Vol. 2, Issue 3, pp. 91-95, Sept. 2011.
© 2013, IJCSMC All Rights Reserved 145