You are on page 1of 42

See

discussions, stats, and author profiles for this publication at: https://www.researchgate.net/publication/267097158

Image Enhancement -Spatial vs. Frequency


Domain Filters

Technical Report May 2014


DOI: 10.13140/2.1.1256.7042

CITATIONS READS

0 9,789

1 author:

Sarah Ali
Dijlah University College
5 PUBLICATIONS 1 CITATION

SEE PROFILE

All content following this page was uploaded by Sarah Ali on 20 October 2014.

The user has requested enhancement of the downloaded file.


Computer Techs.Eng.Dept.

(Image Enhancement - Spatial vs. Frequency Domain Filters)

A report Submitted to the Department of Computer Techniques


Engineering
Dijlah University College in partial Fulfillment of the Requirement for the
Degree of B.Sc. Eng.
in
Computer Techniques

By

1 . Mohammed Bakr Alaa


2 . Sally Iyad honest
3 . Osama Salem Jabbar
4 . Omar Abdul Amir student

Supervised by

Assist. Lecturer: Sarah Ali Abdullah

2013
SUPERVISOR CERTIFICATION

I certify that this project entitled Image


Enhancement - Spatial vs. Frequency Domain Filters was
prepared under my supervision at the Department of
Computer Techniques Engineering, Dijlah University
College - Baghdad, in partial fulfillment of the
requirements for the degree of B.Sc. Eng. in Computer
Techniques Engineering.

Signature:
Name:
Date: 3 / 5 / 2014
Abstract

The purpose of this project is to explore some simple image enhancement


algorithms. This project introduces spatial and frequency domain filters.
Thus it involves creating masks, performing convolution, Fourier
transforms and inverse Fourier transforms. An in-depth understanding of
the Fourier transform is critical to the understanding of this project.

I

List of Content

Abstract . I

List of Content .. II

Chapter One: Introduction

1.1 Background..........1

1.2 Classification of image....... 2

1.2.1 Intensity Images.......................................................................2

1.2.2 Indexed Images........................................................................2

1.2.3 Binary Images..........................................................................2

1.2.4 Grayscale Images.....................................................................3

1.2.5 True color Images....................................................................4

Chapter Two: Image Enhancement Techniques

2.1 Image Enhancement................................... 6

2.2 Frequency domain techniques ........................ 8

2.3 Spatial Domain Methods....... 13

2.3.1 Basic Spatial Filtering (Mask processing)....................... 14

Chapter Three: Designing Spatial and Frequency Domain Filters


Using MATLAB

3.1 Introduction... 17

3.2 Part one (LPF and HBF in frequency domain)...............................17

II

3.3 Part Two (LPF and HBF in Spatial Domain)...................................19

Chapter Four: Simulation Result, Analysis and Discussions

4.1 Introduction ......... 22

4.2 Part one frequency domain result...................................... 22

4.3 Part two spatial domain results...................................................... 23

4.4 Discussion/...................................................................................... 25

Chapter Five: Conclusions and Suggestions for Further Work

5.1 Conclusion........................................................................................26

5.2 Further work.....................................................................................26

Reference..............................................................................................27

III

Chapter One
Introduction

1.1 Background

Digital Image Processing (DIP) involves the modification of digital data for
improving the image qualities with the aid of computer. The processing
helps in maximizing clarity, sharpness and details of features of interest
towards information extraction and further analysis. This form of remote
sensing actually began in 1960s with a limited number of researchers
analyzing airborne multispectral scanner data and digitized aerial
photographs. However, it was not until the launch of Landsat-1, in 1972,
that digital image data became widely available for land remote ensuing
applications. 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 present
standards. 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 [1].
Image Enhancement (IE) transforms images to provide better
representation of the subtle details. It is an indispensable tool for
researchers in a wide variety of fields including (but not limited to) medical
imaging, art studies, forensics and atmospheric sciences. It is application
specific: an IE technique suitable for one problem might be inadequate for
another. For example forensic images/videos employ techniques that
resolve the problem of low resolution and motion blur while medical
imaging benefits more from increased contrast and sharpness. To cater for

