Lecture 5: Edges, Corners, Sampling, Pyramids Thursday, Sept 13 - - PDF document

lecture 5 edges corners sampling pyramids
SMART_READER_LITE
LIVE PREVIEW

Lecture 5: Edges, Corners, Sampling, Pyramids Thursday, Sept 13 - - PDF document

Lecture 5: Edges, Corners, Sampling, Pyramids Thursday, Sept 13 Normalized cross correlation Best match Template Normalized correlation: normalize for image region brightness Windowed correlation search: inexpensive way to find a


slide-1
SLIDE 1

Lecture 5: Edges, Corners, Sampling, Pyramids

Thursday, Sept 13

slide-2
SLIDE 2
slide-3
SLIDE 3

Normalized cross correlation

  • Normalized correlation: normalize for image

region brightness

  • Windowed correlation search: inexpensive way

to find a fixed scale pattern

  • (Convolution = correlation if filter is symmetric)

Best match Template

slide-4
SLIDE 4

Filters and scenes

slide-5
SLIDE 5

Filters and scenes

  • Scenes have holistic qualities
  • Can represent scene categories with

global texture

  • Use Steerable filters, windowed for some

limited spatial information

  • Model likelihood of filter responses given

scene category as mixture of Gaussians, (and incorporate some temporal info…)

[Torralba, Murphy, Freeman, and Rubin, ICCV 2003] [Torralba & Oliva, 2003]

slide-6
SLIDE 6

Steerable filters

  • Convolution linear -- synthesize a filter of

arbitrary orientation as a linear combination of “basis filters”

  • Interpolated filter responses more efficient

than explicit filter at arbitrary orientation

[Freeman & Adelson, The Design and Use of Steerable Filters, PAMI 1991]

slide-7
SLIDE 7

Steerable filters

= = Freeman & Adelson, 1991 Basis filters for derivative of Gaussian

slide-8
SLIDE 8

[Torralba, Murphy, Freeman, and Rubin, ICCV 2003]

Probability of the scene given global features

slide-9
SLIDE 9

[Torralba, Murphy, Freeman, and Rubin, ICCV 2003]

slide-10
SLIDE 10

Contextual priors

  • Use scene recognition predict objects present
  • For object(s) likely to be present, predict locations

based on similarity to previous images with the same place and that object

slide-11
SLIDE 11

[Torralba, Murphy, Freeman, and Rubin, ICCV 2003]

Scene category Specific place (black=right, red=wrong)

slide-12
SLIDE 12

Blue solid circle: recognition with temporal info Black hollow circle: instantaneous recognition using global feature only Cross: true location

slide-13
SLIDE 13

Image gradient

The gradient of an image: The gradient points in the direction of most rapid change in intensity The gradient direction (orientation of edge normal) is given by: The edge strength is given by the gradient magnitude

Slide credit S. Seitz

slide-14
SLIDE 14

Effects of noise

Consider a single row or column of the image

  • Plotting intensity as a function of position gives a signal

Where is the edge?

Slide credit S. Seitz

slide-15
SLIDE 15

Where is the edge?

Solution: smooth first

Look for peaks in

slide-16
SLIDE 16

Derivative theorem of convolution

This saves us one operation:

Slide credit S. Seitz

slide-17
SLIDE 17

Laplacian of Gaussian

Consider

Laplacian of Gaussian

  • perator

Where is the edge? Zero-crossings of bottom graph

slide-18
SLIDE 18

2D edge detection filters

  • is the Laplacian operator:

Laplacian of Gaussian Gaussian derivative of Gaussian

Slide credit S. Seitz

slide-19
SLIDE 19

The Canny edge detector

  • riginal image (Lena)
slide-20
SLIDE 20

The Canny edge detector

norm of the gradient

slide-21
SLIDE 21

The Canny edge detector

thresholding

slide-22
SLIDE 22

Non-maximum suppression

Check if pixel is local maximum along gradient direction, select single max across width of the edge

  • requires checking interpolated pixels p and r

Slide credit S. Seitz

slide-23
SLIDE 23

The Canny edge detector

thinning (non-maximum suppression)

slide-24
SLIDE 24

Predicting the next edge point

Assume the marked point is an edge point. Then we construct the tangent to the edge curve (which is normal to the gradient at that point) and use this to predict the next points (here either r or s).

(Forsyth & Ponce)

slide-25
SLIDE 25

