Sie sind auf Seite 1von 40

1

CHAPTER 1
INTRODUCTION
Image enhancement is basically improving the interpretability or perception of
information in images for human viewers and providing `better' input for other automated
image processing techniques. The principal objective of image enhancement is to modify
attributes of an image to make it more suitable for a given task and a specific observer.
During this process, one or more attributes of the image are modified. The choice of
attributes and the way they are modified are specific to a given task. Moreover, observer-
specific factors, such as the human visual system and the observer's experience, will
introduce a great deal of subjectivity into the choice of image enhancement methods.
There exist many techniques that can enhance a digital image without spoiling it. The
enhancement methods can broadly be divided in to the following two categories:
1. Spatial Domain Methods
2. Frequency Domain Methods
In spatial domain techniques , we directly deal with the image pixels. The pixel
values are manipulated to achieve desired enhancement. In frequency domain methods,
the image is first transferred in to frequency domain. It means that, the Fourier Transform
of the image is computed first. All the enhancement operations are performed on the
Fourier transform of the image and then the Inverse Fourier transform is performed to get
the resultant image. These enhancement operations are performed in order to modify the
image brightness, contrast or the distribution of the grey levels. As a consequence the
pixel value (intensities) of the output image will be modified according to the
transformation function applied on the input values. 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 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,

2


s = T(r)
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 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]. I will consider only
gray level images. The same theory can be extended for the color images too. A digital
gray image can have pixel values in the range of 0 to 255.

1.1 Image Enhancement Techniques
Image enhancement techniques are application oriented. There are two basic types
of methods spatial domain methods and frequency domain methods.

1.1.1 Spatial domain methods:
methods that directly modify pixel values, possibly using intensity information
from a neighborhood of the pixel. Examples include image negatives, contrast stretching,
dynamic range compression, histogram specification, image subtraction, image averaging,
and various spatial filters.
What is it good for?
Smoothing
Sharpening
Noise removal edge detection

1.1.2 Frequency domain methods:
methods that modify the Fourier transform of the image. First, compute the
Fourier transform of the image. Then alter the Fourier transform of the image by
multiplying a filter transfer function. Finally, use inverse transform to get the modified

3

image (steps are described later in the text). The key is the filter transfer function -
examples include lowpass filter, highpass filter, and Butterworth filter.

1.2 Organization of the Report
This report starts with an overview of the different Image enhancement
techniques. We analyze applications of image enhancement techniques, spatial filtering
and Frequency domain filtering. These various techniques enhance the image for better
visibility. The report is organized as follows:
Chapter 1: Introduction - This chapter briefly explains the overview of the report.
Chapter 2: Filtering in the Frequency Domain - This chapter describes the basic filtering
in the Frequency domain.
Chapter 3: Smoothing Frequency Domain Filters - This chapter discusses about the
techniques used for smoothing of images in Frequency domain and filters used for
smoothing of images.
Chapter 4: Sharpening of Frequency Domain Filters- This chapter explains about the
Sharpening techniques used in image processing.
Chapter 5: Spatial Filtering - This chapter describes about the filtering techniques used in
spatial domain.
Chapter 6: Spatial Domain in case of many realizations of an Image - This chapter
describe about the image averaging for reducing the noise and also Spatial Domain in
case of a single Image - This chapter describe about the application of spatial filtering to
a single image.
Chapter 7: Conclusions - This chapter summarizes the major accomplishments of this
report.







4

CHAPTER 2
FILTERING IN THE FREQUENCY DOMAIN
2.1 Convolution Theorem:
The Fourier Transform is used to convert images from the spatial domain into the
frequency domain and vice-versa. Convolution is one of the most important concepts in
Fourier theory. Mathematically, a convolution is defined as the integral over all space of
one function at x times another function at u-x.
( ) ( ) ( ) ( ) f g f g t d g f t d t t t t t t


- = =
} }

There are two ways of expressing the convolution theorem:
1. The Fourier transform of a convolution is the product of the Fourier transforms.
2. The Fourier transform of a product is the convolution of the Fourier transforms.
Let F be the operator performing the Fourier transform such that e.g. F is the Fourier
transform of f (can be 1-D or 2-D). Then
(f * g) = (f) (g) = F G (2.1.1)
Where denotes the element-by-element multiplication. Also, the Fourier transform of a
product is the convolution of the Fourier transforms:

(f g) = (f) * (g) = F * G. (2.1.2)

By using the inverse Fourier transform F
-1
, we can write

-1
(F G) = f * g (2.1.3)

-1
(F * G) = f g. (2.1.4)

Let F be the operator performing the Fourier transform s F is the Fourier transform of f
can be 1-D Then

5

Proof of convolution theorem (1-D):
involves an integral over the variable u.

Now we substitute a new variable w for u-x

Expressions in x can be taken out of the integral over w so that we have two
separate integrals, one over x with no terms containing w and one over w with
no terms containing x.

The variables of integration can have any names we please, so we can now
replace w with x, and we have the result we wanted to prove.

2.2 Basic of filtering in the frequency domain
Before we discuss filtering, its important to understand what is high and low
frequency mean in a image: If an image has large values at high frequency components

6

then the data (grey level) is changing rapidly on a short distance scale. e.g. a page of text,
edges and noise.If the image has large low frequency components then the large scale
features of the picture are more important. e.g. a single fairly simple object which
occupies most of the image. For color images, the measure the frequency content is with
regard to color: this shows if values are changing rapidly or slowly.
Filtering in the frequency domain is a common image and signal processing technique. It
can smooth, sharpen, de-blur, and restore some images. Essentially, filtering is equal to
convolving a function with a specific filter function. So one possibility to convolve two
functions could be to transform them to the frequency domain, multiply them there and
transform them back to spatial domain. The filtering procedure is summarized in Figure .


Figure 2.1: Frequency domain filtering procedure

Basic steps of filtering in the frequency domain:
1. Multiply the input image f (x, y) by (-1)
(x + y)
to center the transform, as indicated
as following equation: [f(x, y) (-1)
(x + y)
] = F (u - M/2, - N/2).
2. Compute F (u, ), the DFT of the input image from (1).
3. Multiply F (u, ) by a filter function H (u, ).
4. Compute the inverse DFT of the result in (3).

7

5. Obtain the real part (better take the magnitude) of the result in (4).
6. Multiply the result in (5) by (-1)
(x + y)
.
In step 2, the Two-Dimensional DFT:

1 1
2 ( / / )
0 0
1
( , ) ( , )
M N
j ux M vy N
x y
F u v f x y e
MN
t

+
= =
=

,

and its inverse:
1 1
2 ( / / )
0 0
1
( , ) ( , )
M N
j ux M vy N
u v
f x y F u v e
MN
t

+
= =
=

.
In equation form, the Fourier transform of the filtered image in step 3 is given by:

G(u, ) = F(u, )H(u, ) (2.2.1)

Where F(u, ) and H(u, ) denote the Fourier transform of the input image f (x, y), and the
filter function h(x, y), respectively. And G(u, ) is the Fourier Transform of the filtered
image, which is the multiplication of two two-dimensional functions H and F on an
element-by-element basics.
The important point to keep in mind is that the filtering process is based on modifying the
transform of an image (frequency) in some way via a filter function, and then taking the
inverse of the result to obtain the filtered image:

Filtered Image =
-1
[G(u, )].

2.3 Filtering in the Spatial and Frequency Domains
The most fundamental relationship between spatial and frequency domain is established
by a well-known result call convolution theorem (as describe in sec 2.1). Formally, the
discrete convolution of two functions f(x, y) and h(x, y) of size M x N is defined by the
expression:

8

1 1
0 0
1
( , ) * ( , ) ( , ) ( , )
M N
m n
f x y h x y f m n h x m y n
MN

= =
=

. (2.3.1)
From the convolution theorem, we know that the same result of Equation (2.3.1) can also
be obtained via the frequency domain by taking the inverse transform of the product of
the transforms of the two Equations as shown in Equation (2.1.3). A question that often
arises in the development of frequency domain technique is the issue of computational
complexity. Why do in the frequency domain for what could be done in the spatial
domain using small spatial masks? First, since the frequency carries with a significant
degree of intuitiveness regarding how to specify filters. Second part of the answer is
depends on the size of the spatial masks and is usually answered with respect to
comparable implementations. For example, use both approaches for running software on
the same machine, it turns out that the frequency domain implementation runs faster for
surprisingly small value of M and N. Also, some experiments shown that some
enhancement tasks that would be exceptionally difficult or impossible to formulate
directly in the spatial domain become almost trivial in the frequency domain.

An image can be filtered either in the frequency or in the spatial domain. In theory, all
frequency filters can be implementing as a spatial filter, but in practice, the frequency
filters can only be approximated by the filtering mask in spatial domain. If there exist a
simple mask for the desired filter effect, it is computationally less expensive to perform
the filtering in the spatial domain. And if there is no straight forward mask can be found
in the spatial domain, frequency filtering is more appropriate.







9


CHAPTER 3
SMOOTHING FREQUENCY DOMAIN FILTERS
As discuss about the different between the high and low frequency, we know that
edges and noises and other sharp transitions in the grey level contribute significantly to
the high frequency. Hence smoothing/blurring is achieved by attenuating a specified
range of high frequency components in the transform of a given image, which can be
done using a lowpass filter.
Lowpass filter is a filter that attenuates high frequencies and retains low
frequencies unchanged. This results a smoothing filter in the spatial domain since high
frequencies are blocked. Three types of lowpass filters will be discussed in this report are
Ideal, Gaussian and Butterworth.
3.1 Ideal lowpass filter:
The most simple lowpass filter is the ideal lowpass. It suppresses all frequencies
higher than the cut-off frequency r0 and leaves smaller frequencies unchanged:
1, if
0
( , ) D u v r s
H(u, v) = 0, if
0
( , ) D u v r >

r
0
is called the cutoff frequency (nonnegative quantity), and D(u, v) is the distance from
point (u, v) to the frequency rectangle. If the image is of size M x N, then


2 2
( , ) ( ) ( )
2 2
M N
D u v u v = + . 3.1.1
The lowpass filters considered here are radially symmetric about the origin. Use Figure 2
as the cross section that extending as a function of distance from the origin along a radial
line, we get Figure 4, which is the perspective plot of an Ideal LPF transfer function. And
Figure 3 is the filter displayed as an image.

10


Figure 3.1: Filter radial cross section.


Figure 3.2: Filter displayed as an image.


Figure 3.3: Perspective plot of an Ideal LPF transfer function.

11

The drawback of the ideal lowpass filter function is a ringing effect that occurs
along the edges of the filtered image. In fact, ringing behavior is a characteristic of
ILPF(Ideal Low Pass Filter). As mentioned earlier, multiplication in the Fourier domain
corresponds to a convolution in the spatial domain. Due to the multiple peaks of the ideal
filter in the spatial domain, the filtered image produces ringing along intensity edges in
the spatial domain.
The cutoff frequency r
0
of the ILPF determines the amount of frequency
components passed by the filter. Smaller the value of r
0
, more the number of image
components eliminated by the filter (see example below).
In general, the value of r
0
is chosen such that most components of interest are passed
through, while most components not of interest are eliminated.

Example 1: ideal lowpass filtering:

Original Image LPF, r
0
= 26 LPF, r
0
= 36 LPF, r
0
= 57,
As we can see, the filtered image is blured and ringing is more severe as r
0
become
smaller. It is clear from this example that ILPF is not very practical. The next section
introduce a lowpass filter which smoothing a iamage can achieve blurring the image
while there is little or no ringing.

3.2 Butterworth lowpass filter:
A commonly used discrete approximation to the Gaussian (next section) is the
Butterworth filter. Applying this filter in the frequency domain shows a similar result to
the Gaussian smoothing in the spatial domain. The transfer function of a Butterworth

12

lowpass filter (BLPF) of order n, and with cutoff frequency at a distance r
0
from the
origin, is defined as

2
0
1
( , )
( , )
1
n
H u v
D u v
r
(
(
(

=
+
3.2.1
Where D(u ,v) is defined in 3.1.1.

As we can see from Figure 5, frequency response of the BLPF does not have a sharp
transition as in the ideal LPF. And as the filter order increases, the transition from the
pass band to the stop band gets steeper. Which means as the order of BLPF increase, it
will exhibits the characteristics of the ILPF. See example below to see the different
between two images with different orders but the same cutoff frequency. In fact, order of
20 already shows the ILPF characteristic.

Example 2: BLPF with different orders but the same cutoff frequency:


Original r
0
=

30, n=1 r
0
= 30, n=2

Use Figure as the cross section that extending as a function of distance from the origin
along a radial line, we get Figure 3.6. And Figure 6 is the filter displayed as an image. As
we can see from Figure 5, frequency response of the BLPF does not have a sharp
transition as in the ideal LPF. And as the filter order increases, the transition from the
pass band to the stop band gets steeper.

13


Figure 3.4: Filter radial cross sections of order n=2, 4 and 8.

Figure 3.5: Filter displayed as an image.



Figure 3.6: Perspective plot of a Butterworth LPF transfer function.

14



Figure 3.7: BLPF of order 1, 2, 5, and 20 respectively.

Figure 3.7 shows the comparison between the spatial representations of various orders
with cutoff frequency of 5 pixels, also the corresponding gray level profiles through the
center of the filter. As we can see, BLPF of order 1 has no ringing. Order of 2 has mild
ringing. So, this method is more appropriate for image smoothing than the ideal lowpass
filter. Ringing in the BLPF becomes significant for higher order.


Example 3: Butterworth lowpass filtering:

Original Image BLPF, r
0
= 10 BLPF, r
0
= 13 BLPF, r
0
= 18



15

3.3 Gaussian low pass filter:
Gaussian filters are important in many signal processing, image processing and
communication applications. These filters are characterized by narrow bandwidths, sharp
cutoffs, and low overshoots. A key feature of Gaussian filters is that the Fourier
transform of a Gaussian is also a Gaussian, so the filter has the same response shape in
both the spatial and frequency domains.
The form of a Gaussian lowpass filter in two-dimensions is given by

2 2
( , )/2
( , )
D u v
H u v e
o
= 3.3.1
Where D(u,v) is the distance from the origin in the frequency plane as defined in
Equation 3.1.1. The parameter measures the spread or dispersion of the Gaussian curve
see Figure 9. Larger the value of , larger the cutoff frequency and milder the filtering is.
See example at the end of this section.


Figure 3.8: 1-D Gaussian distribution with mean 0 and = 1

When letting = r
0
, which leads a more familiar form as previous discussion. So
Equation 3.3.1 becomes:

2 2
0
( , )/2
( , )
D u v r
H u v e

= 3.3.2
When D(u, v) = r
0,
the filter is down to 0.607 of its maximum value of 1.


16

A perspective plot, image display, and radial cross section of a GLPF function are shown
in Figure 10, 11 and 12.

Figure 3.9: Perspective plot of a GLPF transfer function.






Fig ure 3.10: Filter displayed as a image.

17


Figure 3.11: Filter radial cross sections for various values of D
0
= r
0.

Example : Gaussian lowpass filtering:


Original = 1.0 (kernel size 55) = 4.0 (kernel size 1515)

As mentioned earlier, the Gaussian has the same shape in the spatial and Fourier domains
and therefore does not incur the ringing effect in the spatial domain of the filtered image.
This is a advantage over ILPF and BLPF, especially in some situations where any type of
artifact is not acceptable, such as medical image. In the case where tight control over
transition between low and high frequency needed, Butterworth lowpass filter provides
better choice over Gaussian lowpass filter; however, tradeoff is ringing effect.

18


The Butterworth filter is a commonly used discrete approximation to the Gaussian.
Applying this filter in the frequency domain shows a similar result to the Gaussian
smoothing in the spatial domain. But the difference is that the computational cost of the
spatial filter increases with the standard deviation (e.g the size of the filter kernel),
whereas the costs for a frequency filter are independent of the filter function. Hence, the
Butterworth filter is a better implementation for wide lowpass filters, while the spatial
Gaussian filter is more appropriate for narrow lowpass filters.















19

CHAPTER 4
SHARPENING FREQUENCY DOMAIN FILTERS

Sharpening filters emphasize the edges, or the differences between adjacent light
and dark sample points in an image. A highpass filter yields edge enhancement or edge
detection in the spatial domain, because edges contain many high frequencies. Areas of
rather constant gray level consist of mainly low frequencies and are therefore suppressed.
We obtain a highpass filter function by inverting the corresponding lowpass filter, e.g. an
ideal highpass filter blocks all frequencies smaller than r
0
and leaves the others
unchanged. The transfer function of lowpass filter and highpass filter can be related as
follows:
H
hp
(u, v) = 1 H
lp
(u, v) 4.1.1
Where H
hp
(u, v) and H
lp
(u, v) are the transfer function of highpass and lowpass filter
respectively.

4.1 Ideal highpass filter:
The transfer function of an ideal highpass filter with the cutoff frequency r
0
which
follow Equation 4.1.1:
0, if
0
( , ) D u v r s
H(u, v) = 1, if
0
( , ) D u v r >
Again, r
0
is the cutoff frequency and D(u, v) is define in Equation 3.1.1.
Sharpening filters emphasize the edges, or the differences between adjacent light
and dark sample points in an image. A highpass filter yields edge enhancement or edge
detection in the spatial domain, because edges contain many high frequencies. Areas of
rather constant gray level consist of mainly low frequencies and are therefore suppressed.


20


Figure 4.1: Perspective plot, image representation, and cross section of an IHPF.

4.2 Butterworth highpass filter:
The transfer function of Butterworth highpass filter (BHPF) of order n and with cutoff
frequency r
0
is given by:

2
0
1
( , )
1
( , )
n
H u v
r
D u v
(
(
(

=
+
4.2.1

Where D(u, v) is define in Equation 3.1.1. Again, Equation 4.2.1 also follows Equation
4.1.1 and 4.2.1. Figure 14 shows perspective plot, image representation, and cross section
of an BHPF.



Figure 4.2: Perspective plot, image representation, and cross section of a BHPF.


21

4.3 Gaussian High pass filter:
The transfer function of a Gaussian highpass filter (GHPF) with the cutoff
frequency r
0
is given by:
2 2
0
( , )/2
( , ) 1
D u v r
H u v e

= 4.3.1
Where D(u, v) is define in Equation 3.1.1, and r
0
is the distance from the origin in the
frequency plane. Again, Equation 4.3.1 follows Equation 4.1.1.

The parameter , measures the spread or dispersion of the Gaussian curve. Larger the
value of , larger the cutoff frequency and milder the filtering is.
Figure 4.3: Perspective plot, image representation, and cross section of a GHPF.



Example: Results of highpass filtering the image using GHPF of order 2:


Original r
0
=15 r
0
=30 r
0
=80


22

4.4 The Laplacian in the frequency Domain:
Since edges consist of mainly high frequencies, we can, in theory, detect edges by
applying a highpass frequency filter in the Fourier domain or by convolving the image
with an appropriate kernel in the spatial domain. In practice, edge detection is performed
in the spatial domain, because it is computationally less expensive and often yields better
results. As we can see later, we also can detect edges very efficiently using Laplacian
filter in the frequency domain.
The Laplacian is a very useful and common tool in image process. This is a
second derivative operator designed to measure changes in intensity without being overly
sensitive to noise. The function produces a peak at the start of the change in intensity and
then at the end of the change. As we know, the mathematical definition of derivative is
the rate of change in a continuous function. But in digital image processing, image is a
discrete function f(x, y) of integer spatial coordinates. As a result the algorithms will only
be seen as approximations to the true spatial derivatives of the original spatial-continuous
image. The Laplacian of an image will highlight regions of rapid intensity change and is
therefore often used for edge detection (usually called the Laplacian edge detector).
Figure 15 shows a 3-D plot of Laplacian in the frequency domain.

Figure 15: 3-D plot of Laplacian in the frequency domain.
The Laplacian is often applied to an image that has first been smoothed with something
approximating a Gaussian smoothing filter in order to reduce its sensitivity to noise, and
hence the two variants will be described together here. The operator normally takes a
single gray level image as input and produces another gray level image as output.

23

The Laplacian of an image with pixel intensity values f(x, y) (original image) is given by:

2 2
2
2 2
( , ) ( , )
( , )
f x y f x y
f x y
x y
c c
V = +
c c
4.4.1
Since

( )
( ) ( )
n
n
n
d f x
ju F u
dx
(
=
(

4.4.2
Combine Equation 4.4.1 and 4.4.2,


2 2 2
( , ) ( ) ( , ) ( ) ( , ) f x y ju F u v jv F u v ( V = +



( )
2 2
( , ) u v F u v = + 4.4.3
So, from Equation 4.4.3, we know that Laplacian can be implemented in the frequency
domain by using the filter:
2 2
( , ) ( ) H u v u v = + .
For size of M x N image, the filter function at the center point of the frequency rectangle
will be:

2 2
( , )
2 2
M N
H u v u v
(
| | | |
= +
(
| |
\ . \ .
(

4.4.4
Use Equation 4.4.4 for the filter function, the Laplacian-filtered image in the spatial
domain can be obtained by:

| |
2
( , ) ( , ) ( , ) f x y H u v F u v
1
V = 4.4.5

So, how we use the Laplacian for image enhancement in the spatial domain? Here are the
basic ways where the g(x, y) is the enhanced image:

2
( , ) ( , ) f x y f x y V If the center coefficient of the mask is negative
( , ) g x y =

2
( , ) ( , ) f x y f x y +V If the center coefficient of the mask is positive

24

In frequency domain, g(x, y) the enhance image is also possible to be obtained by taking
the inverse Fourier transform of a single mask (filter)


( )
2
2
( , ) 1 / 2 ( / 2) H u v u M v N
(
(
= + +


4.4.6

and the original image f(x, y):

( )
{ }
2
1 2
( , ) 1 / 2 ( / 2) ( , ) g x y u M v N F u v

(
(
= + +


4.4.7

Lets see some of the examples of the Laplacian filtered image shown in example 9.

Example : example of the Laplacian filtering shows up more detail of in
the ring of the Saturn.



In practice, the result image are identical when compute using only spatial domain
techniques or using only frequency domain technique.




25

CHAPTER 5
SPATIAL DOMAIN FILTERING
Suppose we have a digital image which can be represented by a two dimensional
random field ) , ( y x f .
An image processing operator in the spatial domain may be expressed as a mathematical
function | | T applied to the image ) , ( y x f to produce a new image | | ) , ( ) , ( y x f T y x g = as
follows.
| | ) , ( ) , ( y x f T y x g =
The operator T applied on ) , ( y x f may be defined over:
(i) A single pixel ) , ( y x . In this case T is a grey level transformation (or mapping)
function.
(ii) Some neighbourhood of ) , ( y x .
(iii) T may operate to a set of input images instead of a single image.

Example 1
The result of the transformation shown in the figure below is to produce an image of
higher contrast than the original, by darkening the levels below m and brightening the
levels above m in the original image. This technique is known as contrast stretching.








Figure 5.1:transformation of image
Example 2
The result of the transformation shown in the figure below is to produce a binary image.
m
) (r T s =
r

26










Figure 5.2:Binary Image Transformation
Spatial domain: Enhancement by point processing
We are dealing now with image processing methods that are based only on the
intensity of single pixels.
5.1 Intensity transformations
5.1.1 Image Negatives
The negative of a digital image is obtained by the transformation function
r L r T s = = 1 ) ( shown in the following figure, where L is the number of grey levels.
The idea is that the intensity of the output image decreases as the intensity of the input
increases. This is useful in numerous applications such as displaying medical images.








Figure 5.3: Frequency domain filtering procedure
m
) (r T s =
r
1 L
1 L
) (r T s =
r

27

5.1.2 Contrast Stretching
Low contrast images occur often due to poor or non uniform lighting conditions,
or due to nonlinearity, or small dynamic range of the imaging sensor. In the figure of
Example 1 above you have seen a typical contrast stretching transformation.
5.2 Histogram processing
By processing (modifying) the histogram of an image we can create a new image
with specific desired properties.
Suppose we have a digital image of size N N with grey levels in the range ] 1 , 0 [ L .
The histogram of the image is defined as the following discrete function:
2
) (
N
n
r p
k
k
=
where
k
r is the th k grey level, 1 , , 1 , 0 = L k
k
n is the number of pixels in the image with grey level
k
r
2
N is the total number of pixels in the image
The histogram represents the frequency of occurrence of the various grey levels in the
image. A plot of this function for all values of k provides a global description of the
appearance of the image
5.3 Global histogram equalisation
In this section we will assume that the image to be processed has a continuous
intensity that lies within the interval ] 1 , 0 [ L . Suppose we divide the image intensity
with its maximum value 1 L . Let the variable r represent the new grey levels (image
intensity) in the image, where now 1 0 s s r and let ) (r p
r
denote the probability density
function (pdf) of the variable r . We now apply the following transformation function to
the intensity

}
= =
r
r
dw w p r T s
0
) ( ) ( , 1 0 s s r (1) By observing
the transformation of equation (1) we immediately see that it possesses the following
properties:

28

(i) 1 0 s s s .
(ii) ) ( ) (
1 2 1 2
r T r T r r > > , i.e., the function ) (r T is increase ng with r .
(iii) 0 ) ( ) 0 (
0
0
= = =
}
dw w p T s
r
and 1 ) ( ) 1 (
1
0
= = =
}
dw w p T s
r
. Moreover, if the original
image has intensities only within a certain range ] , [
max min
r r then
0 ) ( ) (
min
0
min
= = =
}
r
r
dw w p r T s and 1 ) ( ) (
max
0
max
= = =
}
r
r
dw w p r T s since
max min
and , 0 ) ( r r r r r p
r
> < = . Therefore, the new intensity s takes always all
values within the available range [0 1].

Suppose that ) (r P
r
, ) (s P
s
are the probability distribution functions (PDFs) of the
variables r and s respectively.
Let us assume that the original intensity lies within the values r and dr r + with dr a
small quantity. dr can be assumed small enough so as to be able to consider the function
) (w p
r
constant within the interval ] , [ dr r r + and equal to ) (r p
r
. Therefore,
dr r p dw r p dw w p dr r r P
r
dr r
r
r
dr r
r
r r
) ( ) ( ) ( ] , [ = ~ = +
} }
+ +
.
Now suppose that ) (r T s = and ) (
1
dr r T s + = . The quantity dr can be assumed small
enough so as to be able to consider that ds s s + =
1
with ds small enough so as to be able
to consider the function ) (w p
s
constant within the interval ] , [ ds s s + and equal to ) (s p
s
.
Therefore,
ds s p dw s p dw w p ds s s P
s
ds s
s
s
ds s
s
s s
) ( ) ( ) ( ] , [ = ~ = +
} }
+ +

Since ) (r T s = , ) ( dr r T ds s + = + and the function of equation (1) is increasing with r , all
and only the values within the interval ] , [ dr r r + will be mapped within the interval
] , [ ds s s + . Therefore,
+ = + ] , [ ] , [ ds s s P dr r r P
s r
) (
) (
1
1
) ( ) ( ) ( ) (
s T r
r s s
s T r
r
ds
dr
r p s p ds s p dr r p

=
=
= =
From equation (1) we see that
) (r p
dr
ds
r
=

29

and hence,
1 0 , 1
) (
1
) ( ) (
) (
1
s s =
(

=
s
r p
r p s p
s T r
r
r s


5.4 Local histogram equalisation
Global histogram equalisation is suitable for overall enhancement. It is often
necessary to enhance details over small areas. The number of pixels in these areas my
have negligible influence on the computation of a global transformation, so the use of this
type of transformation does not necessarily guarantee the desired local enhancement. The
solution is to devise transformation functions based on the grey level distribution or
other properties in the neighbourhood of every pixel in the image. The histogram
processing technique previously described is easily adaptable to local enhancement. The
procedure is to define a square or rectangular neighbourhood and move the centre of this
area from pixel to pixel.At each location the histogram of the points in the neighbourhood
is computed and a histogram equalisation transformation function is obtained. This
function is finally used to map the grey level of the pixel centred in the neighbourhood.
The centre of the neighbourhood region is then moved to an adjacent pixel location and
the procedure is repeated. Since only one new row or column of the neighbourhood
changes during a pixel-to-pixel translation of the region, updating the histogram obtained
in the previous location with the new data introduced at each motion step is possible quite
easily. This approach has obvious advantages over repeatedly computing the histogram
over all pixels in the neighbourhood region each time the region is moved one pixel
location. Another approach often used to reduce computation is to utilise non overlapping
regions, but this methods usually produces an undesirable checkerboard effect.
5.5 Histogram specification
Suppose we want to specify a particular histogram shape (not necessarily uniform)
which is capable of highlighting certain grey levels in the image.
Let us suppose that:
) (r p
r
is the original probability density function

30

) (z p
z
is the desired probability density function
Suppose that histogram equalisation is first applied on the original image r
}
= =
r
r
dw w p r T s
0
) ( ) (
Suppose that the desired image z is available and histogram equalisation is applied as
well
}
= =
z
z
dw w p z G v
0
) ( ) (
) (s p
s
and ) (v p
v
are both uniform densities and they can be considered as identical. Note
that the final result of histogram equalisation is independent of the density inside the
integral. So in equation
}
= =
z
z
dw w p z G v
0
) ( ) ( we can use the symbol s instead of v .
The inverse process ) (
1
s G z

= will have the desired probability density function.
Therefore, the process of histogram specification can be summarised in the following
steps.
(i) We take the original image and equalise its intensity using the relation
}
= =
r
r
dw w p r T s
0
) ( ) ( .
(ii) From the given probability density function ) (z p
z
we specify the probability
distribution function ) (z G .
(iii) We apply the inverse transformation function | | ) ( ) (
1 1
r T G s G z

= =











31

CHAPTER 6
SPATIAL DOMAIN ENHANCEMENT
6.1 Spatial domain Enhancement in the case of many realisations of an
image of interest available
6.1.1 Image averaging
Suppose that we have an image ) , ( y x f of size N M pixels corrupted by noise
) , ( y x n , so we obtain a noisy image as follows.
) , ( ) , ( ) , ( y x n y x f y x g + =
For the noise process ) , ( y x n the following assumptions are made.
(i) The noise process ) , ( y x n is ergodic.
(ii) It is zero mean, i.e., { }

=
= =
1
0
1
0
0 ) , (
1
) , (
M
x
N
y
y x n
MN
y x n E
(ii) It is white, i.e., the autocorrelation function of the noise process defined as


=

=
+ +

= + + =
k M
x
l N
y
l y k x n y x n
l N k M
l y k x n y x n E l k R
1
0
1
0
) , ( ) , (
) )( (
1
)} , ( ) , ( { ] , [ is zero,
apart for the pair ] 0 , 0 [ ] , [ = l k .
Therefore, | | ) , ( ) , ( ) , (
) )( (
1
,
1
0
1
0
2
) , (
l k l y k x n y x n
l N k M
l k R
k M
x
l N
y
y x n
o o


=

=
= + +

= where
2
) , ( y x n
o is the variance of noise.

Suppose now that we have L different noisy realisations of the same image ) , ( y x f as
) , ( ) , ( ) , ( y x n y x f y x g
i i
+ = , L i , , 1 , 0 = . Each noise process ) , ( y x n
i
satisfies the properties
(i)-(iii) given above. Moreover,
2 2
) , (
o o =
y x n
i
. We form the image ) , ( y x g by averaging
these L noisy images as follows:

= = =
+ = + = =
L
i
i
L
i
i
L
i
i
y x n
L
y x f y x n y x f
L
y x g
L
y x g
1 1 1
) , (
1
) , ( )) , ( ) , ( (
1
) , (
1
) , (

32

Therefore, the new image is again a noisy realisation of the original image ) , ( y x f with
noise

=
=
L
i
i
y x n
L
y x n
1
) , (
1
) , ( .
The mean value of the noise ) , ( y x n is found below.
0 )} , ( {
1
)} , (
1
{ )} , ( {
1 1

= =
= = =
L
i
i
L
i
i
y x n E
L
y x n
L
E y x n E
The variance of the noise ) , ( y x n is now found below.
2
1
2
2

1 1
2
1
2
2

1 1
2
1
2
2
2
1
2
2
1
2 2
) , (
1
0
1
)} , ( ) , ( {
1
)} , ( {
1
))} , ( ) , ( ( {(
1
)} ) , ( {(
1
) , (
1
) , (
1
)} , ( {
o o
o
L L
y x n y x n E
L
y x n E
L
y x n y x n E
L
y x n E
L
y x n E
L
y x n
L
E y x n E
L
i
j i
j i
L
i
L
j
L
i
i j i
j i
L
i
L
j
L
i
i
L
i
i
L
i
i y x n
= + =
+ = + =

|
.
|

\
|
=

|
.
|

\
|
= =



=
=
= = =
=
= = =
= =

Therefore, we have shown that image averaging produces an image ) , ( y x g , corrupted by
noise with variance less than the variance of the noise of the original noisy images. Note
that if L we have 0
2
) , (

y x n
o , the resulting noise is negligible.
6.2 Spatial domain: Enhancement in the case of a single image
6.2.1 Spatial masks
Many image enhancement techniques are based on spatial operations performed
on local neighbourhoods of input pixels.
The image is usually convolved with a finite impulse response filter called spatial mask.
The use of spatial masks on a digital image is called spatial filtering.
Suppose that we have an image ) , ( y x f of size
2
N and we define a neighbourhood
around each pixel. For example let this neighbourhood to be a rectangular window of size
3 3

1
w
2
w
3
w
4
w
5
w
6
w

33

7
w
8
w
9
w

If we replace each pixel by a weighted average of its neighbourhood pixels then the
response of the linear mask for the pixel
5
z is

=
9
1 i
i i
z w . We may repeat the same process
for the whole image.
6.2.2 Lowpass and highpass spatial filtering
A 3 3 spatial mask operating on an image can produce (a) a smoothed version of
the image (which contains the low frequencies) or (b) it can enhance the edges and
suppress essentially the constant background information. The behaviour is basically
dictated by the signs of the elements of the mask.
Let us suppose that the mask has the following form

a b c
d
1 e
f
g
h

To be able to estimate the effects of the above mask with relation to the sign of the
coefficients h g f e d c b a , , , , , , , , we will consider the equivalent one dimensional mask

d
1 e

Let us suppose that the above mask is applied to a signal ) (n x . The output of this
operation will be a signal ) (n y as
+ + = + + + =

) ( ) ( ) ( ) ( ) 1 ( ) ( ) 1 ( ) (
1
z ezX z X z X dz z Y n ex n x n dx n y
+ + =

) ( ) 1 ( ) (
1
z X ez dz z Y ez dz z H
z X
z Y
+ + = =

1 ) (
) (
) (
1
. This is the transfer function of a
system that produces the above input-output relationship. In the frequency domain we
have ) exp( 1 ) exp( ) ( e e
e
j e j d e H
j
+ + = .
The values of this transfer function at frequencies 0 = e and t e = are:

34

e d e H
j
+ + =
=
1 ) (
0 e
e

e d e H
j
+ =
=
1 ) (
t e
e

If a lowpass filtering (smoothing) effect is required then the following condition must
hold
0 ) ( ) (
0
> + = >
= =
e d e H e H
j j
t e
e
e
e

If a highpass filtering effect is required then
0 ) ( ) (
0
s + = s
= =
e d e H e H
j j
t e
e
e
e

The most popular masks for lowpass filtering are masks with all their coefficients
positive and for highpass filtering, masks where the central pixel is positive and the
surrounding pixels are negative or the other way round.

6.3 Popular techniques for lowpass spatial filtering
6.3.1 Uniform filtering
The most popular masks for lowpass filtering are masks with all their coefficients
positive and equal to each other as for example the mask shown below. Moreover, they
sum up to 1 in order to maintain the mean of the image.







6.3.2 Gaussian filtering
The two dimensional Gaussian mask has values that attempts to approximate the
continuous function
2
2 2
2
2
1
) , (
o
to
y x
e y x G
+

9
1


1 1

1 1 1

1

1

1

1

35

In theory, the Gaussian distribution is non-zero everywhere, which would require an
infinitely large convolution kernel, but in practice it is effectively zero more than about
three standard deviations from the mean, and so we can truncate the kernel at this point.
The following shows a suitable integer-valued convolution kernel that approximates a
Gaussian with a o of 1.0.











6.3.3 Median filtering
The median m of a set of values is the value that possesses the property that half
the values in the set are less than m and half are greater than m. Median filtering is the
operation that replaces each pixel by the median of the grey level in the neighbourhood of
that pixel.Median filters are non linear filters because for two sequences ) (n x and ) (n y
{ } { } { } ) ( median ) ( median ) ( ) ( median n y n x n y n x + = +
Median filters are useful for removing isolated lines or points (pixels) while preserving
spatial resolutions. They perform very well on images containing binary (salt and
pepper) noise but perform poorly when the noise is Gaussian. Their performance is also
poor when the number of noise pixels in the window is greater than or half the number of
pixels in the window (why?)


Isolated
point
Median filtering
0
0 0
0
0
0
0
0
0
0
1 0
0
0
0
0
0
0

273
1


26 4

7 4 1

7

26

41

16

26

16

4

4

16

26

16

1

4

7

4

7

4

1

4

1

36

6.3.4 Directional smoothing
To protect the edges from blurring while smoothing, a directional averaging filter can be
useful. Spatial averages ) : , ( u y x g are calculated in several selected directions (for
example could be horizontal, vertical, main diagonals)

e
=
) , (
) , (
1
) : , (
l k W
l y k x f
N
y x g
u u
u
and a direction
-
u is found such that ) : , ( ) , (
-
u y x g y x f is minimum. (Note that
u
W is
the neighbourhood along the direction u and
u
N is the number of pixels within this
neighbourhood).
Then by replacing ) : , ( with ) : , (
-
u u y x g y x g we get the desired result.

6.3.5 High Boost Filtering
A high pass filtered image may be computed as the difference between the original image
and a lowpass filtered version of that image as follows:
(Highpass part of image)=(Original)-(Lowpass part of image)
Multiplying the original image by an amplification factor denoted by A, yields the so
called high boost filter:
(Highboost image)= ) ( A (Original)-(Lowpass)= ) 1 ( A (Original)+(Original)-
(Lowpass)
= ) 1 ( A (Original)+(Highpass)
The general process of subtracting a blurred image from an original as given in the first
line is called unsharp masking. A possible mask that implements the above procedure
could be the one illustrated below.






+
9
1

-1
-1 -1
-1
-1
-1
-1
-1
-1
0
A

0
0
0
0
0
0
0

37







6.4 Popular techniques for highpass spatial filtering Edge detection
using derivative filters
6.4.1 About two dimensional high pass spatial filters
An edge is the boundary between two regions with relatively distinct grey level
properties. The idea underlying most edge detection techniques is the computation of a
local derivative operator. The magnitude of the first derivative calculated within a
neighbourhood around the pixel of interest, can be used to detect the presence of an edge
in an image.
The gradient of an image ) , ( y x f at location ) , ( y x is a vector that consists of the partial
derivatives of ) , ( y x f as follows.
(
(
(
(
(

c
c
c
c
= V
y
y x f
x
y x f
y x f
) , (
) , (
) , (
The magnitude of this vector, generally referred to simply as the gradient f V is
2 / 1
2
2
) , ( ) . (
)) , ( ( mag ) , (
(
(

|
|
.
|

\
|
c
c
+ |
.
|

\
|
c
c
= V = V
y
y x f
x
y x f
y x f y x f
Common practice is to approximate the gradient with absolute values which is simpler to
implement as follows.

y
y x f
x
y x f
y x f
c
c
+
c
c
~ V
) , ( ) , (
) , (

9
1

1 9 A

-1 -1

-1 -1 -1

-1

-1

-1

38

(1) Consider a pixel of interest
5
) , ( z y x f = and a rectangular neighbourhood of size
9 3 3 = pixels (including the pixel of interest) as shown below.








6.4.2 Roberts operator
Equation (1) can be approximated at point
5
z in a number of ways. The simplest is to use
the difference ) (
8 5
z z in the x direction and ) (
6 5
z z in the y direction. This
approximation is known as the Roberts operator, and is expressed mathematically as
follows.

6 5 8 5
z z z z f + ~ V (2)
Another approach for approximating (1) is to use cross differences

8 6 9 5
z z z z f + ~ V (3)









Equations (2), (3) can be implemented by using the following masks. The original image
is convolved with both masks separately and the absolute values of the two outputs of the
convolutions are added.
Roberts operator
0 1
-1 0
1 0
0 -1
1 0
-1 0
1 -1
0 0
Roberts operator
7
z

8
z
1
z
2
z

3
z
4
z

5
z
6
z
9
z
y
x

39

CHAPTER 7
CONCLUSIONS
Most of the techniques are useful for altering the gray level values of individual
pixels and hence the overall contrast of the entire image. But they usually enhance the
whole image in a uniform manner which in many cases produces undesirable results.
There are various techniques available which produce highly balanced and visually
appealing results for a diversity of images with different qualities of contrast and edge
information and it will produce satisfactory result.

Digital Image Processing (DIP) involves the modification of digital data for
improving the image qualities with the aid of computer. The processing helps in
maximising clarity, sharpness and details of features of interest towards in formation
extraction and further analysis. At that time not only the theory and practice of digital
image processing was in its infancy but also the cost of digital computers was very high
and their computational efficiency was far below by presentstandards. Today, access to
low cost and efficient computer hardware and software is commonplace and the source of
digital image data are many and varied. The digital image sources range from commercial
earth resources satellites, airborne scanner, airborne solid-state camera, scanning micro-
densitometer to high-resolution video camera.Digital image processing is a broad subject
and often involves procedures which can be mathematically complex, but central idea
behind digital image processing is quite simple. The digital image is fed into a computer
and computer is programmed to manipulate these data using an equation, or series of
equations and then store the results of the computation for each pixel (picture element).
These results form a new digital image that may bedisplayed or recorded in pictorial
format or may itself be further manipulated by additional computer programs. The
possible forms of the digital image manipulation are literally infinite. The raw digital data
when viewed on the display will make it difficult to distinguish fine features. To
selectively enhance certain fine features in the data and to remove certain noise, the
digital data is subjected to various image processing operations.


40

REFERENCES

[1] R. C. Gonzales and R. E. Woods, Digital Image Processing Addison-Wesley
Publishing Company, 1992.
[2] A. K. Jain, Prentice Hall ,Fundamentals of Digital Image Processing , 1989.
[3] Raman Maini and Himanshu Aggarwal, A Comprehensive Review of Image
Enhancement Techniques, Journal of Computing, Vol. 2, Issue 3, March 2010,
ISSN 2151-9617.
[4] Rajesh Garg, Bhawna Mittal, Sheetal Garg, Histogram Equalization Techniques for
Image Enhancement, IJECT Vol. 2, Issue 1, March2011, ISSN 2230-9543.
[5] Gonzalez, Rafael C., Richard E. Woods. : Digital Image Processing. Ed III,
Pearson Education Asia, New Delhi, 2007.
[6] Arun R, Madhu S. Nair, R. Vrinthavani and Rao Tatavarti. An Alpha Rooting Based
Hybrid Technique for Image Enhancement. Online publication in IAENG, 24th
August 2011.
[7] Komal Vij, Yaduvir Singh, Comparison between Different Techniques of Image
Enhancement International Journal of VLSI and Signal Processing Volume 2,
Issue 4, April 2012 www.ijarcsse.com
[8] K.Arulmozhi, S.Arumug, Perumal, K.Kannan, S.Bharathi, Contrast Improvement of
Radiographic Images in Spatial Domain by Edge Preserving Filters, International
Journal of Computer Science and Network Security, Vol.10 No.2, February 2010.
[9] Agaian, SOS S., Blair Silver, Karen A. Panetta, Transform Coefficient Histogram-
Based Image Enhancement Algorithms Using Contrast Entropy, IEEE Transaction
on Image Processing, Vol. 16, No. 3, March 2007.

Das könnte Ihnen auch gefallen