42
Prof. Sinisa Todorovic [email protected] ECE 468 / CS 519: Digital Image Processing Gradients, Harris Corners 1

ECE 468 / CS 519: Digital Image Processing Gradients ...web.engr.oregonstate.edu/~sinisa/courses/OSU/ECE468/lectures/ECE468_7.pdfHarris Corner Detector homogeneous region ⇓ no change

  • Upload
    others

  • View
    3

  • Download
    0

Embed Size (px)

Citation preview

Page 1: ECE 468 / CS 519: Digital Image Processing Gradients ...web.engr.oregonstate.edu/~sinisa/courses/OSU/ECE468/lectures/ECE468_7.pdfHarris Corner Detector homogeneous region ⇓ no change

Prof. Sinisa Todorovic

[email protected]

ECE 468 / CS 519: Digital Image Processing

Gradients, Harris Corners

1

Page 2: ECE 468 / CS 519: Digital Image Processing Gradients ...web.engr.oregonstate.edu/~sinisa/courses/OSU/ECE468/lectures/ECE468_7.pdfHarris Corner Detector homogeneous region ⇓ no change

Image Gradient along X-axis

I

x

(x, y) = I(x + 1, y)� I(x, y)

=

2

40 0 00 �1 10 0 0

3

5

| {z }D

x

(x,y)

⇤I(x, y)

2

Page 3: ECE 468 / CS 519: Digital Image Processing Gradients ...web.engr.oregonstate.edu/~sinisa/courses/OSU/ECE468/lectures/ECE468_7.pdfHarris Corner Detector homogeneous region ⇓ no change

Image Gradient along Y-axis

=

2

40 0 00 �1 00 1 0

3

5

| {z }Dy(x,y)

⇤I(x, y)

Iy(x, y) = I(x, y + 1)� I(x, y)

3

Page 4: ECE 468 / CS 519: Digital Image Processing Gradients ...web.engr.oregonstate.edu/~sinisa/courses/OSU/ECE468/lectures/ECE468_7.pdfHarris Corner Detector homogeneous region ⇓ no change

Filtering Image Gradient

convolution is associative

w(x, y;�) ⇤ I

x

(x, y) = w(x, y;�) ⇤ D

x

(x, y) ⇤ I(x, y)

= [w(x, y;�) ⇤ D

x

(x, y)] ⇤ I(x, y)

4

Page 5: ECE 468 / CS 519: Digital Image Processing Gradients ...web.engr.oregonstate.edu/~sinisa/courses/OSU/ECE468/lectures/ECE468_7.pdfHarris Corner Detector homogeneous region ⇓ no change

= [Dx

(x, y) ⇤ w(x, y;�)] ⇤ I(x, y)

Filtering Image Gradient

w(x, y;�) ⇤ I

x

(x, y) = w(x, y;�) ⇤ D

x

(x, y) ⇤ I(x, y)

= [w(x, y;�) ⇤ D

x

(x, y)] ⇤ I(x, y)

convolution is commutative

5

Page 6: ECE 468 / CS 519: Digital Image Processing Gradients ...web.engr.oregonstate.edu/~sinisa/courses/OSU/ECE468/lectures/ECE468_7.pdfHarris Corner Detector homogeneous region ⇓ no change

= [Dx

(x, y) ⇤ w(x, y;�)] ⇤ I(x, y)

Filtering Image Gradient

w(x, y;�) ⇤ I

x

(x, y) = w(x, y;�) ⇤ D

x

(x, y) ⇤ I(x, y)

= [w(x, y;�) ⇤ D

x

(x, y)] ⇤ I(x, y)

= w

x

(x, y;�) ⇤ I(x, y)

derivative of the filter6

Page 7: ECE 468 / CS 519: Digital Image Processing Gradients ...web.engr.oregonstate.edu/~sinisa/courses/OSU/ECE468/lectures/ECE468_7.pdfHarris Corner Detector homogeneous region ⇓ no change

