0% found this document useful (0 votes)
55 views106 pages

Dip 3

This document discusses image enhancement in the frequency domain. It covers the Fourier transform and discrete Fourier transform (DFT), which allow analyzing images in the frequency domain. The Fourier transform expresses a function as a combination of sine and cosine waves of different frequencies. The discrete Fourier transform (DFT) is used to transform digital images into the frequency domain. Image filtering and enhancement can be performed by modifying high or low frequency components in the DFT domain before transforming back.

Uploaded by

DEVID ROY
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
55 views106 pages

Dip 3

This document discusses image enhancement in the frequency domain. It covers the Fourier transform and discrete Fourier transform (DFT), which allow analyzing images in the frequency domain. The Fourier transform expresses a function as a combination of sine and cosine waves of different frequencies. The discrete Fourier transform (DFT) is used to transform digital images into the frequency domain. Image filtering and enhancement can be performed by modifying high or low frequency components in the DFT domain before transforming back.

Uploaded by

DEVID ROY
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 106

DIGITAL IMAGE PROCESSING

15CS753

MODULE-3
Image Enhancement In The Frequency Domain
• Module – 3 8 Hours
• Image Enhancement In Frequency Domain:
• Introduction,
• Fourier Transform,
• Discrete Fourier Transform (DFT),
• properties of DFT,
• Discrete Cosine Transform (DCT),
• Image filtering in frequency domain..

2
Image Enhancement In The Frequency Domain
• Introduction
• These are proposed by French mathematician Joseph Fourier
• His contribution basically states that, any periodic function can be
expressed as sum of sines and/or cosines of different frequencies
each multiplied by a different coefficient
• This sum is termed as Fourier series.
• Irrespective of how complicated the function is, if it is periodic
and if it satisfies some mathematical conditions, it can be
represented by such a sum
• The functions which are not periodic but whose area under the
curve is finite can be expressed as integral of sines and/or cosines
multiplied by the weighting function.
• This is called as Fourier Transform and is more widely used than
Fourier series
3
Image Enhancement In The Frequency Domain
• The important characteristic of both F.S. and F.T. is that a function
expressed either in F.S. or F.T. can be reconstructed ( recovered)
via a reverse process with no loss of information
• This allows us to work in Fourier domain and then return to the
original domain without loss of information
• Since we are dealing with images which are functions of finite
duration, we will be using Fourier Transform as a tool
• Basic concepts:
• A complex number is defined as C= R+jI
• Where R and I are real numbers and i is imaginary number equal
to square root of -1.
• .

4
Image Enhancement In The Frequency Domain
• Polar representation of complex numbers

• .

5
Image Enhancement In The Spatial Domain
• Fourier Series
• We know that, a function f(t) of a continuous variable t, periodic with
period T can be expresses as sum of sines and cosines multiplied by
appropriate coefficients
• This sum known as Fourier series can be formulated as
• .
• . ……. (1)
• Where the coefficients are

• (2)
Image Enhancement In The Frequency Domain
• Impulses and their Sifting:
• Before studying the Fourier Transforms we need to learn about
impulses and their sifting property
• A unit impulse of a continuous variable t located at t=0 denoted
δ(t) is defined by
• ….3-a.

• This is constrained to satisfy the identity

• ….3.b
• This means that, at time t, impulse can be viewed as a spike of
infinite amplitude and zero duration having unit area
Image Enhancement In The Frequency Domain
• An impulse has the sifting property w.r.t. integration

• …(4)
• .provided that f(t) is continuous at t=0
• Sifting yields the value of the function f(t), at the location of the
impulse. ( previous equation, at t=0)
• A more general statement of the sifting property involves the
impusle located at an arbitrary point t0, denoted by δ(t-t0).
• Now sifting property results in
…..(5)

• This yields the value of the function at the location t0.


Image Enhancement In The Frequency Domain
• Suppose if f(t)= cos(t), using the impulse δ(t-π) in the equation (5)
we get the result as f(π)=cos(π) = -1

• Let x represent a discrete variable.


• The unit discrete impulse δ(x) serves the same purpose in the
context of discrete systems, as the impulse δ(t) does while working
with continuous variables
• δ(x) is defined by
• .
• …..(6)
• This also satisfies the discrete equivalent of the equation (3.b)

Image Enhancement In The Frequency Domain
• Sifting property of the discrete impulse is given by
• …(7)

• More general form of sifting property can be written as


• .
• ….(8)
• Here also it is clear that, sifting gives the value of the function f(x)
at the location of impulse
• Schematically unit discrete impulse can be shown as below
Image Enhancement In The Frequency Domain
• Impulse train:
• This is defined as the sum of infinitely many periodic impulses
separated by ΔT units
• Mathematically we can write this as

