Computer Graphics Spectral Analysis Philipp Slusallek Spatial - - PowerPoint PPT Presentation

computer graphics
SMART_READER_LITE
LIVE PREVIEW

Computer Graphics Spectral Analysis Philipp Slusallek Spatial - - PowerPoint PPT Presentation

Computer Graphics Spectral Analysis Philipp Slusallek Spatial Frequency Frequency Inverse of period length of some structure in an image Unit [1/pixel] Lowest frequency Image average Highest representable frequency


slide-1
SLIDE 1

Philipp Slusallek

Computer Graphics

Spectral Analysis

slide-2
SLIDE 2

Spatial Frequency

  • Frequency

– Inverse of period length

  • f some structure in an image

– Unit [1/pixel]

  • Lowest frequency

– Image average

  • Highest representable frequency

– Nyquist frequency (1/2 the sampling frequency) – Defined by half the image resolution

  • Phase allows shifting of the pattern

2

...

slide-3
SLIDE 3

Fourier Transformation

  • Any continuous function f(x) can be expressed as an

integral over sine and cosine waves:

  • Representation via complex exponential

– eix = cos(x) + i sin(x) (see Taylor expansion)

  • Division into even and odd parts

– Even: f(x) = f(-x) (symmetry about y axis) – Odd: f(x) = -f(-x) (symmetry about origin)

  • Transform of each part

– Even: cosine only; odd: sine only

3

𝐺 𝑙 = 𝐺

𝑦 𝑔 𝑦

𝑙 =

−∞ ∞

𝑔 𝑦 𝑓−𝑗2𝜌𝑙𝑦𝑒𝑦 𝑔(𝑦) = 𝐺

𝑦 −1 𝐺 𝑙

𝑦 =

−∞ ∞

𝐺 𝑙 𝑓𝑗2𝜌𝑙𝑦𝑒𝑙 Analysis: Synthesis: 𝑔 𝑦 = 1 2 𝑔 𝑦 + 𝑔 −𝑦 + 1 2 𝑔 𝑦 − 𝑔 −𝑦 = 𝐹 𝑦 + 𝑃(𝑦)

slide-4
SLIDE 4

Analysis & Synthesis

  • Analysis

– Even term – Odd term

  • Synthesis

– Even term – Odd term

4

𝑐 𝑙 =

−∞ ∞

𝑔 𝑦 cos 2𝜌𝑙𝑦 𝑒𝑦 =

−∞ ∞

(𝐹 𝑦 + 𝑃(𝑦)) cos 2𝜌𝑙𝑦 𝑒𝑦 =

−∞ ∞

𝐹 𝑦 cos 2𝜌𝑙𝑦 𝑒𝑦 𝑏 𝑙 =

−∞ ∞

𝑔 𝑦 sin 2𝜌𝑙𝑦 𝑒𝑦 =

−∞ ∞

(𝐹 𝑦 + 𝑃(𝑦)) sin 2𝜌𝑙𝑦 𝑒𝑦 =

−∞ ∞

𝑃 𝑦 sin 2𝜌𝑙𝑦 𝑒𝑦 𝐹 𝑦 =

−∞ ∞

𝐺 𝑙 cos 2𝜌𝑙𝑦 𝑒𝑙 =

−∞ ∞

𝑐 𝑙 − 𝑗 𝑏(𝑙) cos 2𝜌𝑙𝑦 𝑒𝑙 =

−∞ ∞

𝑐 𝑙 cos 2𝜌𝑙𝑦 𝑒𝑙 𝑃 𝑦 =

−∞ ∞

𝐺 𝑙 𝑗 sin 2𝜌𝑙𝑦 𝑒𝑙 =

−∞ ∞

𝑐 𝑙 − 𝑗 𝑏(𝑙) 𝑗 sin 2𝜌𝑙𝑦 𝑒𝑙 =

−∞ ∞

𝑏 𝑙 sin 2𝜌𝑙𝑦 𝑒𝑙 𝐺 𝑙 =

−∞ ∞

𝑔 𝑦 cos −2𝜌𝑙𝑦 + 𝑗 sin −2𝜌𝑙𝑦 𝑒𝑦 = 𝑐 𝑙 + 𝑗 𝑏(𝑙) 𝑔 𝑦 =

−∞ ∞

𝐺 𝑙 cos 2𝜌𝑙𝑦 + 𝑗 sin 2𝜌𝑙𝑦 𝑒𝑙 = 𝐹 𝑦 + 𝑃(𝑦) Symetric integral ([-a, a])

  • ver an odd function is zero
