ece 468 / cs 519: digital image processing spatial...

19
ECE 468 / CS 519: Digital Image Processing Spatial Sharpening Prof. Sinisa Todorovic [email protected] 1

Upload: phungduong

Post on 22-Jun-2018

216 views

Category:

Documents


0 download

TRANSCRIPT

ECE 468 / CS 519: Digital Image Processing

Spatial Sharpening

Prof. Sinisa Todorovic

[email protected]

1

Outline

• MATLAB

• Sharpening spatial filters (Textbook: 3.5)

2

Image Sharpening

3

Second Derivative

2nd derivative

Original signal

4

Second Derivative

Original signal - 2nd derivative

Original signal

5

Image Derivatives

⇥f(x, y)⇥x

� f(x + 1, y) � f(x, y)⇥f(x, y)

⇥y� f(x, y + 1) � f(x, y)

6

Image Derivatives

7

Image Derivatives

⇥2f(x, y)⇥2x

� f(x + 1, y) + f(x � 1, y) � 2f(x, y)⇥2f(x, y)

⇥2y� f(x, y + 1) + f(x, y � 1) � 2f(x, y)

7

Laplacian

�2f(x, y) = ⇥2f(x, y)⇥2x

+ ⇥2f(x, y)⇥2y

⇥2f(x, y) � f(x + 1, y) + f(x � 1, y)

+ f(x, y + 1) + f(x, y � 1)� 4f(x, y)

8

Sharpening Spatial Filters

Variants of the Laplacian filter

9

Image Sharpening

• Blur the original image

• Subtract the Laplacian

g(x, y) = f(x, y) ± c � ⇥2f(x, y)

10

Image Sharpening

g(x, y) = f(x, y) ± c � ⇥2f(x, y)

c = �1

c = +1

use for

use for

11

Unsharp Masking

• Blur the original image

• Subtract the blurred image from the original

• Add the resulting mask to the original

g(x, y) = f(x, y) + k(f(x, y) � f(x, y))

k = 1 unsharp masking

k > 1 highboost filtering

12

Unsharp Masking

input

blurred

input - blurred

input + (input - blurred)

input + 4.5 (input - blurred)

13

MATLAB

14

MATLAB

• g = imfilter(f, w, ‘corr’, ‘replicate’)

14

MATLAB

• g = imfilter(f, w, ‘corr’, ‘replicate’)

• f = padarray(f, [delta_row delta_col], ‘replicate’,‘post’)

14

MATLAB

• g = imfilter(f, w, ‘corr’, ‘replicate’)

• f = padarray(f, [delta_row delta_col], ‘replicate’,‘post’)

• w = fspecial(‘type’, parameters)

14

MATLAB

• g = imfilter(f, w, ‘corr’, ‘replicate’)

• f = padarray(f, [delta_row delta_col], ‘replicate’,‘post’)

• w = fspecial(‘type’, parameters)

• fspecial(‘gaussian’, [r c], sigma)

14