Weighted Image Gradient

Image is discrete ⇒ Gradient is approximate

We always find the gradient of the filter !

w(x, y;�) ⇤ I

x

(x, y) = w

x

(x, y;�) ⇤ I(x, y)

w(x, y;�) ⇤ Iy(x, y) = wy(x, y;�) ⇤ I(x, y)

7

Page 8: ECE 468 / CS 519: Digital Image Processing Gradients ...web.engr.oregonstate.edu/~sinisa/courses/OSU/ECE468/lectures/ECE468_7.pdfHarris Corner Detector homogeneous region ⇓ no change

Interest Points

• Harris corners

8

Page 9: ECE 468 / CS 519: Digital Image Processing Gradients ...web.engr.oregonstate.edu/~sinisa/courses/OSU/ECE468/lectures/ECE468_7.pdfHarris Corner Detector homogeneous region ⇓ no change

Properties of Interest Points

• Locality -- robust to occlusion, noise

• Saliency -- rich visual cue

• Stable under affine transforms

• Distinctiveness -- differ across distinct objects

• Efficiency -- easy to compute

9

Page 10: ECE 468 / CS 519: Digital Image Processing Gradients ...web.engr.oregonstate.edu/~sinisa/courses/OSU/ECE468/lectures/ECE468_7.pdfHarris Corner Detector homogeneous region ⇓ no change

Example of Detecting Harris Corners

10

Page 11: ECE 468 / CS 519: Digital Image Processing Gradients ...web.engr.oregonstate.edu/~sinisa/courses/OSU/ECE468/lectures/ECE468_7.pdfHarris Corner Detector homogeneous region ⇓ no change

Harris Corner Detector

homogeneous region⇓

no change in all directions

edge⇓

no change along the edge

corner⇓

change in all directions

Source: Frolova, Simakov, Weizmann Institute

scanning window

11

Page 12: ECE 468 / CS 519: Digital Image Processing Gradients ...web.engr.oregonstate.edu/~sinisa/courses/OSU/ECE468/lectures/ECE468_7.pdfHarris Corner Detector homogeneous region ⇓ no change

Harris Corner Detector

2D convolutionSource: Frolova, Simakov, Weizmann Institute

E(x, y) = w(x, y) ⇤ [I(x + u, y + v)� I(x, y)]2

12

Page 13: ECE 468 / CS 519: Digital Image Processing Gradients ...web.engr.oregonstate.edu/~sinisa/courses/OSU/ECE468/lectures/ECE468_7.pdfHarris Corner Detector homogeneous region ⇓ no change

Harris Corner Detector

change weighting window shifted image original image

Source: Frolova, Simakov, Weizmann Institute

E(x, y) =X

m,n

w(m, n)[I(x + u + m, y + v + n)� I(x + m, y + n)]2

13

Page 14: ECE 468 / CS 519: Digital Image Processing Gradients ...web.engr.oregonstate.edu/~sinisa/courses/OSU/ECE468/lectures/ECE468_7.pdfHarris Corner Detector homogeneous region ⇓ no change

Harris Detector Example

input image

E(x, y)I(x, y)

2D map of changes

14

Page 15: ECE 468 / CS 519: Digital Image Processing Gradients ...web.engr.oregonstate.edu/~sinisa/courses/OSU/ECE468/lectures/ECE468_7.pdfHarris Corner Detector homogeneous region ⇓ no change

Harris Corner Detector

image derivatives along x and y axes

Taylor series expansion

For small shiftsu � 0v � 0

I(x + u, y + v) ⇡ I(x, y) +@I

@x

u +@I

@y

v

I(x + u, y + v) ⇡ I(x, y) + [Ix

I

y

]

u

v

15