• ….(9)

• Schematically we have impulse train as shown below


• .
Image Enhancement In The Frequency Domain
• Fourier transforms of a function with one variable
• Given single variable continuous function f(t) of a continuous
variable t
• Fourier transform F(u) is given by

• ….(10)
• Where μ is also a continuous variable
• Though we see two variables t and μ, since t gets integrated out,
we can see that F.T. is a function of only one variable
• For simplicity let us denote F.T. as Ƒ{f(t)} = F(μ)
• Thus Fourier transform of f(t) is given by

• …..(11)
Image Enhancement In The Frequency Domain
• Suppose if we are given with F(μ) we can get back f(t) by using
inverse Fourier Transform
• i.e.
• … (12)

• Equations 11 and 12 are called as Fourier transform pairs

• Using Euler’s formula we can write equation 11 as .


Image Enhancement In The Frequency Domain
• If f(t) is real, its transform is complex.
• Note that the Fourier transform is an expansion of f(t) multiplied
by sinusoidal terms whose frequencies are determined by the
values of μ (variable t is integrated out).
• Because the only variable left after integration is frequency, we say
that the domain of the Fourier transform is the frequency domain.
• In our discussion, t can represent any continuous variable, and the
units of the frequency variable μ depend on the units of t.
• For example, if t represents time in seconds, the units of μ are
cycles/sec or Hertz (Hz).
• If t represents distance in meters, then the units of μ are
cycles/meter, and so on.
• In other words, the units of the frequency domain are cycles per
unit of the independent variable of the input function..
Image Enhancement In The Spatial Domain
• Fourier Series
• We know that, a function f(t) of a continuous variable t, periodic with
period T can be expresses as sum of sines and cosines multiplied by
appropriate coefficients
• This sum known as Fourier series can be formulated as
• .
• . ……. (1)
• Where the coefficients are

• (2)
Image Enhancement In The Frequency Domain
• Fourier transforms of a function with one variable
• Given single variable continuous function f(t) of a continuous
variable t
• Fourier transform F(u) is given by

• ….(10)
• Where μ is also a continuous variable
• Though we see two variables t and μ, since t gets integrated out,
we can see that F.T. is a function of only one variable
• For simplicity let us denote F.T. as Ƒ{f(t)} = F(μ)
• Thus Fourier transform of f(t) is given by

• …..(11)
Image Enhancement In The Frequency Domain
• Suppose if we are given with F(μ) we can get back f(t) by using
inverse Fourier Transform
• i.e.
• … (12)

• Equations 11 and 12 are called as Fourier transform pairs

• Using Euler’s formula we can write equation 11 as .

• … (13)
Image Enhancement In The Frequency Domain
• Computing Fourier transform
• Consider the function shown below
• Using the equation (11) we can write the

• Applying the integration rules we get .


Image Enhancement In The Frequency Domain
• Further simplifying we get

• Using the identity sin θ = (ejθ – e-jθ)/2j we can further simplify


this as
• F(u) =
Image Enhancement In The Frequency Domain
• In this equation we can see that, the complex terms of Fourier
transform are nicely combined into a sine function
• The result in the last step of the previous expression is known as
sinc function

• where sinc(0) = 1, and sinc(m) = 0 for all other integer values of


m.
• The plot of F(μ) is shown below
Image Enhancement In The Frequency Domain
• In general, the Fourier transform contains complex terms, and it is
customary for display purposes to work with the magnitude of the
transform (a real quantity), which is called the Fourier spectrum or
the frequency spectrum:
• i.e.

• Figure below shows a plot of |F(μ)| as a function of frequency.


Image Enhancement In The Frequency Domain
• The key properties to note are
• The locations of the zeros of both F(μ) and |F(μ)| are inversely
proportional to the width, W, of the "box" function,
• The height of the lobes decreases as a function of distance from
the origin, and
• The function extends to infinity for both positive and negative
values of μ.
• These properties are helpful in interpreting the spectra of two-
dimensional Fourier transforms of images.
Image Enhancement In The Frequency Domain
• Convolution
• This one more building block often used.
• The idea of convolution was learnt already.
• We learned in that section that convolution of two functions
involves flipping (rotating by 180°) one function about its origin
and sliding it past the other.
• At each displacement in the sliding process, we perform a
computation,
• i.e. a sum of products.
• In the present discussion, we are interested in the convolution of
two continuous functions, f(t) and h(t), of one continuous variable,
t, so we have to use integration instead of a summation.
Image Enhancement In The Frequency Domain
• The convolution of these two functions, denoted as before by the
operator *, is defined as
• …(14)