1

such an ever increasing demand of digital imaging, software companies
have released commercial softwares for users who want to edit and visually
enhance the images [2].

1.2 Classification of images

1.2.1 Intensity Images


An intensity image is a data matrix whose values have been scaled to
represent intensities. When the elements of an intensity image are of class
unit 8, or class unit 16, they have integer values in the range [0, 255] and
[0, 65535].respectively. If the image is of class double, the values are
floating-point numbers. Values of scaled, class double intensity images are
in the range [0, 1] by convention [3].

1.2.2 Indexed Images

Array of class logical, unit 8, Unit 16, single, or double whose pixel values
are directed indices into a color map. The color map is an m-by-3 array of
class double. For single or double arrays, integer values range from [1, p].
For logical, unit8, or unit 16 arrays, values range from [0, p-1]. An indexed
image consists of an array and a color map matrix. The pixel values in the
array are directed indices into a color map. By convention, this
documentation uses the variable name X to refer to the array and map to
refer to the color map [3].

1.2.3 Binary Images

Binary images have a very specific meaning in MATLAB. In a binary


image, each pixel assumes one of only two discrete values: 1 or 0,
interpreted as black and white, respectively. A binary image is stored as a

2

loogical arraay. Thus, an array oof 0s and
d 1s whosee values aare of dataa class,
saay, unit8, is
i not considered a bbinary im
mage in MA
ATLAB [33].

Figure 11.1: Binarry Images [4].

1..2.4 Grayyscale Ima


ages

