ece 468: digital image processing lecture 3web.engr.oregonstate.edu/~sinisa/courses/osu/ece... ·...

17
ECE 468: Digital Image Processing Lecture 3 Prof. Sinisa Todorovic [email protected] 1 Next Class Homework 1 due Histogram equalization (Textbook: 3.3.1); Histogram specification (Textbook: 3.3.2); Spatial convolution and correlation (Textbook: 3.4.2); Smoothing and sharpening spatial filters (Textbook: 3.5); Homework 2 2

Upload: others

Post on 16-Oct-2020

1 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: ECE 468: Digital Image Processing Lecture 3web.engr.oregonstate.edu/~sinisa/courses/OSU/ECE... · ECE 468: Digital Image Processing Lecture 3 Prof. Sinisa Todorovic sinisa@eecs.oregonstate.edu

ECE 468: Digital Image Processing

Lecture 3

Prof. Sinisa Todorovic

[email protected]

1

Next Class

• Homework 1 due

• Histogram equalization (Textbook: 3.3.1);

• Histogram specification (Textbook: 3.3.2);

• Spatial convolution and correlation (Textbook: 3.4.2);

• Smoothing and sharpening spatial filters (Textbook: 3.5);

• Homework 2

2

Page 2: ECE 468: Digital Image Processing Lecture 3web.engr.oregonstate.edu/~sinisa/courses/OSU/ECE... · ECE 468: Digital Image Processing Lecture 3 Prof. Sinisa Todorovic sinisa@eecs.oregonstate.edu

Histogram of Intensity Values

x axis: intensity values

y axis: frequency

3

Histogram Equalization

• Increases local contrast by spreading out the intensity histogram

• Produces artifacts

input output

intensity-level histogram (red)

cumulative histogram (black)

4

Page 3: ECE 468: Digital Image Processing Lecture 3web.engr.oregonstate.edu/~sinisa/courses/OSU/ECE... · ECE 468: Digital Image Processing Lecture 3 Prof. Sinisa Todorovic sinisa@eecs.oregonstate.edu

Histogram Equalization

input output

s = T (r)

output

intensity

input

intensity

narrow histogram

of intensities

flat histogram

of intensities

narrow

distribution

of intensities

flat

distribution

of intensities

p(r)p(s)

5

number of pixels

with intensity i

Distribution of Intensity Values

p(r = i) =ni

ntotal number

of pixels

6

Page 4: ECE 468: Digital Image Processing Lecture 3web.engr.oregonstate.edu/~sinisa/courses/OSU/ECE... · ECE 468: Digital Image Processing Lecture 3 Prof. Sinisa Todorovic sinisa@eecs.oregonstate.edu

number of pixels

with intensity i

Distribution of Intensity Values

p(r = i) =ni

ntotal number

of pixels

s = T (r) ! p(s) = p(r)!

dT (r)dr

"!1

6

number of pixels

with intensity i

Distribution of Intensity Values

p(r = i) =ni

ntotal number

of pixels

s = T (r) ! p(s) = p(r)!

dT (r)dr

"!1

! dT (r)dr

= p(r)

6

Page 5: ECE 468: Digital Image Processing Lecture 3web.engr.oregonstate.edu/~sinisa/courses/OSU/ECE... · ECE 468: Digital Image Processing Lecture 3 Prof. Sinisa Todorovic sinisa@eecs.oregonstate.edu

number of pixels

with intensity i

Distribution of Intensity Values

p(r = i) =ni

ntotal number

of pixels

s = T (r) ! p(s) = p(r)!

dT (r)dr

"!1

! dT (r)dr

= p(r)

! T (r) = CDF (r)

6

Histogram Equalization

input output

cumulative distribution

p(r = i) =ni

nCDF (r = i) =

i!

j=0

p(r = j)

distribution

7

Page 6: ECE 468: Digital Image Processing Lecture 3web.engr.oregonstate.edu/~sinisa/courses/OSU/ECE... · ECE 468: Digital Image Processing Lecture 3 Prof. Sinisa Todorovic sinisa@eecs.oregonstate.edu

Histogram Equalization

intensity-level histogram (red); cumulative histogram (black)

input output

8

Example: Histogram Equalization

input output output

9

Page 7: ECE 468: Digital Image Processing Lecture 3web.engr.oregonstate.edu/~sinisa/courses/OSU/ECE... · ECE 468: Digital Image Processing Lecture 3 Prof. Sinisa Todorovic sinisa@eecs.oregonstate.edu

Histogram Specification

s = T (r)

s = T (r) =!!!!" s

0

pr(w)ps(w)

dw

!!!!

! ps(s) = pr(r)!

dT (r)dr

"!1

! dT (r)dr

=pr(r)ps(s)

10

Example: Histogram Specification

input image

Histogram of Pixel Intensities

11

Page 8: ECE 468: Digital Image Processing Lecture 3web.engr.oregonstate.edu/~sinisa/courses/OSU/ECE... · ECE 468: Digital Image Processing Lecture 3 Prof. Sinisa Todorovic sinisa@eecs.oregonstate.edu

