+ All Categories
Home > Documents > 05 Image Filtering - Welcome to...

05 Image Filtering - Welcome to...

Date post: 03-Feb-2021
Category:
Upload: others
View: 0 times
Download: 0 times
Share this document with a friend
9
Image Filtering Reading: –Chapter 7, F&P Due: Problem Set 1 February 14, 2008 What is image filtering? Modify the pixels in an image based on some function of a local neighborhood of the pixels. Some function Linear Functions Simplest: linear filtering. Replace each pixel by a linear combination of its neighbors. The prescription for the linear combination is called the “convolution kernel”. Convolution [ ] [ ] l k g l y k x I g I y x f k,l , , ] , [ = = Linear Filtering (warm-up slide) ? Original Linear Filtering (warm-up slide) ? Original Filtered (no change)
Transcript
  • 1

    Image Filtering

    Reading: –Chapter 7, F&P

    Due: Problem Set 1

    February 14, 2008

    What is image filtering?

    • Modify the pixels in an image based on some function of a local neighborhood of the pixels.

    Some function

    Linear Functions• Simplest: linear filtering.

    Replace each pixel by a linear combination of its neighbors.

    • The prescription for the linear combination is called the “convolution kernel”.

    Convolution

    [ ] [ ]lkglykxIgIyxfk,l

    ,,],[ −−=⊗= ∑

    Linear Filtering (warm-up slide)

    ?Original

    Linear Filtering (warm-up slide)

    ?Original Filtered

    (no change)

  • 2

    Linear Filtering Shifted

    Linear Filtering Blurring

    Blur Example Linear Filtering (warm-up slide)

  • 3

    Linear Filtering (no change) Linear Filtering

    Remember Blurring Sharpening

    Sharpening Example Sharpening

  • 4

    Oriented Filters• Filter bank:

    • Mix of edge, bar, spot filters at multiple scales and orientations

    1st derivative of a gaussian 2nd derivative of a gaussian

    6 orientations 6 orientations

    3 sc

    ales

    8 Laplacian of Gaussian filters 4 Gaussian filters

    Linear Image Transformation• In analyzing images, it’s often useful to make a

    change of basis.

    fUFrr

    = Vectorized image

    Fourier Transform, orWavelet Transform, orSteerable Pyramid Transform

    Transformed image

    Self-inverting Transforms

    • Same basis functions are used for the inverse transform

    FUFUfr

    rr

    +

    ==

    Transpose and complex conjugate

    Example: Fourier Transform• Forward Transform

    • Inverse Transform

    FFT on-line book: http://ccrma.stanford.edu/%7Ejos/mdft/mdft.html

    [ ]

    +−−

    =

    =∑∑= N

    yvMxuiM

    x

    N

    yefvuF

    π1

    0

    1

    0y][x,,

    [ ]

    ++−

    =

    =∑∑= N

    yvMxuiM

    x

    N

    y

    evuFMN

    fπ1

    0

    1

    0

    1y][x, ,

  • 5

    Phase and Magnitude

  • 6

    Discrete-time, continuous frequency Fourier transform

  • 7

    Bracewell’s dictionary of Fourier transform pairs

    Bracewell’s dictionary of Fourier transform pairs

    Why is the Fourier domain useful?• It tells us the effect of linear convolutions.• There is a fast algorithm for performing the DFT,

    allowing for efficient signal filtering.• The Fourier domain offers an alternative domain for

    understanding and manipulating the image.

    Why is the Fourier transform useful?• Convolution theorem:

    • the Fourier transform of the convolution of two functions is the product of their individual Fourier transforms

    • Addition Theorem:• The Fourier transform of the addition of two functions f(x) and g(x) is the

    addition of their Fourier transforms F(s) and G(s). • Shift Theorem:

    • A function f(x) shifted along the x-axis by a to become f(x-a) has the Fourier transform . The magnitude of the transform is the same, only the phases change.

    • Similarity Theorem:• For a function f(x) with a Fourier tranform F(s), if the x-axis is scaled by a

    constant a so that we have f(ax), the Fourier transform becomes (1/a)F(s/a). In other words, a "wide" function in the time-domain is a "narrow" function in the frequency-domain.

    • Modulation Theorem:• The Fourier transform of a function f(x) multiplied by is )( fxπ2cos

    ( ) ( )fsFfsF ++−21

    21

    )( sFe iasπ2−

    hgf ⊗=

    Fourier transform of convolution

    Consider a (circular) convolution of g and h

  • 8

    hgf ⊗=

    ( )hgDFTnmF ⊗=],[

    Fourier transform of convolution

    Take DFT of both sides

    hgf ⊗=( )hgDFTnmF ⊗=],[

    Fourier transform of convolution

    Write the DFT and convolution explicitly

    [ ] ∑∑∑−

    =

    =

    +−

    −−=1

    0

    1

    0 ,],[],[,

    M

    u

    N

    v

    Nvn

    Mumi

    lkelkhlvkugnmF

    π

    hgf ⊗=( )hgDFTnmF ⊗=],[

    Fourier transform of convolution

    Move the exponent in

    [ ] ∑∑∑−

    =

    =

    +−

    −−=1

    0

    1

    0 ,

    ],[],[,M

    u

    N

    v

    Nvn

    Mumi

    lk

    elkhlvkugnmFπ

    ∑∑∑−

    =

    =

    +−

    −−=1

    0

    1

    0 ,

    ],[],[M

    u

    N

    v lk

    Nvn

    Mumi

    lkhelvkugπ

    hgf ⊗=( )hgDFTnmF ⊗=],[

    Fourier transform of convolution

    Change variables in the sum

    [ ] ∑∑∑−

    =

    =

    +−

    −−=1

    0

    1

    0 ,

    ],[],[,M

    u

    N

    v

    Nvn

    Mumi

    lk

    elkhlvkugnmFπ

    ∑∑∑−

    =

    =

    +−

    −−=1

    0

    1

    0 ,

    ],[],[M

    u

    N

    v lk

    Nvn

    Mumi

    lkhelvkugπ

    ( ) ( )

    ∑ ∑ ∑−−

    −=

    −−

    −=

    ++

    +−

    =1 1

    ,],[],[

    kM

    k

    lN

    l lk

    Nnl

    Mmki

    lkhegµ υ

    υµπυµ

    hgf ⊗=( )hgDFTnmF ⊗=],[

    Fourier transform of convolution

    Perform the DFT (circular boundary conditions)

    [ ] ∑∑∑−

    =

    =

    +−

    −−=1

    0

    1

    0 ,

    ],[],[,M

    u

    N

    v

    Nvn

    Mumi

    lk

    elkhlvkugnmFπ

    ∑∑∑−

    =

    =

    +−

    −−=1

    0

    1

    0 ,

    ],[],[M

    u

    N

    v lk

    Nvn

    Mumi

    lkhelvkugπ

    ( ) ( )

    ∑ ∑ ∑−−

    −=

    −−

    −=

    ++

    +−

    =1 1

    ,],[],[

    kM

    k

    lN

    l lk

    Nnl

    Mmki

    lkhegµ υ

    υµπυµ

    [ ]∑

    +−

    =lk

    NMkmi

    lkhenmG,

    ln

    ],[,π

    hgf ⊗=( )hgDFTnmF ⊗=],[

    Fourier transform of convolution

    Perform the other DFT (circular boundary conditions)

    [ ] ∑∑∑−

    =

    =

    +−

    −−=1

    0

    1

    0 ,

    ],[],[,M

    u

    N

    v

    Nvn

    Mumi

    lk

    elkhlvkugnmFπ

    ∑∑∑−

    =

    =

    +−

    −−=1

    0

    1

    0 ,

    ],[],[M

    u

    N

    v lk

    Nvn

    Mumi

    lkhelvkugπ

    ( ) ( )

    ∑ ∑ ∑−−

    −=

    −−

    −=

    ++

    +−

    =1 1

    ,],[],[

    kM

    k

    lN

    l lk

    Nnl

    Mmki

    lkhegµ υ

    υµπυµ

    [ ]∑

    +−

    =lk

    NMkmi

    lkhenmG,

    ln

    ],[,π

    [ ] [ ]nmHnmG ,,=

  • 9

    Analysis of our simple filters

    original0Pixel offset

    coef

    ficie

    nt

    1.0

    Filtered(no change)

    1

    ][][1

    0

    =

    = ∑−

    =

    −M

    k

    Mkmi

    ekfmFπ

    0

    1.0 constant

    Analysis of our simple filters

    0Pixel offset

    coef

    ficie

    nt

    original

    1.0

    shifted

    Mmi

    M

    k

    Mkmi

    e

    ekfmF

    δπ

    π

    =

    =

    = ∑

    ][][1

    0

    0

    1.0

    Constant magnitude, linearly shifted phase

    δ

    Convolution versus FFT• 1- d FFT: O(NlogN) computation time, where N is

    number of samples.• 2- d FFT: 2N(NlogN), where N is number of pixels on

    a side• Convolution: K N2, where K is number of samples in

    kernel• Say N=210, K=100. 2- d FFT: 20 220, while

    convolution gives 100 220

    The END


Recommended