Hysteresis Thresholding

Reduces the probability of false contours and fragmented edges Given result of non-maximum suppression: For all edge points that remain,

  • locate next unvisited pixel where

intensity > thigh

  • start from that point, follow chains

along edge and add points where intensity < tlow

slide-26
SLIDE 26

Edge detection by subtraction

  • riginal
slide-27
SLIDE 27

Edge detection by subtraction

smoothed (5x5 Gaussian)

slide-28
SLIDE 28

Edge detection by subtraction

smoothed – original

(scaled by 4, offset +128)

Why does this work?

slide-29
SLIDE 29

Gaussian - image filter

Laplacian of Gaussian Gaussian delta function

slide-30
SLIDE 30

Causes of edges

Adapted from C. Rasmussen

If the goal is image understanding, what do we want from an edge detector?

slide-31
SLIDE 31

Learning good boundaries

  • Use ground truth (human-labeled)

boundaries in natural images to learn good features

  • Supervised learning to optimize cue

integration, filter scales, select feature types

Work by D. Martin and C. Fowlkes and D. Tal and J. Malik, Berkeley Segmentation Benchmark, 2001

slide-32
SLIDE 32

[D. Martin et al. PAMI 2004]

Human- marked segment boundaries

slide-33
SLIDE 33

Feature profiles (oriented energy, brightness, color, and texture gradients) along the patch’s horizontal diameter

[D. Martin et al. PAMI 2004]

What features are responsible for perceived edges?

slide-34
SLIDE 34

What features are responsible for perceived edges?

slide-35
SLIDE 35

Learning good boundaries

[D. Martin et al. PAMI 2004]

slide-36
SLIDE 36

Original Boundary detection Human-labeled

Berkeley Segmentation Database, D. Martin and C. Fowlkes and D. Tal and J. Malik

slide-37
SLIDE 37

[D. Martin et al. PAMI 2004]

slide-38
SLIDE 38

Edge detection and corners

  • Partial derivative estimates in x and y fail to

capture corners Why do we care about corners?

slide-39
SLIDE 39

Case study: panorama stitching

[Brown, Szeliski, and Winder, CVPR 2005]

slide-40
SLIDE 40

How do we build panorama?

  • We need to match (align) images

[Slide credit: Darya Frolova and Denis Simakov]

slide-41
SLIDE 41

Matching with Features

  • Detect feature points in both images
slide-42
SLIDE 42

Matching with Features

  • Detect feature points in both images
  • Find corresponding pairs
slide-43
SLIDE 43

Matching with Features

  • Detect feature points in both images
  • Find corresponding pairs
  • Use these pairs to align images
slide-44
SLIDE 44

Matching with Features

  • Problem 1:

– Detect the same point independently in both images

no chance to match!

We need a repeatable detector

slide-45
SLIDE 45

Matching with Features

  • (Problem 2:

– For each point correctly recognize the corresponding one)

?

We need a reliable and distinctive descriptor

More on this aspect later!

slide-46
SLIDE 46

Corner detection as an interest operator

  • We should easily recognize the point by

looking through a small window

  • Shifting a window in any direction should

give a large change in intensity

slide-47
SLIDE 47

“flat” region: no change in all directions “edge”: no change along the edge direction “corner”: significant change in all directions

C.Harris, M.Stephens. “A Combined Corner and Edge Detector”. 1988

Corner detection as an interest operator

slide-48
SLIDE 48

Corner Detection

2 2 ,

( , )

x x y x y x y y

I I I M w x y I I I ⎡ ⎤ = ⎢ ⎥ ⎢ ⎥ ⎣ ⎦

M is a 2×2 matrix computed from image derivatives:

Sum over image region – area we are checking for corner Gradient with respect to x, times gradient with respect to y

slide-49
SLIDE 49

Corner Detection

Eigenvectors of M: encode edge directions Eigenvalues of M: encode edge strength λ1, λ2 – eigenvalues of M

direction of the slowest change direction of the fastest change

λmax λmin

slide-50
SLIDE 50

Corner Detection

λ1 λ2 “Corner” λ1 and λ2 are large, λ1 ~ λ2; E increases in all

directions

λ1 and λ2 are small; E is almost constant

in all directions

“Edge” λ1 >> λ2 “Edge” λ2 >> λ1 “Flat” region Classification of image points using eigenvalues of M:

slide-51
SLIDE 51