A grayscalle image (also


( calleed gray-sccale, gray scale, orr gray-leveel) is a
daata matriix whosee values representt intensitties withiin some range.
MATLAB stores a grayscalee image as
M a an indiividual m
matrix, witth each
ellement off the matrix correspponding to
o one imaage pixel.. By conv
vention,
thhis docum
mentation uses
u the vvariable naame I to refer
r to gr
grayscale images.
i
A
Array of cllass unit8, unit16, int16, sin ouble whoose pixel values.
ngle, or do
For unit8, values
Foor single or doublee arrays, values raange from [0, 1]. F
raange from
m [0, 255].. For unit16, valuess range frrom [0, 655535]. Forr int16,
vaalues rangge from [-3
32768, 32767].

3

Figure 1.2: Graysccale Imagees [4].

1..2.5 True color Images

A true coloor image is an imaage in whiich each pixel


p is sppecified by three
vaalues one each forr the red, blue, and
d green component
c ts of the pixels
TLAB store true coolor imagees as an m-by-n-by-
coolor. MAT m -3 data arrray that
deefines redd, green, and
a blue color com
mponents for each individual pixel.
True color images do he color of each pixel
d not usse a colorr map. Th p is
deeterminedd by the co
ombinationn of the reed, green, and blue iintensitiess stored
inn each collor plane at
a the pixeels locatiion. Graph
hics file foormats sto
ore true
coolor imagees as 24-b
bit imagess, where th
he red, green, and bblue comp
ponents
arre 8 bits each.
e Thiss yields a potential of 16 milllion colorrs. The prrecision
with whichh a real-life image can be reeplicated has led too the com
w mmonly
ussed term true
t color image [3].

4

Figuree1.3: Colo
or Image [4].

5

Chapter Two
Image Enhancement Techniques

2.1 Image Enhancement

The main definition of enhancing is to make something greater in value,


desirability or attractiveness. The term of enhancement implies a process to
improve the visual quality of the image. Image Enhancement transforms
images to provide better representation of the subtle details. 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 processes consist of a collection of techniques that seek to
improve the visual appearance of an image or to convert the image to a
form better suited for analysis by a human or a machine. In an image
enhancement system, there is no conscious effort to improve the fidelity of
a reproduced image with regard to some ideal form of the image, as is done
in image restoration.
Actually, there is some evidence to indicate that often a distorted image, for
example, an image with amplitude overshoot and undershoot about its
object edges, is more subjectively pleasing than a perfectly reproduced
original. Enhancement of an image is necessary to improve appearance or
to highlight some aspect of the image is converted from one into another
acquired, scanned, transmitted, copied or printed many types of noise can
be present in the image. Image enhancement has come to specifically mean
a process of smothering irregularities or noise that has somehow corrupted
the image. The term image enhancement has been widely used in the past
to describe any operation that improves image quality by some criteria.

6

However, in the recent years the meaning of the term has evolved to denote
image-preserving noise smoothing.
This primarily serves to distinguish it from similar-sounding terms, such as
image restoration and image reconstruction, which also taking specific
meaning. Image enhancement has played and will continue to play an
important role into different fields such as medical, industrial, military and
scientific applications. In addition to these applications, image
enhancement is increasingly being used in consumer electronics. Internet
Web users, for instance, not only rely on built-in image processing
protocols such as JPEG (Joint Photographic Expert Group) and
interpolation, but they also have become image processing users equipped
with powerful yet inexpensive software such as Photoshop. Users not only
retrieve digital images from the Web but they are now able to acquire their
own by use of digital cameras or through digitization services. Image
enhancement is an indispensable tool for researchers in a wide variety of
fields:
1. In forensics, image enhancement is used for identification, evidence
gathering and surveillance. Images obtained from fingerprint detection,
security videos analysis and crime scene investigations are enhanced to
help in identification of culprits and protection of victims.
2. In atmospheric sciences IE is used to reduce the effects of haze, fog, mist
and turbulent weather for meteorological observations. It helps in detecting
shape and structure of remote objects in environment sensing. Satellite
images undergo image restoration and enhancement to remove noise.
3. Astrophotography faces challenges due to light and noise pollution that
can be minimized by IE. For real time sharpening and contrast
enhancement several cameras have in-built IE functions. Moreover,
numerous softwares allow editing such images to provide better and bright
results.

7

4. In oceanography the study of images reveals interesting features of water
flow, remains concentration, geomorphology and bathymetric patterns to
name a few. These features are more clearly observable in images that are
digitally enhanced to overcome the problem of moving targets, deficiency
of light and obscure surroundings.
5. IE techniques when applied to pictures and videos help the visually
impaired in reading small print, using computers and television and face
recognition. Several studies have been conducted that highlight the need
and value of using IE for the visually impaired.
6. The technique of image enhancement is often employed by virtual
restoration of historic paintings and artifacts in order to reduce stains and
crevices. Color contrast enhancement, sharpening and brightening are just
some of the techniques used to make the images bright. IE is a powerful
tool for restorers who can inform decisions by viewing the results of
restoring a painting beforehand. It is evenly useful in discerning text from
worn-out historic documents.
7. In the field of e-learning, IE is used to clarify the contents of chalkboard
as viewed on streamed video; it improves the content readability and helps
students to focus on the text. Similarly, collaboration through the
whiteboard is facilitated by enhancing the shared data and diminishing
artifacts like shadows and blemishes.
8. Medical imaging uses IE techniques for reducing noise and sharpening
details to improve the visual representation of the image. Since minute
details play a critical role in diagnosis and treatment of disease, it is
essential to highlight important features while displaying medical images.
This makes IE a necessary aiding tool for viewing anatomic areas in MRI,
ultrasound and x-rays to name a few.
9. Numerous other fields including law enforcement, microbiology,
biomedicine, bacteriology, climatology, meteorology, etc., benefit from

8

vaarious IE technique
t s. These bbenefits arre not limiited to proofessional studies
annd busineesses but extend tto the co
ommon users
u whoo employ IE to
coosmeticallly enhancee and corrrect their im
mages [5] [6] [7].
The follow
wing image explainns the diffferent typees of imaage enhan
ncement
teechniques..

Figure 2.1: Imagge Enhanccement Techniques [7].

2.2 Frequ
uency do
omain tecchniques

Frrequency domain techniquees are baased on the maniipulation of the


orrthogonal transform
m of the im
mage rath he image iitself. Frequency
her than th
doomain tecchniques are
a suitedd for proccessing the image aaccording
g to the
frrequency content.
c The
T principple behind
d the frequency dom
main meth
hods of
im
mage enhaancement consists oof computiing a 2-D discrete uunitary traansform
off the imaage, for instance the 2-D DFT, maanipulatingg the traansform
cooefficientss by an op
perator M
M, and then
n perform
ming the innverse tran
nsform.
The orthogonal transsform of thhe image has two componentts magnitu
ude and
phhase. The magnitud
de consistss of the frrequency content off the imag
ge. The
phhase is ussed to resttore the im
mage bacck to the spatial
s doomain. Thee usual

9

orthogonal transforms are discrete cosine transform, discrete Fourier
transform, Hartley Transform etc. The transform domain enables operation
on the frequency content of the image, and therefore high frequency
content such as edges and other subtle information can easily be enhanced.
Frequency domain which operate on the Fourier transform of an image.
Edges and sharp transitions (e.g. noise) in an image contribute
significantly to high frequency content of Fourier transform.
Low frequency contents in the Fourier transform are responsible to the
general appearance of the image over smooth areas.
The concept of filtering is easier to visualize in the frequency domain.
Therefore, enhancement of image f(x, y) can be done in the frequency
domain based on DFT. This is particularly useful in convolution if the
spatial extent of the point spread sequence h(x, y) is large then convolution
theory [8].
G (x, y) = h(x, y)*f(x, y)
Where g(x, y) is enhanced image.

There are three basic steps to frequency domain filtering: [9]


1. The image must be transformed from the spatial domain into the
frequency domain using the Fast Fourier transform.
2. The resulting complex image must be multiplied by a filter (that usually
has only real values).
3. The filtered image must be transformed back to the spatial domain.

10

Figure 2.2: Frequency Domain Filtering Operation [9].

Types of frequency domain filters


1) Low pass filter
2) High pass filter
3) Band pass filter
4) Band stop filter