Example: Histogram Specification

Histogram Equalization

output

12

Example: Histogram Specification

output

specified

histogram

estimated

transform T(r)

output

histogram

13

Page 9: ECE 468: Digital Image Processing Lecture 3web.engr.oregonstate.edu/~sinisa/courses/OSU/ECE... · ECE 468: Digital Image Processing Lecture 3 Prof. Sinisa Todorovic sinisa@eecs.oregonstate.edu

Linear Spatial Filtering of Images

14

Linear Spatial Filtering

g(x, y) =a!

i=!a

b!

j=!b

w(i, j)f(x + i, y + j)

15

Page 10: ECE 468: Digital Image Processing Lecture 3web.engr.oregonstate.edu/~sinisa/courses/OSU/ECE... · ECE 468: Digital Image Processing Lecture 3 Prof. Sinisa Todorovic sinisa@eecs.oregonstate.edu

Linear Spatial Filtering

16

Correlation vs. Convolution

• Correlation:

1. Move the filter mask to a location

2. Compute the sum of products

3. Go to 1.

• Convolution:

1. Rotate the filter mask by 180 degrees

2. Compute the sum of products

3. Go to 2.

w(x, y) ! f(x, y) =a!

i=!a

b!

j=!b

w(i, j)f(x! i, y ! j)

w(x, y)! f(x, y) = a!i=!a

b!j=!b

w(i, j)f(x + i, y + j)

17

Page 11: ECE 468: Digital Image Processing Lecture 3web.engr.oregonstate.edu/~sinisa/courses/OSU/ECE... · ECE 468: Digital Image Processing Lecture 3 Prof. Sinisa Todorovic sinisa@eecs.oregonstate.edu

Example: Correlation vs. Convolution

18

Gaussian Filter

N(x, y) = exp(!x2 + y2

2!2)

w1 = N(!1,!1), w2 = N(!1,0), . . . w9 = N(1,1)3x3 filter:

19

Page 12: ECE 468: Digital Image Processing Lecture 3web.engr.oregonstate.edu/~sinisa/courses/OSU/ECE... · ECE 468: Digital Image Processing Lecture 3 Prof. Sinisa Todorovic sinisa@eecs.oregonstate.edu

Smoothing Filter -- Low Pass Filter

spatial averaging weighted averaging

20

Example: Smoothing Filter

21

Page 13: ECE 468: Digital Image Processing Lecture 3web.engr.oregonstate.edu/~sinisa/courses/OSU/ECE... · ECE 468: Digital Image Processing Lecture 3 Prof. Sinisa Todorovic sinisa@eecs.oregonstate.edu

Application of Smoothing

outputinput thresholded

an image from Hubble space telescope

22

Application of Smoothing

23

Page 14: ECE 468: Digital Image Processing Lecture 3web.engr.oregonstate.edu/~sinisa/courses/OSU/ECE... · ECE 468: Digital Image Processing Lecture 3 Prof. Sinisa Todorovic sinisa@eecs.oregonstate.edu

Sharpening Spatial Filters -- Review

!f(x, y)!x

! f(x + 1, y) ! f(x, y)!f(x, y)

!y! f(x, y + 1) ! f(x, y)

24

Sharpening Spatial Filters -- Review

!f(x, y)!x

! f(x + 1, y) ! f(x, y)!f(x, y)

!y! f(x, y + 1) ! f(x, y)

!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)

24

Page 15: ECE 468: Digital Image Processing Lecture 3web.engr.oregonstate.edu/~sinisa/courses/OSU/ECE... · ECE 468: Digital Image Processing Lecture 3 Prof. Sinisa Todorovic sinisa@eecs.oregonstate.edu

Sharpening Spatial Filters -- Review

!f(x, y)!x

! f(x + 1, y) ! f(x, y)!f(x, y)

!y! f(x, y + 1) ! f(x, y)

!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)

!2f(x, y) = !2f(x, y)!2x

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

Laplacian

24

Sharpening Spatial Filters

Variants of the Laplacian filter

25

Page 16: ECE 468: Digital Image Processing Lecture 3web.engr.oregonstate.edu/~sinisa/courses/OSU/ECE... · ECE 468: Digital Image Processing Lecture 3 Prof. Sinisa Todorovic sinisa@eecs.oregonstate.edu

Image Sharpening

• Blur the original image

• Add the Laplacian

g(x, y) = f(x, y) ± c ! "2f(x, y), c > 0

26

Homework 2

due 01/22

27

Page 17: ECE 468: Digital Image Processing Lecture 3web.engr.oregonstate.edu/~sinisa/courses/OSU/ECE... · ECE 468: Digital Image Processing Lecture 3 Prof. Sinisa Todorovic sinisa@eecs.oregonstate.edu

Next Class

• Review of

• Continuous Fourier Transform

• Discrete Fourier Transform (Textbook: 4.2-4.4)

• 2D Continuous Fourier Transform (Textbook: 4.5)

28