slide-5
SLIDE 5

Spatial vs. Frequency Domain

  • Important basis functions:

– Box ↔ (normalized) sinc

  • Negative values
  • Infinite support

– Tent ↔ sinc2

  • Tent == Convolution of

box function with itself

– Gaussian ↔ Gaussian

  • Inverse width

5

sinc 𝑦 = sin 𝑦𝜌 𝑦𝜌 sinc(0)= 1 sinc(𝑦)݀ݔ=1

slide-6
SLIDE 6

Spatial vs. Frequency Domain

  • Transform behavior
  • Example: Fourier transform of a box function

– Wide box  narrow sinc – Box  sinc – Narrow box  wide sinc

6

slide-7
SLIDE 7

Fourier Transformation

  • Periodic in space  discrete in frequency (vice ver.)

– Any periodic, continuous function can be expressed as the sum

  • f an (infinite) number of sine or cosine waves:

f(x) = k ak sin(2*k*x) + bk cos(2*k*x) – Any finite interval can be made periodic by concatenating with itself

  • Decomposition of signal into different frequency

bands: Spectral Analysis

– Frequency band: k

  • k = 0

: mean value

  • k = 1

: function period, lowest possible frequency

  • k = 1.5 ? : not possible, periodic function, e.g. f(x) = f(x+1)
  • kmax ?

: band limit, no higher frequency present in signal

– Fourier coefficients: ak, bk (real-valued, as before)

  • Even function f(x) = f(-x) : ak = 0
  • Odd function f(x) = -f(-x) : bk = 0

7

slide-8
SLIDE 8

Fourier Synthesis Example

8

slide-9
SLIDE 9

Discrete Fourier Transform

  • Equally-spaced function samples (N samples)

– Function values known only at discrete points, e.g.

  • Idealized physical measurements
  • Pixel positions in an image!

– Represented via sum of Delta distribution (Fourier integrals → sums)

  • Fourier analysis

– Sum over all N measurement points – k = 0,1,2,…? Highest possible frequency?

  • Nyquist frequency: highest frequency that can be represented
  • Defined as 1/2 the sampling frequency
  • Sampling rate N: determined by image resolution (pixel size)
  • 2 samples / period ↔ 0.5 cycles per pixel  kmax ≤ N / 2

9

𝑏𝑙 =

𝑗

sin 2π𝑙𝑗 𝑂 𝑔

𝑗

𝑐𝑙 =

𝑗

cos 2π𝑙𝑗 𝑂 𝑔

𝑗

slide-10
SLIDE 10

Spatial vs. Frequency Domain

  • Examples (pixels vs. cycles per pixel)

– Sine wave with positive offset – Square wave with offset – Scanline of an image

10

slide-11
SLIDE 11

2D Fourier Transform

  • 2 separate 1D Fourier transformations along x and y

directions

  • Discontinuities: orthogonal direction in Fourier

domain !

11

slide-12
SLIDE 12

Convolution

  • Two functions f, g
  • Shift one (reversed)

function against the other by x

  • Multiply function values
  • Integrate across
  • verlapping region
  • Numerical convolution:

expensive operation

– For each x: integrate over non-zero domain

13

𝑔 ⊗ 𝑕 𝑦 =

−∞ ∞

𝑔 τ 𝑕 𝑦 − τ 𝑒τ

slide-13
SLIDE 13

Convolution

  • Examples

14

slide-14
SLIDE 14

Convolution Theorem

  • Convolution in image domain

→ Multiplication in Fourier domain

  • Convolution in Fourier domain

→ Multiplication in image domain

  • Multiplication in transformed Fourier domain may be

cheaper than direct convolution in image domain !

15

= .

slide-15
SLIDE 15

Convolution and Filtering

  • Technical realization

– In image domain – Pixel mask with weights

  • Problems (e.g. sinc)

– Large filter support

  • Large mask
  • A lot of computation

– Negative weights

  • Negative light?

16

slide-16
SLIDE 16

Filtering

  • Low-pass filtering

– Multiplication with box in frequency domain – Convolution with sinc in spatial domain

  • High-pass filtering

– Multiplication with (1 - box) in frequency domain – Only high frequencies

  • Band-pass filtering

– Only intermediate

17

slide-17
SLIDE 17

Low-Pass Filtering

  • “Blurring”

18

slide-18
SLIDE 18

High-Pass Filtering

  • Enhances discontinuities in image

– Useful for edge detection

19