• where the – sign indicates the flipping which was done in filtering
• t is the displacement needed to slide one function past the other,
and
• τ is a dummy variable that is integrated out.
• We assume for that the functions extend from -∞ to ∞.
• We have seen the basic mechanics of convolution in module 2,
• At the moment, we are interested in finding the Fourier transform
of Eq (14)
Image Enhancement In The Frequency Domain
• We start with equation

• The term inside the brackets is the Fourier transform of h(t - τ).
• We see later that F{h(t - τ)} = H(μ)e-j2πμτ, where H(μ) is the
Fourier transform of h(t).
• Using this fact in the preceding equation gives us
Image Enhancement In The Frequency Domain

• We refer to the domain of t as the spatial domain, and the domain


of IL as the frequency domain,
• The preceding equation tells us that the Fourier transform of the
convolution of two functions in the spatial domain is equal to the
product in the frequency domain of the Fourier transforms of the
two functions
Image Enhancement In The Frequency Domain
• Conversely, if we have the product of the two transforms, we can
obtain the convolution in the spatial domain by computing the
inverse Fourier transform.
• In other words, f(t) * h(t) and H(u) F(u) are a Fourier transform
pair. This result is one-half of the convolution theorem and is
written as
• The double arrow is used to indicate that the expression on the
right is obtained by taking the Fourier transform of the expression
on the left, while the expression on the left is obtained by taking
the inverse Fourier transform of the expression on the right.
• Following a similar development would result in the other half of
the convolution theorem:
Image Enhancement In The Frequency Domain
• This states that convolution in the frequency domain is analogous
to multiplication in the spatial domain, the two being related by the
forward and inverse Fourier transforms, respectively
Image Enhancement In The Frequency Domain
• If we have the product of the two transforms, we can obtain the
convolution in the spatial domain by computing the inverse
Fourier transform

• Convolution in the frequency domain is analogous to


multiplication in the spatial domain, the two being related by the
forward and inverse Fourier transforms, respectively
Image Enhancement In The Frequency Domain
• Sampling and the Fourier Transform of Sampled Functions
• Sampling
• W.k.t. Continuous functions have to be converted into a sequence
of discrete values before they can be processed in a computer.
• This is done by using sampling and quantization, as discussed in
module 1
• Now we examine sampling in more detail.
• Consider a continuous function, f(t) with (-∞ < t < ∞), that we
wish to sample at uniform intervals (ΔT) of the independent
variable t.
Image Enhancement In The Frequency Domain
• One simple way of achieving sampling is to multiply f(t) by a
sampling function, equal to the train of impulses, separated by ΔT
units.
• i.e. ….. (1)

• Each component of this summation is an impulse weighted by the


value of f(t) at that location
Image Enhancement In The Frequency Domain
• The value of each sample is then given by the "strength" of the
weighted impulse, which is obtained by integration.
• That is, the value, fk, of an arbitrary sample in the sequence is
given by

• Using the sifting property, we can write

• This equation is valid for all values of k from -∞,..-1,0,1,2,..∞


• Schematically we can show this as…
Image Enhancement In The Frequency Domain
Image Enhancement In The Frequency Domain
• The Fourier Transform of Sampled Functions
• Let F(μ) denote the Fourier transform of a continuous function f(t).
• The corresponding sampled function, f (t), is the product of f(t)
and an impulse train.
• From the convolution theorem, it is known that, the F.T. of the
product of two functions in the spatial domain is the convolution
of the transforms of the two functions in the frequency domain.
Thus, the Fourier transform, F(μ), of the sampled function f(t) is:


• …..(2)
Image Enhancement In The Frequency Domain
• Where S(μ) is the Fourier transform of impulse train and is given
by

• Thus convolution of F(μ) and S(μ) is obtained from


Image Enhancement In The Frequency Domain

• The last step is obtained by using sifting property


• The summation in the last line of above Eq shows that the Fourier
~
transform F (μ) of the sampled function f(t), is an infinite, periodic
sequence of copies of F(μ), the transform of the original, continuous
function.
• The separation between copies is determined by the value of 1/ΔT.
~
• Observe that although f (t) is a sampled function, its transform F(μ) is
continuous because it consists of copies of F(μ) which is a continuous
function.
Image Enhancement In The Frequency Domain
• Previous discussions can be graphically shown as below
• Consider the Fourier Transform F(μ) of a function f(t) plotted as
below

~
• The transform F (μ) of the sampled function is given below

• We can see that, enough sampling rate was chosen to provide


sufficient separation between periods and thereby preserving F(μ)
Image Enhancement In The Frequency Domain

• In this we can see that, sampling rate chosen is just enough to


preserve F(μ)