1. Low-pass filter
Low-pass filters exist in many different forms, including electronic circuits
(such as a hiss filter used in audio), anti-aliasing filters for conditioning
signals prior to analog-to-digital conversion, digital filters for smoothing
sets of data, acoustic barriers, blurring of images, and so on. The moving
average operation used in fields such as finance is a particular kind of low-
pass filter, and can be analyzed with the same signal processing techniques
as are used for other low-pass filters. Low-pass filters provide a smoother
form of a signal, removing the short-term fluctuations, and leaving the
longer-term trend.
H(u,v)= 0 if D (u,v)<= D0
1 if D (u,v)> D0

11

W
Where D0 is a specifiied nonneggative quaantity, and
d D (u,v) i s the distaance
frrom the pooint to the center off the frequeency rectaangle. [10]]

Figure 2.3:
2 (a) Perrspective pplot of an ideal low
w-pass filteer function
n. (b)
Filterr displayed as an im
mage. (c) Filter
F radiaal cross seection [10]].

22. High pass filter


High pass filtering means thhat we fiilter away
H y the low
w frequencies of
soomething, and let the
t high frequency
y bands pass.
p In im
mage term
ms, this
means that the detail of an im
m mage is keept, while the largeer scale grradients
arre removeed. Luckily
y, it's not as compliicated as it
i sounds. Ideal hig
gh-pass
i defined as:
fiilter HPF is
H(u,v)= 0 if D (u,v) <=
= D0
1 if D (u,v) > D0

W t cut offf distance is measured from th


Where D0 the he distancee from thee origin
off the frequuency recttangle, andd D (u,v) is
i the distaance from
m the origin
n of the
Foourier trannsform, u & v are ffrequency
y variabless of the Foourier tran
nsform.
This filter is the op
pposite of the Ideall low passs filter thhat is zero
oing all
frrequenciess inside th
he circle off radius D0 while passing witthout atten
nuation
anny frequenncy outsid
de the circlle [10].

12

