Introduction to Wavelets in Image Processing

32
Image and Multidimensional Signal Processing Colorado School of Mines Introduction to Wavelets in Image Processing

Transcript of Introduction to Wavelets in Image Processing

Page 1: Introduction to Wavelets in Image Processing

Image and Multidimensional Signal Processing Colorado School of Mines

Introduction to Wavelets in Image Processing

Page 2: Introduction to Wavelets in Image Processing

Image and Multidimensional Signal Processing Colorado School of Mines

Pyramid Representation

• Recall that we can create a multi-resolution pyramid of images

• At each level, we just store the differences (residuals) between the image at that level and the predicted image from the next level

• We can reconstruct the image by just adding up all the residuals

• Advantage: residuals are easier to store

Page 3: Introduction to Wavelets in Image Processing

Image and Multidimensional Signal Processing Colorado School of Mines

Page 4: Introduction to Wavelets in Image Processing

Image and Multidimensional Signal Processing Colorado School of Mines

Wavelets

• Wavelets are a more general way to represent and analyze multiresolution images

• Can also be applied to 1D signals

• Very useful for

– image compression (e.g., in the JPG-2000 standard)

– removing noise

Page 5: Introduction to Wavelets in Image Processing

Image and Multidimensional Signal Processing Colorado School of Mines

Wavelet Analysis

• Motivation – Sometimes we care about both frequency as well as time

– Example: Music

– Time domain operations tell us “when”

– Fourier domain operations tell us “frequency”

(a) (b) (c) (d)

Page 6: Introduction to Wavelets in Image Processing

Image and Multidimensional Signal Processing Colorado School of Mines

from Matlab help page on wavelets

Page 7: Introduction to Wavelets in Image Processing

Image and Multidimensional Signal Processing Colorado School of Mines

Continuous Wavelet Transform

• Define a function y(x) – assume y(x) band-limited and its dc component = 0

• Create scaled and shifted versions of y(x)

• Example:

s

x

sxs

yy