• In this case the sampling rate chosen was below minimum required
to maintain distinct copies of F(μ) and thus has failed to preserve
F(μ).
Image Enhancement In The Frequency Domain
• These three cases are known as over-sampling, critically sampling
and under-sampling
• How to choose sampling rate?? - Sampling theorem answers this
• A function f(t) whose Fourier transform is zero for values of
frequencies outside a finite interval (band) [-μmax, μmax] about the
origin is called a band-limited function.
• Figure below is such a function.

• Similarly, Fig. (b) is a more detailed view of the transform of a


critically sampled function.
Image Enhancement In The Frequency Domain
• A lower value of 1/ΔT would cause the periods in F(μ) to merge; a
higher value would provide a clean separation between the
periods.
• We can recover f(t) from its sampled version- if we can isolate a
copy of F(μ) from the periodic sequence of copies of this function
~
contained in F (μ), the transform of the sampled function f(t).
• We have seen that F(μ) is a continuous, periodic function with
period 1/ ΔT.
• Therefore, all we need is one complete period to characterize the
entire transform.
• This implies that we can recover f(t) from that single period by
using the inverse Fourier transform.
Image Enhancement In The Frequency Domain
~
• Extracting a single period that is equal to F(μ) from F (μ) is
possible if the separation between copies is sufficient
• In figure (b) sufficient separation is guaranteed if 1/2ΔT > μmax or

• This equation indicates that a continuous, band-limited function


can be recovered completely from a set of its samples if the
samples are acquired at a rate exceeding twice the highest
frequency content of the function.
• This result is known as the sampling theorem.
• Based on this result we can say that, no information is lost if a
continuous, band-limited function is represented by samples
acquired at a rate greater than twice the highest frequency content
of the function.
Image Enhancement In The Frequency Domain
• Conversely, we can say that the maximum frequency that can be
"captured" by sampling a signal at a rate 1/ΔT is μmax = 1/2ΔT.
• Sampling at the Nyquist rate sometimes is sufficient for perfect
function recovery, but there are cases in which this leads to
difficulties
• Thus, the sampling theorem specifies that sampling must exceed
the Nyquist rate.
Image Enhancement In The Frequency Domain
~
• How to recover F(μ) from F (μ)
• Consider Fig. below, which shows the Fourier transform of a
function sampled at a rate slightly higher than the Nyquist rate.

• Consider another function H(μ) defined by the equation


Image Enhancement In The Frequency Domain
• This can be graphically represented as

• If we multiply these two signals, then we get the following


representation

• This is nothing but F(μ) obtained by




Image Enhancement In The Frequency Domain
• Once we have F(μ) we can recover f(t) by using the inverse Fourier
transform

• These equations show that, theoretically it is possible to recover the a


band-limited function from samples of the function obtained at a rate
exceeding twice the highest frequency content of the function.
• The requirement that f(t) must be band-limited implies that f(t) must
extend from 00 to 00, a condition that cannot be met in practice.
• This filter is called low pass filter as it passes lower frequency at the
• low end of the frequency range but it eliminates (filters out) all higher
frequencies.
• It is called also an ideal lowpass filter because of its infinitely rapid
transitions in amplitude
Image Enhancement In The Frequency Domain
• Since they are instrumental in recovering (reconstructing) the
original function from its samples, these filters are called
reconstruction filters.
Image Enhancement In The Frequency Domain
• The Discrete Fourier Transform (OFT) of One Variable
• Here we derive discrete Fourier transform (DFT) starting from
basic principles.
• Obtaining the DFT from the Continuous Transform of a Sampled
Function
• Fourier transform of a sampled, band-limited function extending
from -∞ to ∞ is a continuous, periodic function that also extends
from -∞ to ∞.
• In practice, we work with a finite number of samples, and here we
derive the DFT corresponding to such finite sample sets
~
• We have seen an equation which gives the transform, F (μ) of
sampled data in terms of the transform of the original function, but
~
it does not give us an expression for F (μ) in terms of the sampled
~
function f (t) itself.
Image Enhancement In The Frequency Domain
• We find such equation by using the definition of F.T.

• (1)

• By substituting , we get


Image Enhancement In The Frequency Domain

• (2)

Image Enhancement In The Frequency Domain
• The last step is obtained from the result

~
• We know that, though fn is a discrete function, its Fourier F (μ) is
continuous and infinitely periodic with period 1/ ΔT
~
• Therefore, we need to characterize F (μ) is for one period, and
sampling one period is the basis for the DFT.
~
• Suppose that we want to obtain M equally spaced samples of F (μ)
taken over the period μ = 0 to μ = 1/ ΔT.
• This is accomplished by taking the samples at the following
frequencies:
• (3)
Image Enhancement In The Frequency Domain
• Substituting this result in equation (2) we get