Figure 2.4: (a) Perrspective pplot of an ideal high
h-pass filteer function
n. (b)
Filterr displayed as an im
mage. (c) Filter
F radiaal cross seection [10]].

2.3 Spatiaal Doma


ain Meth
hods

The value of x, y) in the enhanceed image is the


o a pixel with coorrdinates (x
reesult of peerforming some op eration on
n the pixeels in the nneighborh
hood of
(xx, y) in thhe input im
mage, F. N hoods can be any shhape, but usually
Neighborh
thhey are recctangular [3].

Figurre 2.5: Sppatial Dom


main of an Image [3]].

13

Image Processing in the spatial domain can be Expressed by: g (m, n) =T (f
(m, n)). Where f (m, n) is the input image, g (m, n) is the processed Image
and T is the operator defining the modification process. The operator =T, is
typically a single-valued and monotone function that can operate on
individual pixels or on selective value of the input Image is used to
compute the corresponding pixel value for the output Image. Within the
input image are used to compute the modified image at any given point.
One can consider point processing as a special case of region processing
where the region is composed of a single pixel. The point-processing
operator can also be expressed by: S=T(r), Where r and s are variables
denoting the intensity level of f(m , n) and g(m ,n) at any point (m ,n). The
following sections describe several point-and region-based image
enhancement techniques. The second article will also discuss spatial
smoothing, which is another example of region-based image processing,
and compare its advantages and disadvantages with transform domain
methods. The smallest possible neighborhood is of size 1 X 1. In this case g
depends only on the value of f at a single point (x, y) and T [3].

2.3.1 Basic Spatial Filtering (Mask processing)

The spatial filtering process consists of simply moving the filter mask from
point to point in an image. At each point the response of filter is calculated
using a predefined relationship. Here two smoothening spatial filters -
mean and median are discussed.
The goal of image filtering is to reduce impulse noise or Gaussian noise
using a Median and Mean Filters. A 2-D median filtering operation is
performed by sliding a P x P window over the entire image and replacing
the center pixel by the median of the pixels in that window.

14

V(m,n)=(k,l)w a (k,l) y (m-k,n-l)
Where: y(m,n), v(n,m) are the input image and output image W is the
windows:
V(m,n)=1/NW(k,l)w y (m-k,n-l)

Obviously, P must be an odd integer in order to define a center pixel. The


filtered pixel values are stored in another matrix, which forms the
processed image. A mean filter works the same way as above except that
the filtered version of the center pixel is the mean of the window. Mean and
median filters are effective for reducing different types of noise.
Experiments with the Roberts and Sobel edge detectors indicate that we
need to combine low pass filtering (or smoothing) with a derivative
operator if we want to generate edge maps that do not contain noisy
spurious edges. The effect of low pass filtering in the spatial domain is to
blur the sharp edges, and therefore increase the uncertainty about the
location of the edges. In fact, recall that we used a high pass filtering
technique (unsharp masking) to increase the contrast of the edges. As is
often the case in the design of optimal filters, edge detection involves two
conflicting goals: cancellation of noise and minimization of spatial
smoothing [11].

15

Figure 2.6: The M
Mechanics of Spatial Filteringg [6].

16

Chapter Three
Designing Spatial and Frequency Domain Filters Using
MATLAB

3.1 Introduction

MATLAB is a very powerful, high level language. It is also very easy to


use. It comes with a wealth of libraries and toolboxes, which you can use
directly, so that you don't need to program low level functions. It enables us
to display very easily results on graphs and images. To get started with it,
you need to understand how to manipulate and represent data, how to find
information about the available functions and how to create scripts and
functions to generate programs [12]. We will demonstrate various aspects
of filtering; including spatial and frequency domains and we will analysis
the frequency response of various filters and their interpretation.

During this session, you will learn & practice:

1- Filter synthesis in spatial and frequency domain.

2- Filter response analysis.

3- Various examples of commonly used filters.

4- Noise removal using various filters.

3.2 Part One (LPF and HBF in Frequency Domain)