Harris Corner Detector

Measure of corner response:

( )

2

det trace R M k M = −

1 2 1 2

det trace M M λ λ λ λ = = +

(k – empirical constant, k = 0.04-0.06)

Avoid computing eigenvalues themselves.

slide-52
SLIDE 52

Harris Corner Detector

λ1 λ2 “Corner” “Edge” “Edge” “Flat”

  • R depends only on

eigenvalues of M

  • R is large for a corner
  • R is negative with large

magnitude for an edge

  • |R| is small for a flat

region R > 0 R < 0 R < 0 |R| small

slide-53
SLIDE 53

Harris Corner Detector

  • The Algorithm:

– Find points with large corner response function R (R > threshold) – Take the points of local maxima of R

slide-54
SLIDE 54

Harris Detector: Workflow

slide-55
SLIDE 55

Harris Detector: Workflow

Compute corner response R

slide-56
SLIDE 56

Harris Detector: Workflow

Find points with large corner response: R>threshold

slide-57
SLIDE 57

Harris Detector: Workflow

Take only the points of local maxima of R

slide-58
SLIDE 58

Harris Detector: Workflow

slide-59
SLIDE 59

Harris Detector: Some Properties

  • Rotation invariance

Ellipse rotates but its shape (i.e. eigenvalues) remains the same Corner response R is invariant to image rotation

slide-60
SLIDE 60

Harris Detector: Some Properties

  • Not invariant to image scale!

All points will be classified as edges

Corner !

More on interest operators/descriptors with invariance properties later.

slide-61
SLIDE 61
slide-62
SLIDE 62

This image is too big to fit on the screen. How can we reduce it? How to generate a half- sized version?

slide-63
SLIDE 63

Image sub-sampling

Throw away every other row and column to create a 1/2 size image

  • called image sub-sampling

1/4 1/8

Slide credit: S. Seitz

slide-64
SLIDE 64

Image sub-sampling

1/4 (2x zoom) 1/8 (4x zoom) 1/2

slide-65
SLIDE 65

Sampling

  • Continuous function discrete set of

values

slide-66
SLIDE 66

Undersampling

  • Information lost

Figure credit: S. Marschner

slide-67
SLIDE 67

Undersampling

  • Looks just like lower frequency signal!
slide-68
SLIDE 68

Undersampling

  • Looks like higher frequency signal!

Aliasing: higher frequency information can appear as lower frequency information

slide-69
SLIDE 69

Undersampling

Good sampling Bad sampling

slide-70
SLIDE 70

Aliasing

slide-71
SLIDE 71

Aliasing

Input signal:

x = 0:.05:5; imagesc(sin((2.^x).*x))

Matlab output: Not enough samples

slide-72
SLIDE 72

Aliasing in video

Slide credit: S. Seitz

slide-73
SLIDE 73

Image sub-sampling

1/4 (2x zoom) 1/8 (4x zoom) 1/2

slide-74
SLIDE 74

How to prevent aliasing?

  • Sample more …
  • Smooth – suppress high frequencies

before sampling

slide-75
SLIDE 75

Gaussian pre-filtering

G 1/4 G 1/8 Gaussian 1/2 Solution: smooth the image, then subsample

slide-76
SLIDE 76

Subsampling with Gaussian pre-filtering

G 1/4 G 1/8 Gaussian 1/2 Solution: smooth the image, then subsample

slide-77
SLIDE 77

Compare with...

1/4 (2x zoom) 1/8 (4x zoom) 1/2

slide-78
SLIDE 78

Image pyramids

  • Big bars (resp. spots, hands, etc.) and little

bars are both interesting

  • Inefficient to detect big bars with big filters
  • Alternative:

– Apply filters of fixed size to images of different sizes

slide-79
SLIDE 79

Image pyramids

  • Known as a Gaussian Pyramid [Burt and Adelson, 1983]
slide-80
SLIDE 80

Gaussian image pyramids

slide-81
SLIDE 81

Forsyth & Ponce

slide-82
SLIDE 82

Image pyramids

  • Useful for

–Coarse to fine matching, iterative computation; e.g. optical flow –Feature association across scales to find reliable features –Searching over scale

slide-83
SLIDE 83

Image pyramids: multi-scale search

[Adelson et al., 1984]

slide-84
SLIDE 84

Image pyramids: multi-scale search

Learning algorithm

Figure from Rowley et al. 1998