• (4)

• This is the expression for discrete Fourier transform


• Given a set {fn} consisting of M samples of f(t), Eq. 4 yields a
sample set {Fm} of M complex discrete values corresponding to
the discrete Fourier transform of the input sample set.
• Conversely, given {Fm}, we can recover the sample set {fn} by
using the inverse discrete Fourier transform (IDFT)
Image Enhancement In The Frequency Domain
• Eqs. 4 and 5 form a discrete Fourier transform pair which indicates
that the forward and inverse Fourier transforms exist for any set of
samples whose values are finite.
• Note that neither expression depends explicitly on the sampling
interval ΔT nor on the frequency intervals of Eq. 3.
• Therefore, the DFT pair is applicable to any finite set of discrete
samples taken uniformly.
• Here we used m and n to denote discrete variables because it is
typical to do so for derivations.
• It is more intuitive, especially in two dimensions, to use the
notation x and y for image coordinate variables and u and v for
frequency variables, where these are understood to be integers.
• Then, Eqs. 4 and 5 become
Image Enhancement In The Frequency Domain
• (6)

• and

• (7)

• where we used functional notation instead of subscripts for


simplicity.
• Clearly, F(u) == Fm and f(x) = fn.
• Now onwards we use Eqs. 6 and 7 to denote the 1-D DFT pair.
Image Enhancement In The Frequency Domain
• It can be shown that both the forward and inverse discrete
transforms are infinitely periodic, with period M.
• That is, F(μ) = F(μ + kM) (8)
• and
• f(x) = f(x + kM) (9)
• where k is an integer.
• The discrete form of convolution is given by

• (10)

• for x = 0, 1,2, ... , M - 1.


Image Enhancement In The Frequency Domain
• Since the functions used in the preceding formulations are
periodic, their convolution also is periodic.

• Equation (10) gives one period of the periodic convolution.

• For this reason, this equation often is referred to as circular


convolution, and is a direct result of the periodicity of the DFT and
its inverse.

• This is in contrast with the convolution we studied earlier, in


which values of the displacement, x, were determined by sliding
one function completely past the other, and were not fixed to the
range [0, M - 1] as in circular convolution.
Image Enhancement In The Frequency Domain
• E.g. : calculation of DFT
• Consider four samples of a continuous function, f(t), taken AT
units apart as shown below

• the sampled values in the x-domain are shown in figure b.


• Note that the values of x are 0, 1, 2, and 3, indicating that we could
be referring to any four samples of f(t).
Image Enhancement In The Frequency Domain
• From equation (6)

• The next value of F(μ) is F(1) and is obtained by

• Similarly we can obtain Similarly, F(2) = -(1 + 0j) and


F(3) = -(3 + 2j).
• Observe that all values of f(x) are used in computing each term of
F(μ).
Image Enhancement In The Frequency Domain
• Suppose that, we were given F(μ) and were asked to compute its
inverse, we would proceed in the same manner, but using the
inverse transform
Image Enhancement In The Frequency Domain
• Extension to Functions of Two Variables
• Now we extend concepts learnt earlier to two variables
• The 2-D Impulse and Its Sifting Property
• The impulse, 8(t, z), of two continuous variables, t and z, is
defined as

• (11-a)

• Satisfying the condition that,

• (11-b)
Image Enhancement In The Frequency Domain
• Similar to 1-D, the 2-D impulse also exhibits the sifting property
under integration,
• i.e.

• more generally for an impulse located at coordinates (t0, Z0),

• (12)
• We can see that the sifting property yields the value of the function
f(t, z) at the location of the impulse
• For discrete variables x and y, the 2-D discrete impulse is defined
as
Image Enhancement In The Frequency Domain
• Sifting property for discrete impulse is defined by
• (13)

• where f(x, y) is a function of discrete variables x and y.


• For an impulse located at coordinates (x0, y0) the sifting property is

• (14)

• Here also the sifting property of a discrete impulse yields the value
of the discrete function f(x, y) at the location of the impulse
Image Enhancement In The Frequency Domain
• The 2-D Continuous Fourier Transform Pair
• Let f(t, z) be a continuous function of two continuous variables, t
and z.
• The two-dimensional, continuous Fourier transform pair is given
by the expressions
• (15)

• and
• (16)
• where μ and v are the frequency variables.
• When referring to images, t and z are interpreted to be continuous
spatial variables.
• The variables μ and v belong to the continuous frequency domain
Image Enhancement In The Frequency Domain
• Two-Dimensional Sampling and the 2-D Sampling Theorem
• Sampling in two dimensions can be modeled using the sampling
function (2-D impulse train):