In general these enhancement operations are performed by multiplying the


frequency coefficients by some weights representing the frequency
response of the filter. The enhanced image is then obtained by performing
the inverse transform.

17

1. Low Pass Filter:

Lowpass filters in frequency domain simulation functions and script are


shown in appendix:

1. Multiply the input image by (-1) X+Y to center the transform


2. Compute F (u,v)
3. Multiply F (u,v) by a filter function H (u,v)
4. Compute the inverse DFT of the result in (3)
5. Obtain the real part of (4)
6. Multiply the result in (5) by (-1) X+Y

That is, multiplication with shifts the origin of the spectrum to u=M/2,
v=N/2.

2. High Pass Filter


Highpass filters in frequency domain functions and script are shown in
appendix:
The highpass filter (Hhp) is often represented by its relationship to the
lowpass filter (Hlp):
Hhp (u,v)= 1- Hlp (u,v)

18

3.3 Part Two (LPF and HBF in Spatial Domain)

Convolving mask with image is carried out by sliding the mask over the
image, multiplying mask values with the pixel values falling beneath them
and obtaining the sum. The sum is used as the value for the position of the
center of the mask over the image.

1.Low Pass Filter:

Lowpass filters in spatial domain functions and script are shown in


appendix:

1. Implement lowpass filtering in the spatial domain by using a mask with


all positive coefficients
2. More blurring for a narrower frequency-domain filter or a wider
spatial-domain filter (i.e., a larger mask)

2.High Pass Filter with Center 9 & 8:

1. Construct a highpass filter as a difference of Gaussians.

2. The spatial highpass filter has both negative and positive values.

19

Chapter Four
Simulation Result, Analysis and Discussions

4.1 Introduction

In this chapter the results of the simulation which presented in chapter three
are introduced to evaluate the performance of image enhancement in
frequency domain techniques and spatial domain techniques are based on
the manipulation of the orthogonal transform of the image rather than the
image itself are included within the following section, which are evaluated
and discussed for each type. Below are the results from the spatial domain
and the frequency domain along with their difference image.

4.2 Part one frequency domain result:

1. LPF
Output of enhancement process using LPF first order cases blurs image by
reducing the shape edges located within it as shown in figure (4.1, 4.2, and
4.3).

Figure 4.1: Original image.

20


Figure 4.2: LPF in Frequency Domain.


Figure 4.3: Image after Filtering.

2. HPF
Figure (4.4) that show HPF in frequency domain and figure (4.5) show the
output image after affect HPF by increasing high frequency and edge
enhancement sharpen (or shows the edges of) an image.

21

Figure 4.4: HPF in Frequency Domain

Figure 4.5: Image after Filtering.

22

4.3 Part two spatial domain results:

1. LPF
Output of enhancement process using LPF in spatial domain first order
cases blurs image by reducing the shape edges located within it as shown in
figure (4.6 and 4.7).

Figure 4.6: original image

Figure 4.7: The output image after filtering effect LBF

23

2.High Pass Filter with Center 9

Figure 4.8 shows the affect the effect of HPF with center 9 by keeping the
shape of object with edge accentuate.

Figure 4.8: The output image after filtering effect HBF with center 9

3. High Pass Filter with Center 8

Figure 4.9 shows in the output image the effect of HPF with center 8 the
background of image became zero with accentuate the shape edge.

Figure 4.9: The output image after filtering effect HBF with center 9

24

4.4 Discussion:

Filtering in the frequency domain enhancement task would become


trivial to formulate more computational efficiency for a large
window size in the frequency domain, the data is fourier
transformed. Filtering in the spatial domain we often specify small
spatial mask that attempt to capture the essence of the full filter
function so that it is fast and less complexity.
With Fourier filtering you can adapt to local image content by
performing your transformation to the spatial domain over whatever
size or shape region you choose. The spatial frequency content,
which is not highly adaptable to local image content since it applies
to the image as a whole.

25

Chapter Five
Conclusions and Suggestions for Further Work

5.1 Conclusion