Page 16: ECE 468 / CS 519: Digital Image Processing Gradients ...web.engr.oregonstate.edu/~sinisa/courses/OSU/ECE468/lectures/ECE468_7.pdfHarris Corner Detector homogeneous region ⇓ no change

Harris Corner Detector

E(x, y) = w(x, y) ⇤✓

I(x, y) + [Ix

I

y

]

u

v

�� I(x, y)

◆2

= w(x, y) ⇤✓

[Ix

I

y

]

u

v

�◆2

= w(x, y) ⇤✓

[Ix

I

y

]

u

v

�◆T ✓[I

x

I

y

]

u

v

�◆

16

Page 17: ECE 468 / CS 519: Digital Image Processing Gradients ...web.engr.oregonstate.edu/~sinisa/courses/OSU/ECE468/lectures/ECE468_7.pdfHarris Corner Detector homogeneous region ⇓ no change

Harris Corner Detector

E(x, y) = w(x, y) ⇤ [u v]

I

x

I

y

�[I

x

I

y

]

u

v

= [u v]✓

w(x, y) ⇤

I

2x

(x, y) I

x

(x, y)Iy

(x, y)I

x

(x, y)Iy

(x, y) I

2y

(x, y)

�◆

| {z }M(x,y)

u

v

17

Page 18: ECE 468 / CS 519: Digital Image Processing Gradients ...web.engr.oregonstate.edu/~sinisa/courses/OSU/ECE468/lectures/ECE468_7.pdfHarris Corner Detector homogeneous region ⇓ no change

= [Dx

(x, y) ⇤ w(x, y;�)] ⇤ I(x, y)

Filtering Image Gradient

w(x, y;�) ⇤ I

x

(x, y) = w(x, y;�) ⇤ D

x

(x, y) ⇤ I(x, y)

= [w(x, y;�) ⇤ D

x

(x, y)] ⇤ I(x, y)

= w

x

(x, y;�) ⇤ I(x, y)

derivative of the filter18

Page 19: ECE 468 / CS 519: Digital Image Processing Gradients ...web.engr.oregonstate.edu/~sinisa/courses/OSU/ECE468/lectures/ECE468_7.pdfHarris Corner Detector homogeneous region ⇓ no change

Harris Corner Detector

E(x, y) = [u v]M(x, y)

u

v

M(x, y) =

(wx

⇤ I)2 (wx

⇤ I)(wy

⇤ I)(w

x

⇤ I)(wy

⇤ I) (wy

⇤ I)2

(x,y)

19

Page 20: ECE 468 / CS 519: Digital Image Processing Gradients ...web.engr.oregonstate.edu/~sinisa/courses/OSU/ECE468/lectures/ECE468_7.pdfHarris Corner Detector homogeneous region ⇓ no change

Eigenvalues and Eigenvectors of M

• Eigenvectors of M -- directions of the largest change of E(x,y)

• Eigenvalues of M -- the amount of change along eigenvectors

��1

��2

E(x, y) = [u v]M(x, y)

u

v

20

Page 21: ECE 468 / CS 519: Digital Image Processing Gradients ...web.engr.oregonstate.edu/~sinisa/courses/OSU/ECE468/lectures/ECE468_7.pdfHarris Corner Detector homogeneous region ⇓ no change

Detection of Harris Corners using the Eigenvalues of M

�2

�1

21

Page 22: ECE 468 / CS 519: Digital Image Processing Gradients ...web.engr.oregonstate.edu/~sinisa/courses/OSU/ECE468/lectures/ECE468_7.pdfHarris Corner Detector homogeneous region ⇓ no change

Harris Detector

f(�) =�1(�)�2(�)

�1(�) + �2(�)=

det(M(�))trace(M(�))

objective function

22

Page 23: ECE 468 / CS 519: Digital Image Processing Gradients ...web.engr.oregonstate.edu/~sinisa/courses/OSU/ECE468/lectures/ECE468_7.pdfHarris Corner Detector homogeneous region ⇓ no change