• (17)
• where ΔT and ΔZ are the separations between samples along the t-
and z-axis of the continuous function f(t, z).
• Equation (17) describes a set of periodic impulses extending
infinitely along the two axes

• As in the l-D case, multiplying f(t, z) by sΔTΔz(t, z) yields the


sampled function
Image Enhancement In The Frequency Domain
• Function f(t, z) is said to be band-limited if its Fourier transform is
outside a rectangle established by the intervals [-μmax, μmax] and
[-vmax , vmax]:
• that is, (18)

• 2-D Sampling theorem


• The two-dimensional sampling theorem states that a continuous,
band-limited function f(t, z) can be recovered with no error from a
set of its samples if the sampling intervals are

• and
• i.e. no information is lost if a 2-D, band-limited, continuous
function is represented by samples acquired at rates greater than
twice the highest frequency content of the function in both the
wand v-directions.
Image Enhancement In The Frequency Domain
• The 2-D Discrete Fourier Transform and Its Inverse
• 2-D discrete Fourier transform (DFT) is given by the equation

• where f(x, y) is a digital image of size M x N.


• Above Eq. must be evaluated for values of the discrete variables u
and v in the ranges u = 0, 1, 2, ... , M - 1 and v = 0, 1, 2, . , .. N – 1
• Given the transform F(u, v), we can obtain f(x, y) by using the
inverse discrete Fourier transform (IDFT):
Image Enhancement In The Frequency Domain
• for x = 0,1,2, ... , M - 1 and y = 0,1,2, ... , N -1.
• Above two equations form the 2-D discrete Fourier transform pair.

• Some Properties of the 2-D Discrete Fourier Transform


• Relationships Between Spatial and Frequency Intervals
• Suppose that a continuous function f(t, z) is sampled to form a
digital image, f(x, y), consisting of M x N samples taken in the t
and z-directions, respectively.
• Let ΔT and ΔZ denote the separations between samples as shown
below
Image Enhancement In The Frequency Domain
• Then, the separations between the corresponding discrete,
frequency domain variables are given by
• and

• Note that the separations between samples in the frequency


domain are inversely proportional both to the spacing between
spatial samples and the number of samples
• Translation and Rotation
• It can be shown by direct substitution into the equations of 2-D
DFT and 2-D IDFT that the Fourier transform pair satisfies the
following translation properties
Image Enhancement In The Frequency Domain

• That is, multiplying f(x, y) by the exponential shown shifts the


origin of the DFT to (u0, v0) and,
• Also multiplying F(u, v) by the negative of that exponential shifts
the origin of f(x, y) to (x0, y0).
• Note that translation has no effect on the magnitude (spectrum) of
F(u, v).
Image Enhancement In The Frequency Domain
• Using the polar coordinates
• x = r cosθ, y = r sinθ , u = w cosφ, v = w sinφ results in the
following transform pair:

• This indicates that rotating f(x, y) by an angle θ0 rotates F(u, v) by


the same angle.
• Also rotating F(u, v) rotates f(x, y) by the same angle
• Periodicity
• As in the 1-D case, the 2-D Fourier transform and its inverse are
infinitely periodic in the u and v directions; that is,
Image Enhancement In The Frequency Domain

• where k1 and k2 are integers


• The periodicities of the transform and its inverse are important
issues in the implementation of DFT-based algorithms.
• Consider the 1-D spectrum as shown in Fig. (a).
Image Enhancement In The Frequency Domain

• The transform data in the interval from 0 to M -1 consists of two


back-to-back half periods meeting at point M/2.
• For display and filtering purposes, it is more convenient to have in
this interval a complete period of the transform in which the data
are contiguous, as in Fig. (b)
Image Enhancement In The Frequency Domain
Image Enhancement In The Frequency Domain
• From translation property we can write that

• In other words, multiplying f(x) by the exponential term shown


shifts the data so that the origin, F(0), is located at u0.
• If we let u0 = M/2, the exponential term becomes ejπx which is
equal to (-1)x because x is an integer
• Thus we get

• Thus multiplying f(x) by (-1)x shifts the data so that F(0) is at the
center of the interval [0, M - 1], which corresponds to Fig. (b), as
desired
Image Enhancement In The Frequency Domain
• Basics of filtering in frequency domain
• The equations for discrete DFT and IDFT are as below

• There is some relationship between frequency components of F.T>


and spatial features of the image
• Since frequency is directly related to the spatial rate of change, we
can relate the frequencies in the F.T. with the patterns of the
intensity variations in the image.
Image Enhancement In The Frequency Domain
• When we express DFT in polar form we get