The above discussion and various results obtained lead to the conclusion
that it is easier to comprehend the concepts of Digital Image Processing
and specifically various image enhancement techniques with the help of
their simulation on MATLAB. As it is evident from the results, the both
ways for filtering (frequency and spatial) domain are more or less the same.
When needed to image enhancement with a small kernel, would like to
advise to use the spatial domain, instead of the frequency domain, since the
Fourier transformation takes some time. Know that spatial domain is fast
and less complex than Fourier filtering.

5.2 Further Work

We also have described recent developments methods of image


enhancement and point out promising directions on research for
image enhancement in spatial domain for future research.
The future scope will be the development of adaptive algorithms for
Image processing development and implementation: a software
simulation using MATLAB

26

Reference:

[1] Alaa Kassab, "Image Enhancement Methods and Implementation in


Matlab", Ph.D Thesis, Electrical Engineering Plzen, 2012.

[2] Juwairia Zubair, "Image Enhancement For Improving Visibility And


Feature Recognition", M.Sc. Thesis, Texas A&M University, Pakistan,
August 2008.

[3] K. Venkateshwarlu, "Image Enhancement using Fuzzy Inference


System", M.Sc. Thesis, Thapar University, Patiala, June 2010.

[4] Haris Papasaika-Hanusch, "Digital Image Processing Using Matlab",


Institute of Geodesy and Photogrammetry, ETH Zurich.

[5] Bovik, "Handbook of Image and Video Processing", Elsevier


Academic Press, New York, 2005.

[6]Rafael C. Gonzalez, Richard E. Woods, "Digital Image Processing",


Third Edition, New Jeresy, 2008.

[7] William K. Pratt, Wiley-Interscience, "Digital Image Processing",


PIKS Scientific Inside, 4th edition, 2007.

[8] S.S. Bedi1, Rati Khandelwal,"Various Image Enhancement


Techniques- A Critical Review", International Journal of Advanced
Research in Computer and Communication Engineering Vol. 2, Issue 3,
March 2013.

[9] Samanthapuri vijay, "Image Enhancement Using Frequency Domain


Filtering ", Electronics & communications CMR technical campus
Hyderabad, India.

[10] T.M. Lilles, and R.W. Kiefer, "Remote Sensing and Image
Interpretation", John Wiley & Sons, New York, 1980.
27

[11] Nicoleta Angelescu, Iulian Udroiu, Ioan Tache, "Simulation of Image
Enhancement Techniques Using Matlab", Scientific Bulletin of the
Electrical Engineering Faculty, Romania, 2009.

[12] The Math works, "MATLAB 6.5 Image Processing Toolbox


Tutorial", Massachusetts, USA, Accessible from <www.mathworks.com>.

28

Appendix
Part One (LPF and HBF in Frequency Domain)

lowpass filters are discussed in above in Digital Image Processing is


simulation Using function and script of MATLAB:

close all;
clc;
clear;
a= imread ('circles.png');
figure(1);
imshow(a);
figure(2);
mesh(abs(a));
e=double(a);
b=fft2(e);
figure(3);
mesh(abs(b));
c=fftshift(b);
figure(4);
mesh(abs(c));
[x y z]=size(e);
fc=128;
for i=1:x
m(i)=(1/((1+(fc/i))^2*1)^0.5);
end
for j=1:y
n(j)=(1/((1+(fc/j))^2*1)^0.5);
end
for i=1:256
for j=1:256
w(i,j)=m(i).*n(j)';
end
end
figure(5);
mesh(abs(w));

e=0;
for i=1:x
h=x-e;
m2(i)=(1/((1+(fc/h))^2*1)^0.5);
e=e+1;
29

end
q=0;
for j=1:y
h2=y-q;
n2(j)=(1/((1+(fc/h2))^2*1)^0.5);
q=q+1;
end
for i=1:256
for j=1:256
w2(i,j)=m2(i).*n2(j)';
end
end
figure(6);
mesh(abs(w2));

