Administrivia Homework 2 due Tue., Feb. 23 before class Linearity - - PowerPoint PPT Presentation

administrivia
SMART_READER_LITE
LIVE PREVIEW

Administrivia Homework 2 due Tue., Feb. 23 before class Linearity - - PowerPoint PPT Presentation

Administrivia Homework 2 due Tue., Feb. 23 before class Linearity of light Color constancy CMPSCI 370: Intro to Computer Vision Hybrid images Image processing: #3 linear filtering continued Todays lecture


slide-1
SLIDE 1

CMPSCI 370: Intro to Computer Vision

Image processing: #3 linear filtering continued …

University of Massachusetts, Amherst February 18, 2016 Instructor: Subhransu Maji 1

  • Homework 2 due Tue., Feb. 23 before class
  • Linearity of light
  • Color constancy
  • Hybrid images
  • Today’s lecture
  • Review of last lecture
  • Edge detection

Administrivia

2

2

Joys of computer vision research

3

http://xkcd.com/1425/

3

  • How can we reduce noise in a photograph?

Motivation: Image de-noising

4

4

slide-2
SLIDE 2
  • Let’s replace each pixel with a weighted average of its

neighborhood

  • The weights are called the filter kernel
  • What are the weights for the average of a 3x3

neighborhood?

Moving average

5

1 1 1 1 1 1 1 1 1 “box filter”

Source: D. Lowe

5

  • Let f be the image and g be the kernel. The output of

convolving f with g is denoted f * g.

− − = ∗

l k

l k g l n k m f n m g f

,

] , [ ] , [ ] , )[ (

Convolution

6 Source: F. Durand

  • MATLAB functions: conv2, filter2, imfilter

Convention: 
 kernel is “flipped” for convolution

f

6

Gaussian vs. box filtering

7

7

Gaussian smoothing fails to get rid of salt-and-pepper noise

Reducing salt-and-pepper noise

8

3x3 5x5 7x7

8

slide-3
SLIDE 3
  • A median filter operates over a window by selecting the

median intensity in the window

Alternative idea: Median filtering

9

The median filtering is not linear

Source: K. Grauman

9

  • What advantage does median filtering have over Gaussian

filtering?

  • Answer: Robustness to outliers

Median filter

10 Source: K. Grauman

10

MATLAB: medfilt2(image, [h w])

Salt-and-pepper noise Median filtered

Source: M. Hebert

Median filter

11

11

Gaussian vs. median filtering

12

3x3 5x5 7x7 Gaussian Median

12

slide-4
SLIDE 4

What does blurring take away?

Sharpening revisited

13

  • riginal

smoothed (5x5)

detail

=

sharpened

=

Let’s add it back:

  • riginal

detail

+ α

13

Sharpening filter

14

Gaussian unit impulse Laplacian of Gaussian

I = blurry(I) + sharp(I) sharp(I) = I − blurry(I) = I ∗ e − I ∗ gσ = I ∗ (e − gσ)

14

  • A. Oliva, A. Torralba, P.G. Schyns, 


“Hybrid Images,” SIGGRAPH 2006

Application: Hybrid Images

15

Gaussian Filter Laplacian Filter

15 16

slide-5
SLIDE 5

17

motorcycle and bicycle

17

18

dolphin and car

18

Homework 2, part 3

19

19

Next: edge detection

20 Winter in Kraków photographed by Marcin Ryczek

But first, any questions?

20

slide-6
SLIDE 6
  • Goal: Identify sudden changes

(discontinuities) in an image

  • Intuitively, most semantic and shape

information from the image can be encoded in the edges

  • More compact than pixels

  • Ideal: artist’s line drawing (but

artist is also using object-level knowledge)

Edge detection

21

Source: D. Lowe

Attneave's Cat (1954)

21

Edges are caused by a variety of factors:

Origin of edges

22

depth discontinuity surface color discontinuity illumination discontinuity surface normal discontinuity

Source: Steve Seitz

22

  • An edge is a place of rapid change in the image intensity

function

Edge detection

23

image intensity function
 (along horizontal scanline) first derivative edges correspond to
 extrema of derivative

23

One dimensional derivatives

24

y = f(x) m = ∆y ∆x m = f(x + h) − f(x) (x + h) − x = f(x + h) − f(x) h Gradient

https://en.wikipedia.org/wiki/Derivative

24

slide-7
SLIDE 7

For 2D function f(x), one can compute a derivative for each direction v Directional derivatives of the function along the axes are called partial derivatives. For example the partial derivative with respect to x is:

Two dimensional derivatives

25

ε ε

ε

) , ( ) , ( lim ) , ( y x f y x f x y x f − + = ∂ ∂

Source: K. Grauman

25

For 2D function f(x,y), the partial derivative is: For discrete data, we can approximate using finite differences: To implement the above as convolution, what would be 
 the associated filter?

Partial derivatives with convolutions

26

ε ε

ε

) , ( ) , ( lim ) , ( y x f y x f x y x f − + = ∂ ∂

1 ) , ( ) , 1 ( ) , ( y x f y x f x y x f − + ≈ ∂ ∂

Source: K. Grauman

26

Partial derivatives of an image

27

Which one shows changes with respect to x?

  • 1

1 1

  • 1
  • r
  • 1 1

x y x f ∂ ∂ ) , ( y y x f ∂ ∂ ) , (

27

Other approximations of derivative filters exist:

Finite difference filters

28 Source: K. Grauman

28

slide-8
SLIDE 8

The gradient points in the direction of most rapid increase in intensity
 
 
 The gradient of an image:

Image gradient

29

The gradient direction is given by

Source: Steve Seitz

The edge strength is given by the gradient magnitude

  • How does this direction relate to the direction of the edge?

29

Edge detection example

30

https://en.wikipedia.org/wiki/Prewitt_operator

edge magnitude image

30

Edge detection in Matlab

31

31

Consider a single row or column of the image

Effects of noise

32

Where is the edge?

Source: S. Seitz

32

slide-9
SLIDE 9

Solution: smooth first

33

  • To find edges, look for peaks in

) ( g f dx d ∗ f g f * g

) ( g f dx d ∗

Source: S. Seitz

33

Smoothed derivative removes noise, but blurs edge. Also finds edges at different “scales”

1 pixel 3 pixels 7 pixels

34 Source: D. Forsyth

Scale of smoothing

34

Smoothing filters

  • Gaussian: remove “high-frequency” components; 


“low-pass” filter

  • Can the values of a smoothing filter be negative?
  • What should the values sum to?
  • One: constant regions are not affected by the filter

Derivative filters

  • Prewitt filter
  • Can the values of a derivative filter be negative?
  • What should the values sum to?
  • Zero: no response in constant regions
  • High absolute value at points of high contrast

Smoothing vs derivative filters

35

35