Harris Detector Example

input image

23

Page 24: ECE 468 / CS 519: Digital Image Processing Gradients ...web.engr.oregonstate.edu/~sinisa/courses/OSU/ECE468/lectures/ECE468_7.pdfHarris Corner Detector homogeneous region ⇓ no change

Harris Detector Example

f values color codedred = high valuesblue = low values

24

Page 25: ECE 468 / CS 519: Digital Image Processing Gradients ...web.engr.oregonstate.edu/~sinisa/courses/OSU/ECE468/lectures/ECE468_7.pdfHarris Corner Detector homogeneous region ⇓ no change

Harris Detector Example

f values thresholded

25

Page 26: ECE 468 / CS 519: Digital Image Processing Gradients ...web.engr.oregonstate.edu/~sinisa/courses/OSU/ECE468/lectures/ECE468_7.pdfHarris Corner Detector homogeneous region ⇓ no change

Harris Detector Example

Harris features = Spatial maxima of f values

26

Page 27: ECE 468 / CS 519: Digital Image Processing Gradients ...web.engr.oregonstate.edu/~sinisa/courses/OSU/ECE468/lectures/ECE468_7.pdfHarris Corner Detector homogeneous region ⇓ no change

Example of Detecting Harris Corners

27

Page 28: ECE 468 / CS 519: Digital Image Processing Gradients ...web.engr.oregonstate.edu/~sinisa/courses/OSU/ECE468/lectures/ECE468_7.pdfHarris Corner Detector homogeneous region ⇓ no change

Properties of Harris Corners

• Invariance to variations of imaging parameters:

• Illumination?

• Camera distance, i.e., scale ?

• Camera viewpoint, i.e., affine transformation?

28

Page 29: ECE 468 / CS 519: Digital Image Processing Gradients ...web.engr.oregonstate.edu/~sinisa/courses/OSU/ECE468/lectures/ECE468_7.pdfHarris Corner Detector homogeneous region ⇓ no change

Harris/Hessian Detector is NOT Scale Invariant

Source: L. Fei-Fei

“edge”

“edge”“edge”

“corner”

29

Page 30: ECE 468 / CS 519: Digital Image Processing Gradients ...web.engr.oregonstate.edu/~sinisa/courses/OSU/ECE468/lectures/ECE468_7.pdfHarris Corner Detector homogeneous region ⇓ no change