1)(,

Page 8: Introduction to Wavelets in Image Processing

Image and Multidimensional Signal Processing Colorado School of Mines

Example of scaling

Page 9: Introduction to Wavelets in Image Processing

Image and Multidimensional Signal Processing Colorado School of Mines

Continuous Wavelet Transform

• Define the continuous wavelet transform of f(x):

• This transforms a continuous function of one variable into a continuous function of two variables: translation and scale

• The wavelet coefficients measure how closely correlated the wavelet is with each section of the signal

• For compact representation, choose a wavelet that matches the shape of the image components – Example: Haar wavelet for black and white drawings

dxxxfsW s )()(),( , y

Page 10: Introduction to Wavelets in Image Processing

Image and Multidimensional Signal Processing Colorado School of Mines

Example

2247.0),( 22 sW

Low value for Wy(s,)

Higher value of Wy(s,2)

Different scale

Page 11: Introduction to Wavelets in Image Processing

Image and Multidimensional Signal Processing Colorado School of Mines

-10 -8 -6 -4 -2 0 2 4 6 8 10-0.5

0

0.5

1

y(x)

“mexican hat” wavelet

Page 12: Introduction to Wavelets in Image Processing

Image and Multidimensional Signal Processing Colorado School of Mines

Matlab Demo

• Run “wavemenu” – Choose “Continuous wavelet 1D”

– Choose “Example analysis” -> “frequency breakdown with mexh”

– Look at magnitude of coefficients (right click on coefficients to select scale, then hit the button “new coefficients line")

0 100 200 300 400 500 600 700 800 900 1000-1

0

1

Page 13: Introduction to Wavelets in Image Processing

Image and Multidimensional Signal Processing Colorado School of Mines

13

Page 14: Introduction to Wavelets in Image Processing

Image and Multidimensional Signal Processing Colorado School of Mines

Inverse Transform

• Inverse continuous wavelet transform

• where

• and Y(m) is the Fourier transform of y(x)

0 2

, )(),(

1)( dsd

s

xsW

Cxf s

y

y

y

Y m

m

my dC

||

)(

Page 15: Introduction to Wavelets in Image Processing

Image and Multidimensional Signal Processing Colorado School of Mines

Discrete Wavelet Transform

• Don’t need to calculate wavelet coefficients at every possible scale

• Can choose scales based on powers of two, and get equivalent accuracy

• We can represent a discrete function f(n) as a weighted summation of wavelets y(n), plus a coarse approximation (n)

where j0 is an arbitrary starting scale, and n = 0,1,2, … M

)2(2)( 2/

, kxx jj

kj yy

0

0)(),(

1)(),(

1)( ,,0

jj k

kj

k

kj nkjWM

nkjWM

nf y y

x

kj xxfM

kjW )()(1

),( ,0 0 Y

x

kj xxfM

kjW )()(1

),( ,y

“Approximation” coefficients “Detail” coefficients

Page 16: Introduction to Wavelets in Image Processing

Image and Multidimensional Signal Processing Colorado School of Mines

Comparison with CWT

• Usually you

don’t need to

compute the

continuous

transform

• A signal (with

finite energy)

can be

reconstructed

from the

discrete

transform

From Matlab help page on wavelets

Page 17: Introduction to Wavelets in Image Processing

Image and Multidimensional Signal Processing Colorado School of Mines

Harr scaling functions

Harr wavelet functions

Page 18: Introduction to Wavelets in Image Processing

Image and Multidimensional Signal Processing Colorado School of Mines

Example

• A function can be represented by a sum of approximation plus detail

)()()( xfxfxf da

)(8

2)(

4

23)( 2,00,0 xxxfa

)(8

2)(

4

2)( 2,00,0 xxxfd yy

Page 19: Introduction to Wavelets in Image Processing

Image and Multidimensional Signal Processing Colorado School of Mines

Matlab Demos

• “wavemenu”

• Do 1D discrete wavelet transform on noisy doppler signal, show denoising

Page 20: Introduction to Wavelets in Image Processing

Image and Multidimensional Signal Processing Colorado School of Mines

20

Page 21: Introduction to Wavelets in Image Processing

Image and Multidimensional Signal Processing Colorado School of Mines

21

Page 22: Introduction to Wavelets in Image Processing

Image and Multidimensional Signal Processing Colorado School of Mines

22

Page 23: Introduction to Wavelets in Image Processing

Image and Multidimensional Signal Processing Colorado School of Mines

Expanding to Two Dimensions

Page 24: Introduction to Wavelets in Image Processing

Image and Multidimensional Signal Processing Colorado School of Mines

a(m,n): approximation dV(m,n): detail in vertical dH(m,n): detail in horizontal dD(m,n): detail in diagonal

a dV

dH dD

Page 25: Introduction to Wavelets in Image Processing

Image and Multidimensional Signal Processing Colorado School of Mines

Page 26: Introduction to Wavelets in Image Processing

Image and Multidimensional Signal Processing Colorado School of Mines

Use of Wavelets in Processing

• Approach: – Compute the 2D wavelet transform

– Alter the transform

– Compute the inverse transform

• Examples: – De-noising

– Compression

– Image fusion

Page 27: Introduction to Wavelets in Image Processing

Image and Multidimensional Signal Processing Colorado School of Mines

Example – Fusion

Page 28: Introduction to Wavelets in Image Processing

Image and Multidimensional Signal Processing Colorado School of Mines

Matlab Examples (“wavemenu”)

• De-noising – Choose “SWT de-noising 2D”

– Set threshold value to zero out coefficients below the threshold

• Compression – Choose “Wavelet coefficients selection 2D”

• Fusion – Choose “Image fusion”

Page 29: Introduction to Wavelets in Image Processing

Image and Multidimensional Signal Processing Colorado School of Mines

29

Page 30: Introduction to Wavelets in Image Processing

Image and Multidimensional Signal Processing Colorado School of Mines

30

Page 31: Introduction to Wavelets in Image Processing

Image and Multidimensional Signal Processing Colorado School of Mines

31

Page 32: Introduction to Wavelets in Image Processing

Image and Multidimensional Signal Processing Colorado School of Mines

Summary / Questions

• Wavelets represent the scale of features in an image, as well as their position. – Can also be applied to 1D signals.

• They are useful for a number of applications including image compression.

• We can use them to process images: – Compute the 2D wavelet transform

– Alter the transform

– Compute the inverse transform

• What are some other applications of wavelet processing?

32