• In the transform we have access to magnitude and phase angle.


• Visual analysis of phase angle is not very useful
• Magnitude or spectrum provides some useful guidelines as to
gross characteristics of the image from which spectrum was
generated
Image Enhancement In The Frequency Domain
• Filtering in frequency domain is based on modifying the F.T. to
achieve a specific objective and then computing the inverse DFT
to get back the image
• For a given digital image f(x, y) of size M X N, basic filtering
equation will be of the form

• where is the IDFT


• F(u, v) is DFT of the image
• H(u, v) is the filtering function
• g(x, y) is the output image
• Functions F, H and g are arrays of size M X N, same as f(x, y)
Image Enhancement In The Frequency Domain
• The product F(u, v)H(u, v) is obtained using array multiplication
• Specification of H(u, v) is simplified by using functions that are
symmetric about their center.
• This required that, F(u, v) also to be centered
• This is done by multiplying the input image by (-1)x+y before
computing the transform
• One of the simplest filter is with H(u, v) with 0 at the center of the
transform and 1 elsewhere.
• This filter will reject the dc term in the transform and pass all the
other terms of F(u, v)
Image Enhancement In The Frequency Domain
• There is a known result about averaging..

• From the above equation, it is clear that, average intensity of the


image is the DC component
• So setting this value to zero will reduce the average intensity of the
output image to zero.
• This can be seen in the following figure
Image Enhancement In The Frequency Domain

• The output is darker than the original image


• Average of zero implies the presence of negative intensities.
• In the output for viewing purpose, all the negative intensities are
clipped to value 0
Image Enhancement In The Frequency Domain
• Typically low frequencies in the transform are related to slow
varying intensity component of the image
• E.g.- walls of the room, cloudless sky etc
• High frequencies are related to sharp transitions in the intensities
• E.g. edges, noise etc.
• Thus we expect that, a filter H(u, v) which attenuates the high
frequencies and allows low frequencies ( LPF) would blur the
image
• Also an HPF would enhance the sharp details of the image but
there will be reduction in the contrast of the image
Image Enhancement In The Frequency Domain
• .
Image Enhancement In The Frequency Domain
• In the last filter, a constant a is added
• It does not affect the sharpening of the image but it prevents the
elimination of DC term and thereby preserving the tonality of the
image
• By convolution theorem, we know that, multiplication in
frequency domain is same as convolution in spatial domain.
• If the functions under consideration are not properly padded this
leads to an error called wraparound error
• Consider an image
Image Enhancement In The Frequency Domain
• When this is applied to a Gaussian LPF without padding we get
the following image

• Is image blurred??
• But blurring is not uniform
• Vertical edges are not blurred.
• If we apply padding suitably then??.
Image Enhancement In The Frequency Domain

• How much padding is needed??



Image Enhancement In The Frequency Domain
• Note that, DFT algorithms tend to execute fast with arrays of even
size
• So choose P and Q as the smallest even integers that satisfy above
conditions

• How to do padding if the filter is given in frequency domain??

• Though there are a few issues we use padding to the size of P X Q


• Summary ..
Image Enhancement In The Frequency Domain
• .
Image Enhancement In The Frequency Domain
• .
Image Enhancement In The Frequency Domain
• Correspondence between filtering in spatial and frequency
domains.
• W.k.t. convolution theorem connects filtering in spatial and
frequency domains
• We have seen that, in frequency domain, filtering is done by
multiplying filter function H(u, v) with F(u, v) the F.T. of the
image
• Suppose that, a filter H(u,v) is given to us and we need to find its
spatial domain equivalent
• If we let f(x, y) = δ(x, y) this gives us F(u, v) = 1
• Then the filtered output will be
• This is nothing but the inverse transform of the frequency domain
filter which results in the corresponding filter in spatial domain
Image Enhancement In The Frequency Domain
• Also we can say, given a spatial filter we obtain its frequency
domain representation by taking forward F.T. of the filter
• Thus we can say these two filters form a Fourier Transform pair

• As the filter h(x, y) can be obtained from the response of


frequency domain filter to an impulse, this is called as impulse
response of H(u, v)
• As the discrete implementation of the above equation are finite,
these are also called as Finite Impulse response(FIR) filters.
• While discussing spatial domain convolution we have seen that,
convolution could be done on functions of different size
Image Enhancement In The Frequency Domain
• But when we speak about convolution in the context of DFT it
needs functions to be of same size
• In practice, we prefer to implement convolution filtering using
spatial domain convolution equation due to speed and ease of
implementation
• But filtering concepts are more intuitive in frequency domain
• One way to take advantages of both domains is to specify a filter
in frequency domain, compute its IDFT and then use the resulting
spatial filter as guide for constructing smaller spatial masks
• Now let us use Gaussian filter to illustrate this
• Filters based on Gaussian functions have a special property that,
both forward and inverse transforms of Gaussian functions are
Real Gaussian functions
Image Enhancement In The Frequency Domain
• Let H(u) denote 1-D Gaussian filter in frequency domain

