fourier transform in image...

18
Fourier Transform 6 th Lecture on Image Processing Martina Mudrová 2004 in Image Processing Jean Baptiste Joseph Fourier 1768-1830

Upload: others

Post on 24-Oct-2020

1 views

Category:

Documents


0 download

TRANSCRIPT

  • Fourier Transform

    6th Lecture on Image Processing

    Martina Mudrová2004

    in Image ProcessingJean Baptiste Joseph Fourier

    1768-1830

  • Motivation

    Why should we use the Fourier transformation?• basic mathematical tool to process images

    image compression(format .JPG)

    edge detection and image segmentation

    quality image processing

    image reconstruction

    objects detection

    etc.

    2

    Basic problems solved with the FT:

    M. Mudrová, 2004

  • Mathematical Minimum

    = transformation between time (spatial) x(t) and frequency X(f) domain

    )()( fXtx ⇔ t…time domain (spatial)f…frequency domainBasic Definitions:

    inverse continuous FT:direct continuous FT:

    ∫+∞

    ∞−

    −= dtetxfX tfi π2 )()( ∫+∞

    ∞−

    += dfefXtx tfi π2 )()(

    Requests to f(t) : continuous, including the 1st derivation

    integrateable : ∞

  • Example of Continuous FT

    How does look FT of periodical functions?

    ) 2sin()( 0tftx π= ( ))()( 21)( 00 ffffi

    fX +−−= δδ

    Euler’s formulas: )2sin()2cos( 002 0 tfitfe tfi πππ ±=±

    ∫+∞

    ∞−

    −= dtetxfX tfi π2 )()(Def. FT:

    ⇔d(f)… Dirac impulse

    ff0

    Time (spatial) domain x(t) Spectrum |X(f)| (amplitude fr. charact.)

    T=1/f0 2T 3T t

    x(t)

    -f 0 f f

    |X(f)

    |

    0 0

    4M. Mudrová, 2004

  • From Continuous to discrete FT

    How is defined the discrete FT ?

    Discretization in frequency: f Y fk Y k

    Discretization in time: tY tn Y n +

    Discrete Fourier TransformationDirect discrete FT: Inverse discrete FT:

    )()( kXnx ⇔∑−=

    −=

    1

    0

    2 )(1)(

    N

    n

    Nnki

    enxN

    kXπ

    ∑−

    =

    +=

    1

    0

    2 )()(

    N

    k

    Nkni

    ekXnxπ

    0 20 40 60-1

    0

    1

    x(n)

    n

    |X(k

    )|

    0 0 0

    31 3.14 0.5

    15 1.57 0.25

    k...indexωk ...circular frequencyf …normalized freq.

    63

    5M. Mudrová, 2004

  • Function Restriction in Time (Spatial) Domain

    = apodizationFunction with definite length...

    0 10 20 30 40 50 60

    -1

    0

    1

    x(n)

    n

    Periodický signál a jeho spektrum

    0 0.5 1 1.5 2 2.5 30

    10

    20

    30

    40

    ω od 0 do π

    |X( ω

    )|

    0 10 20 30 40 50 600

    0.5

    1

    1.5Obdelnikové okno a jeho spektrum

    x(n)

    n0 0.5 1 1.5 2 2.5 3

    0

    10

    20

    30

    40

    ω od 0 do π

    |X( ω

    )|

    -1

    0

    1

    x(n)

    n

    Omezený signál a jeho spektrum

    0 0.5 1 1.5 2 2.5 30

    10

    20

    30

    40

    ω od 0 do π

    |X( ω)

    |

    6M. Mudrová, 2004

  • 7

    Let’s Go to Two Dimensions…

    0 10 20 30 40 50 60-101

    x(n)

    n

    n -> [n, m] k -> [k, l]

    |X(k

    )|

    0 31 15 k 63

    2D DFT

    ),(),( lkXmnx ⇔∑∑−=

    =

    +−=

    1

    0

    1

    0

    )(2 ),(1),(

    N

    n

    M

    m

    Mlm

    Nkni

    emnxMN

    lkXπ

    ∑∑−

    =

    =

    ++=

    1

    0

    1

    0

    )(2 ),(),(

    N

    k

    M

    l

    Mml

    Nnki

    elkXmnxπ

    Direct 2D DFT: Inverse 2D DFT:

    1

    6 4

    1

    6 40

    1

    n

    x (n ,m )

    m-1

    01

    -1

    0

    1

    f k

    | X ( f k , f l) |

    f ln

    m

    1 6 4

    1 64

    x (n ,m )

    M. Mudrová, 2004

  • Example of 2D DFT of Real Image

    Symetry

    0 1

    1

    0

    1-1-1

    1

    n

    m

    1 366

    1

    270

    x(n,m)

    8M. Mudrová, 2004

  • Digital Filtering Principle

    What happens in the case of spectrum processing?Spectrum |X(k)|Time space x(n)

    1. Periodical function

    2. Random noise

    3. =1.+2.

    4. After spectrum processing

    9M. Mudrová, 2004

  • 2D Filtering

    10M. Mudrová, 2004

  • Discrete Convolution Principle

    What is happening in the image space during the spectrum processing?Frequency space:

    Multiplication

    11

    Time (image) space:Convolution

    ∑=

    −==n

    jjnhjxnhnxny

    0)()()(*)()(

    kkHkXkY pro )( . )()( ∀=

    y(n)…requested functionx(n)...given (damaged) functionh(n) …digital filter

    Where:

    M. Mudrová, 2004

  • Discrete Convolution Example

    What is a meaning of convolution?

    12

    ∑=

    −=

    =n

    jjnhjx

    nhnxny

    0)()(

    )(*)()(

    x(n) = 10; 20; 30; 40; 50h(n) = 0,5; 0,5

    n=0 j=0 f(0).h(0) 10 . 0,5 5 y(0)= 5n=1 j=0 f(0).h(1-0) 10 . 0,5 5

    j=1 f(1).h(1-1) 20 . 0,5 10 y(1)=5+10 = 15n=2 j=0 f(0).h(2-0) nedef.

    j=1 f(1).h(2-1) 20 . 0,5 10j=2 f(2).h(2-2) 30 . 0,5 15 y(2)=10+15= 25

    n=3 j=0 f(0).h(3-0) nedef.j=1 f(1).h(3-1) nedef.j=2 f(2).h(3-2) 30 . 0,5 15j=3 f(3).h(3-3) 40 . 0,5 20 y(3)=15+20= 35

    n=4 j=0,1,2 nedef.j=3 f(4).h(4-3) 40 . 0,5 20j=4 f(4).h(4-4) 50 . 0,5 25 y(4)=25+20= 45

    Example:(Sliding average)

    y(n) = 5; 15; 25; 35; 45

    M. Mudrová, 2004

  • 13

    2D Discrete Convolution

    How does it seem the convolution in 2D?

    ∑∑= =

    −−==n

    j

    m

    jjmjnhjjxmnhmnxmny

    0 02121

    1 2

    ),(),(),(*),(),(

    0 1 0

    1 -4 1

    0 1 0

    filter matrixh(n,m)

    image matrixx(n,m)

    Element evaluatedin (n,m) position

    M. Mudrová, 2004

  • Application I – Edge Detection

    Goal: Edge detection

    (=>image segmentation)

    Orig

    inal

    Imag

    eIm

    age

    afte

    r im

    age

    dete

    ctio

    n

    Edge = abrupt image function change

    Principle:Application of edge detectors= highpass filters

    14

    Example of filtr spectrum |H(k,l)|Filter matrix example:h(n,m) (Prewitt filtr)

    ⎥⎥⎥

    ⎢⎢⎢

    −−− 111000111

    M. Mudrová, 2004

  • Application II – Noise Removing

    Goal: Image Enhancement

    Orig

    inal

    Imag

    e

    Principle:Application of low pass filter

    Filter Spetrum |H(k,l)|

    Pre

    cess

    edIm

    age

    15M. Mudrová, 2004

  • Application III – Sharpening

    Goal: Corrupted image reconstruction

    Cor

    rupt

    ed im

    age

    Rec

    onst

    ruct

    ed im

    age

    Principle:

    • Inverse filtering• Wiener filtering

    Types of corruption:

    • Defocussing due to object movement • Bad objective focussing• Atmosphere turbulentions• etc.

    16M. Mudrová, 2004

  • Application IV – Object Detection

    Goal: Finding the coordinates of a given object in the image

    Principle:

    17

    • Evaluation of correlation function = convolution in the spatial domain

    • Using an algorithm of FFT the computation gets faster-> multiplication in the

    frequency domain

    Imag

    ex(

    n,m

    )

    Filtr

    h(n,

    m)

    Kor

    elač

    ní fu

    nkce

    h(n

    ,m)

    M. Mudrová, 2004

  • Advanced Methods of Image Analysis

    Short-time Fourier Transform- compromise between time (image)-frequency resolution

    Wavelet transform-use time (image) window with various length- used in image analysis, denoising, compression

    Radon transform-used for conversion from cylindric coordinate system-used mainly for biomedical image processing

    18M. Mudrová, 2004

    Fourier TransformMotivationMathematical MinimumExample of Continuous FTFrom Continuous to discrete FTFunction Restriction in Time (Spatial) DomainLet’s Go to Two Dimensions…Example of 2D DFT of Real ImageDigital Filtering Principle2D FilteringDiscrete Convolution PrincipleDiscrete Convolution Example2D Discrete ConvolutionApplication I – Edge DetectionApplication II – Noise RemovingApplication III – SharpeningApplication IV – Object DetectionAdvanced Methods of Image Analysis