for i=1:x
for j=1:y
f(i,j)=w(i,j)*w2(i,j);
end
end
figure(7);
mesh(abs(f));

for i=1:x
for j=1:y
filt(i,j)=c(i,j)*f(i,j);
end
end
figure(8);
mesh(abs(filt));

bb=ifftshift(filt);
cc=ifft2(bb);
dd=uint(cc);
figure(9);
imshow(cc);

High pass filters are discussed in above in Digital Image Processing


is simulation Using function and script MATLAB:

close all;
clc;
clear;
30

a=imread('circles.png');
figure(1);
imshow(a);
figure(2);
mesh(abs(a));
e=double(a);
b=fft2(e);
figure(3);
mesh(abs(b));
c=fftshift(b);
figure(4);
mesh(abs(c));
[x y z]=size(e);
fc=128;
for i=1:x
m(i)=(1/((1+(fc/i))^2*1)^0.5);
end
for j=1:y
n(j)=(1/((1+(fc/j))^2*1)^0.5);
end
for i=1:256
for j=1:256
w(i,j)=m(i).*n(j)';
end
end
figure(5);
mesh(abs(w));

e=0;
for i=1:x
h=x-e;
m2(i)=(1/((1+(fc/h))^2*1)^0.5);
e=e+1;
end
q=0;
for j=1:y
h2=y-q;
n2(j)=(1/((1+(fc/h2))^2*1)^0.5);
q=q+1;
end

for i=1:256
for j=1:256

31

w2(i,j)=m2(i).*n2(j)';
end
end
figure(6);
mesh(abs(w2));
for i=1:x
for j=1:y
f(i,j)=w(i,j)*w2(i,j);
end
end
f1=1-f; //////////////////this line will make it a LPF
figure(7);
mesh(abs(f1));

for i=1:x
for j=1:y
filt(i,j)=c(i,j)*f1(i,j);
end
end
figure(8);
mesh(abs(filt));

bb=ifftshift(filt);
cc=ifft2(bb);
dd=uint(cc);
figure(9);
imshow(cc);

Part Two (LPF and HBF in Spatial Domain)

lowpass filters are discussed in above in Digital Image Processing is


simulation Using function and script of MATLAB:

close all;
clc;
clear;
im=imread('rice.png');
figure(1);
imshow(im)
im2=im;
im=double(im);
[x y z]=size(im2);
32

for i=2:x-1
s=0;
for j=2:y-1
cont=1;
for c=i-1:i+1
for k=j-1:j+1
s(cont)=im(c,k);
cont=cont+1;
end
end
sum1=sum(s)/9;
im2(i,j)=sum1;
end
end
figure(2)
imshow(uint8(im2));

High pass filter with center 9 are discussed in above in Digital Image
Processing is simulation Using function and script of MATLAB:

clc
clear all
im=imread('rice.png');
figure(1);
imshow(im);
[x y z]=size(im);
a=double(im);
mask=([-1 -1 -1 -1 9 -1 -1 -1 -1]);
for i=2:x-1
for j=2:y-1
q=1;
for c=i-1:i+1
for d=j-1:j+1
s(q)=a(c,d);
q=q+1;
end
end
s=sum(s.*mask);
x(i,j)=s;
end
end
figure(2)

33

imshow(uint8(x));

High pass filter with center 8 are discussed in above in Digital Image
Processing is simulation Using function and script of MATLAB:

clc
clear all
im=imread('rice.png');
figure(1);
imshow(im);
[x y z]=size(im);
a=double(im);
mask=([-1 -1 -1 -1 8 -1 -1 -1 -1]);
for i=2:x-1
for j=2:y-1
q=1;
for c=i-1:i+1
for d=j-1:j+1
s(q)=a(c,d);
q=q+1;
end
end
s=sum(s.*mask);
im(i,j)=s;
end
end
figure(2)
imshow(uint8(im));

34

.
. spatial and frequency domain filters
Fourier Fourier .
Fourier .

Spatial and Frequency Domain Filters

.1
.2
.3
.4

. .

View publication stats

You might also like