• Where σ is the std. devialtion


• Corresponding filter in the spatial domain is obtained by taking
inverse FT of H(u, v)
• Thus we get
• These two equations have some important features
• They are Fourier transform pairs. Both components of which are
Gaussian and real – so no need to worry about complex numbers
• Secondly the functions behave reciprocally. i.e. when H(u) has
broader profile ( large value of σ) h(x) has a narrow profile
Image Enhancement In The Frequency Domain
• As H(u) approaches infinity, h(x) tends towards impulse
• The plots of Gaussian low pass filter in frequency domain and
corresponding low pass filter in the spatial domain are shown
below .
Image Enhancement In The Frequency Domain
• Image smoothing using frequency domain filters
• We know that, edges or any other sharp intensity transitions such
as noise in an image contribute significantly to the high frequency
content of its Fourier transform
• Thus in frequency domain, smoothing(blurring) is achieved by
suppressing the high frequency components
• This is called as low pass filtering
• Here we focus on three types of filters
o Ideal (very sharp filtering)
o Gaussian ( Very smooth filtering)
o Butterworth ( has an entity called filter order)–
o If it is higher – this filter approaches Ideal filter
o For lower values it approaches Gaussian filter
Image Enhancement In The Frequency Domain
• All filtering here follows the procedure shown below
Image Enhancement In The Frequency Domain

• H(u,v) are discrete functions of size P x Q – meaning that,


frequency variables are in the range u= 1, 2 , .. P-1 and v = =1, 2, ..
Q-1
• .
Image Enhancement In The Frequency Domain
• Ideal Low Pass filters:
• A 2-D low pass filter, that passes without attenuation all
frequencies within a circle of radius D0 from the origin and cuts
off all frequencies outside this circle is called an ideal low pass
filter
• It is specified by the function

• .where D0 is a positive constant


• D(u, v) is the distance between a point (u, v) in the frequency
domain and the center of the frequency rectangle and is given by
Image Enhancement In The Frequency Domain
• P and Q are padded sizes as seen earlier
• Figure below shows the perspective plot of H(u, v) along with
filter displayed as image
• .
Image Enhancement In The Frequency Domain
• The name ideal means, all frequencies on or inside the circle of
radius D0 are passed with no attenuation and all the other
frequencies outside the circle are completely attenuated ( filtered
out)
• The point of transition from H(u, v) = 1 to 0 is called the cut off
frequency
• In the figure cut off frequency is D0
• This type of sharp cut off frequencies are not possible to
implement in electronic components but can be simulated in
software
• .
Image Enhancement In The Frequency Domain
• The LPF introduced here are compared by studying their behavior
as a function of same cut off frequencies
• One way to establish a set of standard loci is to compute circles
that enclose specified amounts of Total image power PT
• This is obtained by adding the components of the power spectrum
of padded image at each point (u, v) for u = 0, 1, 2 …P-1 and v =0,
1, 2, .. Q-1
• i.e.

• Where P(u, v) is power spectrum and is given by


Image Enhancement In The Frequency Domain

• If the DFT is centered a circle, with radius D0 with origin at the


center of the frequency rectangle encloses α percent of the power,
where
Image Enhancement In The Frequency Domain
• Note that summation is taken over values of (u, v) that lie inside
the circle and also on the boundary
• Consider a test pattern image as shown below

• Various D0 values taken are 10, 30, 60, 160 and 460 pixels
Image Enhancement In The Frequency Domain
• .
Image Enhancement In The Frequency Domain
• These circles enclose α percent of image power for α =87.0, 93.1,
95.7, 97.8 and 99.2 % respectively
• Now let us apply this ILPF to the image of test pattern with the
above mentioned radii

• This output is obtained with radius of 10


• This is useless for all practical purposes. Severe blurring here
indicates that, most of the sharp detail information is contained in
the 13% of the power removed by the filter
• As radius increases, less power is filtered our resulting in less blur
Image Enhancement In The Frequency Domain
Image Enhancement In The Frequency Domain
• We can see that image becomes more and more finer as amount of
high frequency component removed decreases
• The ILPF is not practical. But their study will be useful for
development of filter concepts

• Butterworth Lowpass Filter


• The transfer function of Butterworth LPF of the order n with cut
off frequency D0 is given by
Image Enhancement In The Frequency Domain
• .

You might also like