fourier transforms for dip

Upload: allanki-sanyasi-rao

Post on 08-Aug-2018

236 views

Category:

Documents


0 download

TRANSCRIPT

  • 8/22/2019 Fourier Transforms for DIP

    1/40

    Chapter 4Image Enhancement in the

    Frequency Domain

    Fourier s idea :Any periodic function can be represented

    as a sum of sine and cosine functions, with appropriate

    amplitudes and phases.

    Since we represent an image by a two-dimensional

    function f(x,y), we can represent it as a sum of sines and

    cosines, if it is periodic.

    If the function is not periodic, we have to use a

    generalization of the Fourier series representation, known

    as the Fourier Transform.

  • 8/22/2019 Fourier Transforms for DIP

    2/40

    Development of Fourier Series

  • 8/22/2019 Fourier Transforms for DIP

    3/40

    +

    +=

    =

    =

    xL

    nbxL

    naaxf nn

    n

    n

    2sin2cos2

    )(11

    0

    Any function f(x) which is periodic and is integrable can be

    represented (expanded) as:

    This can be conveniently written in exponential form as:

    =

    = n n Ljnx

    cxf

    2

    exp)(

  • 8/22/2019 Fourier Transforms for DIP

    4/40

    The Cns are known as the Fourier coefficients.

    The original function can be reconstructed from a

    knowledge of all the Fourier coefficients.

    If the function is non-periodic, i.e., L , n/L can

    take continuous values. We set n/L = u (called spatial

    frequency).

    Therefore:

    = dujuxuFxf )2exp()()(

  • 8/22/2019 Fourier Transforms for DIP

    5/40

    This relation can be inverted to give:

    = dxjuxxfuF )2exp()()(

    F(u) is known as the Fourier Transform of f(x). It is

    analogous to cn .

    This can be easily generalized to two-dimensions:

    += dxdyvyuxjyxfvuF ))(2exp(),(),(

  • 8/22/2019 Fourier Transforms for DIP

    6/40

    The Meaning of the Fourier Transform:

    Let f(x) = sin(2uo

    x). The representation of this function

    in the Fourier Space, would be:

    = dxjuxxuuF o )2exp()sin()(

  • 8/22/2019 Fourier Transforms for DIP

    7/40

    function (also called impulse function):

    Property :

    0for x0

    0for x)(

    ====x

    Also area under the delta function = 1

    =1)( dxx

  • 8/22/2019 Fourier Transforms for DIP

    8/40

    = )0()()( fdxxxf

    Rectangular or box function:

    f(x) = 1 for a < x < a

    = 0 for |x| > a

    f(x)

    -a 0 a

  • 8/22/2019 Fourier Transforms for DIP

    9/40

    Fourier Transform of rect function:

    )2(sin2)2sin(2

    )]2exp()2[exp()2exp( uacauua

    jujuajuadxjux

    a

    a

    ===

  • 8/22/2019 Fourier Transforms for DIP

    10/40

  • 8/22/2019 Fourier Transforms for DIP

    11/40

    Does this remind you of something?

    Clue: Optical phenomena which you studied in Physics-

    I/MT-I

    Ans: The diffraction pattern of a single slit!

    In fact, this is true in general. Diffraction patterns are the

    FT of the aperture.

  • 8/22/2019 Fourier Transforms for DIP

    12/40

    Points to ponder:

    Reciprocal nature of F(u) and f(x). Here the width of the

    central peak is inversely proportional to a (the width of

    f(x)). This is a general property of the Fourier transform.

    F(u) is complex (in general).

    Sharp changes in the image (f(x)) give rise to peaks at

    large values of u.

    The phase part of F(u) gives us information about where

    these sharp changes occur.

  • 8/22/2019 Fourier Transforms for DIP

    13/40

    DISCRETE FOURIER TRANSFORM (DFT)

    1-.M0,1,2,....u

    2exp)(

    1)(

    1

    0

    =

    =

    =

    for

    M

    juxxf

    MuF

    M

    x

    1-.M0,1,2,....x

    2exp)()(1

    0

    =

    =

    =

    for

    MjuxuFxf

    M

    u

    Inverse DFT

  • 8/22/2019 Fourier Transforms for DIP

    14/40

    Proof:

    Substituting for F(u) in the definition of inverse DFT, we

    get:

    =

    =

    =

    1

    0

    1

    0

    '2exp

    2exp)(

    1)(

    M

    u

    M

    x M

    jux

    M

    juxxf

    Mxf

    =

    =

    =

    1

    0

    1

    0

    )'(2exp)(

    1)(

    M

    x

    M

    u M

    xxjuxf

    Mxf

  • 8/22/2019 Fourier Transforms for DIP

    15/40

    If x = x, then the summand = 1, otherwise it is zero.

    How?

    Phasor addition:

    Here M=6; let (x-x)=1,

    therefore

    Angle between successive

    phasors = 2/6

    Therefore the summation over

    u equals M if (x-x)=0 and the

    other summation has only one

    term. Hence the proof.

  • 8/22/2019 Fourier Transforms for DIP

    16/40

    Alternatively

    The sum for f(x) is equal to:

    0)'(2exp1

    ))'(2exp(1)'(2

    exp

    1

    0 =

    =

    =

    M

    xxju

    xx

    M

    xxjuM

    u

  • 8/22/2019 Fourier Transforms for DIP

    17/40

    ADDITIONAL PROPERTIES OF THE DFT:

    PERIODICITY: F(u+M)=F(u)

    This follows from the definition of the DFT.

    =

    =

    +

    =+

    =

    =

    =

    M

    juxxf

    Mjux

    M

    juxxf

    M

    M

    xMuj

    xfMMuF

    M

    x

    M

    x

    M

    x

    2exp)(

    1)2exp(

    2exp)(

    1

    )(2

    exp)(

    1

    )(

    1

    0

    1

    0

    1

    0

  • 8/22/2019 Fourier Transforms for DIP

    18/40

    Due to the periodic nature of the DFT, the Fourier

    spectrum may appear scrambled if we apply it directly

    on an image.

    Consider the Fourier spectrum of a 2-D rectangular (or

    box) function.

    Direct application of the DFT would give rise to a

    scrambled Fourier Transform.

    F i S t f hit t l

  • 8/22/2019 Fourier Transforms for DIP

    19/40

    Fourier Spectrum of a white rectangle

  • 8/22/2019 Fourier Transforms for DIP

    20/40

    Centering the Fourier Transform can be done by

    multiplying the Image by (-1)(x+y) before taking the

    Fourier Transform.

    We can show that this centers the Transfrom.

    From the definition of DFT:

    22exp)()1(1),(1

    0

    )(=

    +

    =

    M

    x

    yx

    Njvy

    Mjuxxf

    MvuF

    =

    +=

    1

    0

    22exp)()exp(

    1 M

    x N

    jvy

    M

    juxxfjyjx

    M

  • 8/22/2019 Fourier Transforms for DIP

    21/40

    Significance of Fourier components:

    The zero frequency component , F(0,0) is equal to the

    average gray level (intensity) of the image.

    Proof:

    =

    =

    = Njvy

    Mjuxyxf

    MNvuF

    M

    x

    N

    y

    2exp2exp),(1),(1

    0

    1

    0

    y)f(x,ofAverage),(1

    )0,0(1

    0

    1

    0

    ==

    =

    =

    M

    x

    N

    y

    yxfMN

    F

  • 8/22/2019 Fourier Transforms for DIP

    22/40

    Fourier Spectrum of typical images

  • 8/22/2019 Fourier Transforms for DIP

    23/40

    BASIC STEPS FOR FILTERING IN THE FREQUENCY

    DOMAIN

    1. Multiply the input image by (-1)(x+y)

    to center thetransform

    2. Compute F(u,v)

    3. Multiply F(u,v) by a filter function H(u,v) (componentwise)

    4. Compute the inverse DFT

    5. Obtain the real part of the result in (4)

    6. Multiply the result by (-1)(x+y)

  • 8/22/2019 Fourier Transforms for DIP

    24/40

    NOTCH FILTER : Sets average to zero:

  • 8/22/2019 Fourier Transforms for DIP

    25/40

    NOTCH FILTER : Sets average to zero:Display is scaled by setting most

    negative to zero

  • 8/22/2019 Fourier Transforms for DIP

    26/40

    Low pass filtering: Result is similar to averaging

  • 8/22/2019 Fourier Transforms for DIP

    27/40

    IDEAL LOW PASS FILTER

  • 8/22/2019 Fourier Transforms for DIP

    28/40

    EFFECT OF APPLYING AN IDEAL LOW PASS FILTER:

  • 8/22/2019 Fourier Transforms for DIP

    29/40

    EFFECT OF APPLYING AN IDEAL LOW PASS FILTER:RINGING

    What is the origin of ringing?

  • 8/22/2019 Fourier Transforms for DIP

    30/40

    What is the origin of ringing?

    To understand ringing we need to understand an

    operation called convolution.

    ===

    =++=mn

    i

    ii

    b

    bt

    a

    as

    zwtysxftswyxg1

    ),(),(),(

    Convolution, is usually defined as:

    =

    = ==

    1

    0

    1

    0),(),(

    1

    ),(*),(),(

    N

    n

    M

    mnymxhnmfMNyxhyxfyxg

    This is similar to averaging

  • 8/22/2019 Fourier Transforms for DIP

    31/40

    If the domain of the functions is continuous, then

    convolution is defined as:

    = ddyxhfyxg ),(),(),(

    Let us now consider convolution in 1-d and look at itsFourier transform:

    = dxjuxdxhfuG )2exp()()()(

  • 8/22/2019 Fourier Transforms for DIP

    32/40

    )()(

    )2exp())(2exp()()()(

    uHuF

    dxjuxjudxhfuG

    =

    =

    Therefore, convolution in the spatial domain is equivalent

    to multiplication in the Fourier Domain and vice-versa.

    Let us consider a simple point image (impulse function).

    The Fourier transform of this would be a constant. We

    multiply this by the filter function. Hence in the real

    domain we have to convolve the impulse function with the

    spatial representation of the filter function.

    The filter function in the spatial domain will have

    circular symmetry. It has a central peak and it reduces in

    height as we move away from the origin

  • 8/22/2019 Fourier Transforms for DIP

    33/40

    RINGING

  • 8/22/2019 Fourier Transforms for DIP

    34/40

    In order to avoid ringing Ideal Low pass filter is not used.

    Other filters are available: Gaussian and Butterworth

    Filters.For ringing to be absent, the filter function should have a

    spatial representation which varies monotnically. This is

    true for Gaussian function and the I order Butterworth

    filter.

    = 22

    2

    ),(

    exp),(

    vuD

    vuH

  • 8/22/2019 Fourier Transforms for DIP

    35/40

    Gaussian Filters

  • 8/22/2019 Fourier Transforms for DIP

    36/40

    Why does the Gaussian filter not suffer from ringing?

    To understand this, let us look at its spatial representation.

    ++= dudvvyuxjvuvuH ))(2exp()2/)(exp(),( 222

    ( )( )dudvyxjyv

    jx

    u 22222222

    22exp22exp22exp

    +

    Converting this integral to polar co-ordinates, we have

    ( )( ) +

    0

    2

    0

    2222222 22exp)exp( ddyx

  • 8/22/2019 Fourier Transforms for DIP

    37/40

    Butterworth Low pass filters

  • 8/22/2019 Fourier Transforms for DIP

    38/40

    Butterworth Low pass filters:

    nDvuDvuH

    2

    0 ]/),([11),(

    +=

    Here D(u,v) is the distance from the origin , D0 is the

    distance of the cut-off frequency from the origin and n is

    the order of the Butterworth filter. Sharper cutoffs areobtained with higher values of n but at the cost of increase

    in ringing effect.

  • 8/22/2019 Fourier Transforms for DIP

    39/40

    EFFECT OF FILTERING WITH BUTTERWORTH FILTERS

  • 8/22/2019 Fourier Transforms for DIP

    40/40