Automatic scale selectionAutomatic scale selection

)),((1

σxIfmii�

Function responses for increasing scale Scale trace (signature)

Source: Tuytelaars

30

Page 31: ECE 468 / CS 519: Digital Image Processing Gradients ...web.engr.oregonstate.edu/~sinisa/courses/OSU/ECE468/lectures/ECE468_7.pdfHarris Corner Detector homogeneous region ⇓ no change

Automatic scale selectionAutomatic scale selection

)),((1

σxIfmii�

Function responses for increasing scale Scale trace (signature)

Source: Tuytelaars

31

Page 32: ECE 468 / CS 519: Digital Image Processing Gradients ...web.engr.oregonstate.edu/~sinisa/courses/OSU/ECE468/lectures/ECE468_7.pdfHarris Corner Detector homogeneous region ⇓ no change

Automatic scale selectionAutomatic scale selection

)),((1

σxIfmii�

Function responses for increasing scale Scale trace (signature)

Source: Tuytelaars

32

Page 33: ECE 468 / CS 519: Digital Image Processing Gradients ...web.engr.oregonstate.edu/~sinisa/courses/OSU/ECE468/lectures/ECE468_7.pdfHarris Corner Detector homogeneous region ⇓ no change

Automatic scale selectionAutomatic scale selection

)),((1

σxIfmii�

Function responses for increasing scale Scale trace (signature)

Source: Tuytelaars

33

Page 34: ECE 468 / CS 519: Digital Image Processing Gradients ...web.engr.oregonstate.edu/~sinisa/courses/OSU/ECE468/lectures/ECE468_7.pdfHarris Corner Detector homogeneous region ⇓ no change

Automatic scale selectionAutomatic scale selection

)),((1

σxIfmii�

Function responses for increasing scale Scale trace (signature)

Source: Tuytelaars

34

Page 35: ECE 468 / CS 519: Digital Image Processing Gradients ...web.engr.oregonstate.edu/~sinisa/courses/OSU/ECE468/lectures/ECE468_7.pdfHarris Corner Detector homogeneous region ⇓ no change

Automatic scale selectionAutomatic scale selection

)),((1

σxIfmii�

Function responses for increasing scale Scale trace (signature)

Source: Tuytelaars

35

Page 36: ECE 468 / CS 519: Digital Image Processing Gradients ...web.engr.oregonstate.edu/~sinisa/courses/OSU/ECE468/lectures/ECE468_7.pdfHarris Corner Detector homogeneous region ⇓ no change

Automatic scale selectionAutomatic scale selection

)),((1

σxIfmii�

Function responses for increasing scale Scale trace (signature)

)),((1

σxIfmii "

Source: Tuytelaars

36

Page 37: ECE 468 / CS 519: Digital Image Processing Gradients ...web.engr.oregonstate.edu/~sinisa/courses/OSU/ECE468/lectures/ECE468_7.pdfHarris Corner Detector homogeneous region ⇓ no change

Automatic scale selectionAutomatic scale selection

)),((1

σxIfmii�

Function responses for increasing scale Scale trace (signature)

)),((1

σxIfmii "

Source: Tuytelaars

37

Page 38: ECE 468 / CS 519: Digital Image Processing Gradients ...web.engr.oregonstate.edu/~sinisa/courses/OSU/ECE468/lectures/ECE468_7.pdfHarris Corner Detector homogeneous region ⇓ no change

Automatic scale selectionAutomatic scale selection

)),((1

σxIfmii�

Function responses for increasing scale Scale trace (signature)

)),((1

σxIfmii "

Source: Tuytelaars

38

Page 39: ECE 468 / CS 519: Digital Image Processing Gradients ...web.engr.oregonstate.edu/~sinisa/courses/OSU/ECE468/lectures/ECE468_7.pdfHarris Corner Detector homogeneous region ⇓ no change

Automatic scale selectionAutomatic scale selection

)),((1

σxIfmii�

Function responses for increasing scale Scale trace (signature)

)),((1

σxIfmii "

Source: Tuytelaars

39

Page 40: ECE 468 / CS 519: Digital Image Processing Gradients ...web.engr.oregonstate.edu/~sinisa/courses/OSU/ECE468/lectures/ECE468_7.pdfHarris Corner Detector homogeneous region ⇓ no change

Automatic scale selectionAutomatic scale selection

)),((1

σxIfmii�

Function responses for increasing scale Scale trace (signature)

)),((1

σxIfmii "

Source: Tuytelaars

40

Page 41: ECE 468 / CS 519: Digital Image Processing Gradients ...web.engr.oregonstate.edu/~sinisa/courses/OSU/ECE468/lectures/ECE468_7.pdfHarris Corner Detector homogeneous region ⇓ no change

Automatic scale selectionAutomatic scale selection

)),((1

σxIfmii�

Function responses for increasing scale Scale trace (signature)

)),((1

σxIfmii "

Source: Tuytelaars

41

Page 42: ECE 468 / CS 519: Digital Image Processing Gradients ...web.engr.oregonstate.edu/~sinisa/courses/OSU/ECE468/lectures/ECE468_7.pdfHarris Corner Detector homogeneous region ⇓ no change

Automatic scale selectionAutomatic scale selection

)),((1

σxIfmii�

Function responses for increasing scale Scale trace (signature)

)),((1

σ ""xIfmii� Source: Tuytelaars

42