Dip Unit 3
Dip Unit 3
Dip Unit 3
IMAGE ENHANCEMENT
IMAGE ENHANCEMENT IN SPATIAL DOMAIN:
3.1. Introduction
The principal objective of enhancement is to process an image so that the result is more
suitable than the original image for a specific application. Image enhancement approaches
fall into two board categories.
1. Spatial domain methods
2. Frequency domain methods
The term spatial domain refers to the image plane itself and approaches in this categories are
based on direct manipulation of pixel in an image. Spatial domain process are denoted by the
expression
g(x,y)=T[f(x,y)]
Where f(x,y)- input image, T- operator on f, defined over some neighborhood of f(x,y)
and g(x,y)-processed image
The neighborhood of a point (x,y) can be explain by using as square or rectangular sub image
area centered at (x,y).
The center of sub image is moved from pixel to pixel starting at the top left corner. The
operator T is applied to each location (x,y) to find the output g at that location . The process
utilizes only the pixel in the area of the image spanned by the neighborhood.
3.2 Basic Gray Level Transformation Functions
It is the simplest form of the transformations when the neighborhood is of size IXI. In this
case g depends only on the value of f at (x,y) and T becomes a gray level transformation
function of the forms
S=T(r)
r- Denotes the gray level of f(x,y)
s- Denotes the gray level of g(x,y) at any point (x,y)
Because enhancement at any point in an image deepens only on the gray level at that point,
technique in this category are referred to as point processing.
There are basically three kinds of functions in gray level transformation –
3.2.1 Point Processing:
(i) Contract stretching:
It produces an image of higher contrast than the original one. The operation is performed by
darkening the levels below m and brightening the levels above m in the original image.
In this technique the value of r below m are compressed by the transformation function into a
narrow range of s towards black .The opposite effect takes place for the values of r above m.
(ii) Thresholding function:
It is a limiting case where T(r) produces a two levels binary image. The values below m are
transformed as black and above m are transformed as white.
(2) Second method is to brighten the desired ranges of gray levels but preserve the
background and gray level tonalities in the image.
(iii) Bit Plane Slicing:
Sometimes it is important to highlight the contribution made to the total image
appearance by specific bits. Suppose that each pixel is represented by 8 bits. Imagine that an
image is composed of eight 1-bit planes ranging from bit plane 0 for the least significant bit
to bit plane 7 for the most significant bit. In terms of 8-bit bytes, plane 0 contains all the
lowest order bits in the image and plane 7 contains all the high order bits.
High order bits contain the majority of visually significant data and contribute to more subtle
details in the image. Separating a digital image into its bits planes is useful for analyzing the
relative importance played by each bit of the image. It helps in determining the adequacy of
the number of bits used to quantize each pixel. It is also useful for image compression.
3.3 Histogram Processing:
The histogram of a digital image with gray levels in the range [0, L-1] is a discrete function
of the form
H(rk)=nk
where rk is the kth gray level and nk is the number of pixels in the image having the level rk..
A normalized histogram is given by the equation
p(rk)=nk/n for k=0,1,2,…..,L-1
P(rk) gives the estimate of the probability of occurrence of gray level rk.
The sum of all components of a normalized histogram is equal to 1.
The histogram plots are simple plots of H(rk)=nk versus rk.
In the dark image the components of the histogram are concentrated on the low (dark) side of the
gray scale. In case of bright image the histogram components are baised towards the high side of
the gray scale. The histogram of a low contrast image will be narrow and will be centered
towards the middle of the gray scale.
The components of the histogram in the high contrast image cover a broad range of the gray
scale. The net effect of this will be an image that shows a great deal of gray levels details and has
high dynamic range.
3.3.1 Histogram Equalization:
Histogram equalization is a common technique for enhancing the appearance of images. Suppose
we have an image which is predominantly dark. Then its histogram would be skewed towards the
lower end of the grey scale and all the image detail are compressed into the dark end of the
histogram. If we could „stretch out‟ the grey levels at the dark end to produce a more uniformly
distributed histogram then the image would become much clearer.
Let there be a continuous function with r being gray levels of the image to be e nhanced. The
range of r is [0, 1] with r=0 repressing black and r=1 representing white. The transformation
function is of the form
S=T(r) where 0<r<1
It produces a level s for every pixel value r in the original image. The transformation function
is assumed to fulfill two condition T(r) is single valued and monotonically increasing in the
internal 0<T(r)<1 for 0<r<1.The transformation function should be single valued so that the
inverse transformations should exist. Monotonically increasing condition preserves the
increasing order from black to white in the output image. The second conditions guarantee
that the output gray levels will be in the same range as the input levels. The gray levels of the
image may be viewed as random variables in the interval [0.1]. The most fundamental
descriptor of a random variable is its probability density function (PDF) Pr(r) and Ps(s)
denote the probability density functions of random variables r and s respectively. Basic
results from an elementary probability theory states that if Pr(r) and Tr are known and T-1(s)
satisfies conditions (a), then the probability density function Ps(s) of the transformed variable
is given by the formula
Thus the PDF of the transformed variable s is the determined by the gray levels PDF of the
input image and by the chosen transformations function.
A transformation function of a particular importance in image processing
An important point here is that Tr depends on Pr(r) but the resulting Ps(s) always is uniform,
and independent of the form of P(r). For discrete values we deal with probability and
summations instead of probability density functions and integrals. The probability of
occurrence of gray levels rk in an image as approximated
Thus a processed image is obtained by mapping each pixel with levels rk in the input image
into a corresponding pixel with level sk in the output image. A plot of Pr (rk) versus rk is
called a histogram. The transformation function given by the above equation is the called
histogram equalization or linearization. Given an image the process of histogram equalization
consists simple of implementing the transformation function which is based information that
can be extracted directly from the given image, without the need for further parameter
specification.
For linaer spatial filtering the response is given by a sum of products of the filter coefficient
and the corresponding image pixels in the area spanned by the filter mask. The results R of
liner filtering with the filter mask at point (x,y) in the image is
The sum of products of the mask coefficient with the corresponding pixel directly under the
mask. The coefficient w (0,0) coincides with image value f(x,y) indicating that mask it
centered at (x,y) when the computation of sum of products takes place. For a mask of size
MxN we assume m=2a+1 and n=2b+1, where a and b are nonnegative integers. It shows that
all the masks are of add size. In the general liner filtering of an image of size f of size M*N
with a filter mask of size m*m is given by the expression
Because it is ideal case. So all frequency inside the circle are passed without any attenuation
where as all frequency outside the circle are completely attenuated. For an ideal low pass
filter cross section, the point of transition between H (u,v) =1 and H(u,v)=0 is called of the “
cut of frequency”.
Most appropriate value of n is 2.It does not have sharp discontinuity unlike ILPF that
establishes a clear cutoff between passed and filtered frequencies. Defining a cutoff
frequency is a main concern in these filters. This filter gives a smooth transition in blurring as
a function of increasing cutoff frequency. A Butterworth filter of order 1 has no ringing.
Ringing increases as a function of filter order. (Higher order leads to negative values).
(iii) Gaussian Low pass filter:
The transfer function of a Gaussian low pass filter is
Where D(u,v)- the distance of point (u,v) from the center of the transform
σ = D0- specified cut off frequency
The filter has an important characteristic that the inverse of it is also Gaussain.