Top Banner
Basis beeldverwerking (8D040) dr. Andrea Fuster dr. Anna Vilanova Prof.dr.ir. Marcel Breeuwer Convolution
49

Convolution

Feb 22, 2016

Download

Documents

bina

Basis beeldverwerking (8D040) dr. Andrea Fuster dr. Anna Vilanova Prof.dr.ir . Marcel Breeuwer. Convolution. Contents. Spatial filtering Correlation Convolution Filters: Smoothing filters Sharpening filters Borders. Spatial filtering. - PowerPoint PPT Presentation
Welcome message from author
This document is posted to help you gain knowledge. Please leave a comment to let me know what you think about it! Share it to your friends and learn new things together.
Transcript
Page 1: Convolution

Basis beeldverwerking (8D040)

dr. Andrea Fusterdr. Anna VilanovaProf.dr.ir. Marcel Breeuwer

Convolution

Page 2: Convolution

Contents

2

• Spatial filtering• Correlation• Convolution• Filters:

• Smoothing filters• Sharpening filters

• Borders

Basis beeldverwerking 8D040

Page 3: Convolution

Spatial filtering

• Input image , use a filter to obtain processed image

• Filter consists of• Neighbourhood (rectangular)• Mostly odd dimensions• Predefined operation

• Create new pixel value in center of neighbourhood

3Basis beeldverwerking 8D040

Page 4: Convolution

Spatial filtering

• Filter operation (3x3 filter)

• More compact notation - filter

4Basis beeldverwerking 8D040

Page 5: Convolution

Intuition to filtering

5Basis beeldverwerking 8D040

Page 6: Convolution

Move filter over image

6Basis beeldverwerking 8D040

Page 7: Convolution

7Basis beeldverwerking 8D040

Page 8: Convolution

8Basis beeldverwerking 8D040

Page 9: Convolution

9Basis beeldverwerking 8D040

Page 10: Convolution

10Basis beeldverwerking 8D040

Page 11: Convolution

Correlation

• While moving the filter, at each position

• Multiply values of overlapping locations• Sum all multiplication results

11Basis beeldverwerking 8D040

Page 12: Convolution

Correlation vs. Convolution

• Discrete Correlation 2D

• Discrete Convolution 2D

12Basis beeldverwerking 8D040

- Equivalent to first rotate the filter 180 degrees and correlate-

Page 13: Convolution

Example

See blackboard ☺ (or figure 3.30 Gonzalez and Woods)

Basis beeldverwerking 8D040 13

Page 14: Convolution

Correlation vs. Convolution

• Correlation and convolution give the same result if the filter used is symmetric!

Basis beeldverwerking 8D040 1425-03-2009

Page 15: Convolution

Convolution – 1D cont. case

• Imagine a system with • input signal• transfer function• output signal

• then

15Basis beeldverwerking 8D040

Page 16: Convolution

Definition

16

output input

system transfer function

Basis beeldverwerking 8D040

Page 17: Convolution

Dirac delta function (unit impulse)

• Definition

• Constraint

• Sifting property

• Specifically for t=0

17Basis beeldverwerking 8D040

Page 18: Convolution

Convolution

• Let

18Basis beeldverwerking 8D040

We saw this already in the discrete case

Page 19: Convolution

Properties of convolution

• Commutative

• Associative

• Distributive19Basis beeldverwerking 8D040

Page 20: Convolution

Convolution is commutative• Proof

• Let

• Q.E.D.

20Basis beeldverwerking 8D040

Page 21: Convolution

Convolution is associative - 1

• Proof

21Basis beeldverwerking 8D040

Page 22: Convolution

Convolution is associative - 2

22Basis beeldverwerking 8D040

Page 23: Convolution

Convolution is associative - 3

• Let

23Basis beeldverwerking 8D040

Page 24: Convolution

Convolution is associative - 4

• Q.E.D.

24Basis beeldverwerking 8D040

Page 25: Convolution

Convolution is distributive - 1

• Proof

25Basis beeldverwerking 8D040

Page 26: Convolution

Convolution is distributive - 2

• Q.E.D.

26Basis beeldverwerking 8D040

Page 27: Convolution

Discrete convolution

• 1D

• 2D

27Basis beeldverwerking 8D040

Page 28: Convolution

Discrete convolution

• Formulas take summation from to• Filters have a limited size, e.g.,

• 1D 2a + 1

• 2D (2a + 1, 2b + 1)

28Basis beeldverwerking 8D040

Page 29: Convolution

Filter Kernels

29

Kernel

Basis beeldverwerking 8D040

Page 30: Convolution

Filters

• Idea: correlate or convolve image with different filters in order to obtain different results, i.e., processed images

Basis beeldverwerking 8D040 30

Page 31: Convolution

Smoothing filters

• Average intensities – result is blurred image, less details

• Response: (z’s image intensities)

31Basis beeldverwerking 8D040

… NxN filter

Page 32: Convolution

Smoothing filters

• Note that:

− Sum of filter coefficients is 1 (normalized filter)− Correlation = convolution (symmetric filter)− Filter size effect?

Basis beeldverwerking 8D040 32

Page 33: Convolution

Smoothing filters - example

33Basis beeldverwerking 8D040

Original 3x3 smoothing filter NxN filter (see figure 3.33 in

Gonzalez and Woods!)

Page 34: Convolution

Effect of normalized smoothing kernel

Basis beeldverwerking 8D040 34

normalized

non- normalized

Page 35: Convolution

Sharpening filters

• Enhance parts of the image where intensities change rapidly, such as edges • Basic derivative filters

• Measure change of intensity in x or y direction

35Basis beeldverwerking 8D040

Page 36: Convolution

Example

36Basis beeldverwerking 8D040

Page 37: Convolution

Arbitrary angle derivative

• Given and

37Basis beeldverwerking 8D040

Page 38: Convolution

Arbitrary angle derivative

38Basis beeldverwerking 8D040

Page 39: Convolution

Prewitt gradient kernel

• Derivative in one direction, smoothing in the perpendicular direction

39Basis beeldverwerking 8D040

Page 40: Convolution

Example

40Basis beeldverwerking 8D040 25-03-2009

Prewitt

Basic derivative

Page 41: Convolution

Sobel kernel

41Basis beeldverwerking 8D040

Page 42: Convolution

Example

42

(Thanks to Wikipedia☺)

Page 43: Convolution

Derivative filters

• Note that coefficients in all of the previous filters sum to zero, i.e., zero response in area of constant intensity

• Also: gradient, Laplacian, …

Basis beeldverwerking 8D040 43

Page 44: Convolution

Borders

• Do you see any problems at image borders?

• Try position (0,0)

44Basis beeldverwerking 8D040

Page 45: Convolution

Border problems

• How to handle?• No border handling

• Border is not filtered• Padding

• Put values outside image border • Cyclic padding

• Use values from the other side of the image

45Basis beeldverwerking 8D040

Page 46: Convolution

Zero padding

46Basis beeldverwerking 8D040

Page 47: Convolution

Cyclic padding

47Basis beeldverwerking 8D040

Page 48: Convolution

Padding

• Remember: padding is artificial!• The values chosen outside the border influence the

outcome image

48Basis beeldverwerking 8D040

Page 49: Convolution

End of part 2

Thanks and see you Tuesday 21!

Basis beeldverwerking 8D040 49