gradients and edges

33
Computer Vision - A Modern Approach Set: Linear Filters Slides by D.A. Forsyth Gradients and edges Points of sharp change in an image are interesting: change in reflectance change in object change in illumination noise Sometimes called edge points General strategy determine image gradient now mark points where gradient magnitude is particularly large wrt neighbours (ideally, curves of such points).

Upload: rhett

Post on 12-Feb-2016

55 views

Category:

Documents


1 download

DESCRIPTION

Points of sharp change in an image are interesting: change in reflectance change in object change in illumination noise Sometimes called edge points. General strategy determine image gradient - PowerPoint PPT Presentation

TRANSCRIPT

Page 1: Gradients and edges

Computer Vision - A Modern ApproachSet: Linear Filters

Slides by D.A. Forsyth

Gradients and edges

• Points of sharp change in an image are interesting:– change in reflectance– change in object– change in illumination– noise

• Sometimes called edge points

• General strategy– determine image gradient

– now mark points where gradient magnitude is particularly large wrt neighbours (ideally, curves of such points).

Page 2: Gradients and edges

Computer Vision - A Modern ApproachSet: Linear Filters

Slides by D.A. Forsyth

There are three major issues: 1) The gradient magnitude at different scales is different; which should we choose? 2) The gradient magnitude is large along thick trail; how do we identify the significant points? 3) How do we link the relevant points up into curves?

Page 3: Gradients and edges

Computer Vision - A Modern ApproachSet: Linear Filters

Slides by D.A. Forsyth

Smoothing and Differentiation

• Issue: noise– smooth before differentiation– two convolutions to smooth, then differentiate?– actually, no - we can use a derivative of Gaussian filter

• because differentiation is convolution, and convolution is associative

Page 4: Gradients and edges

Computer Vision - A Modern ApproachSet: Linear Filters

Slides by D.A. Forsyth

The scale of the smoothing filter affects derivative estimates, and alsothe semantics of the edges recovered.

1 pixel 3 pixels 7 pixels

Page 5: Gradients and edges

Computer Vision - A Modern ApproachSet: Linear Filters

Slides by D.A. Forsyth

The Laplacian of Gaussian

• Another way to detect an extremal first derivative is to look for a zero second derivative

• Appropriate 2D analogy is rotation invariant– the Laplacian

• Bad idea to apply a Laplacian without smoothing– smooth with Gaussian, apply

Laplacian– this is the same as filtering

with a Laplacian of Gaussian filter

• Now mark the zero points where there is a sufficiently large derivative, and enough contrast

Page 6: Gradients and edges

Computer Vision - A Modern ApproachSet: Linear Filters

Slides by D.A. Forsyth

sigma=2

sigma=4

contrast=1 contrast=4LOG zero crossings

Page 7: Gradients and edges

Computer Vision - A Modern ApproachSet: Linear Filters

Slides by D.A. Forsyth

We still have unfortunate behaviourat corners

Page 8: Gradients and edges

Computer Vision - A Modern ApproachSet: Linear Filters

Slides by D.A. Forsyth

We wish to mark points along the curve where the magnitude is biggest.We can do this by looking for a maximum along a slice normal to the curve(non-maximum suppression). These points should form a curve. There arethen two algorithmic issues: at which point is the maximum, and where is thenext one?

Page 9: Gradients and edges

Computer Vision - A Modern ApproachSet: Linear Filters

Slides by D.A. Forsyth

Non-maximumsuppression

At q, we have a maximum if the value is larger than those at both p and at r. Interpolate to get these values.

Page 10: Gradients and edges

Computer Vision - A Modern ApproachSet: Linear Filters

Slides by D.A. Forsyth

Predictingthe nextedge 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).

Page 11: Gradients and edges

Computer Vision - A Modern ApproachSet: Linear Filters

Slides by D.A. Forsyth

Remaining issues

• Check that maximum value of gradient value is sufficiently large– drop-outs? use hysteresis

• use a high threshold to start edge curves and a low threshold to continue them.

Page 12: Gradients and edges

Computer Vision - A Modern ApproachSet: Linear Filters

Slides by D.A. Forsyth

Notice

• Something nasty is happening at corners• Scale affects contrast• Edges aren’t bounding contours

Page 13: Gradients and edges

Computer Vision - A Modern ApproachSet: Linear Filters

Slides by D.A. Forsyth

Page 14: Gradients and edges

Computer Vision - A Modern ApproachSet: Linear Filters

Slides by D.A. Forsyth

fine scalehigh threshold

Page 15: Gradients and edges

Computer Vision - A Modern ApproachSet: Linear Filters

Slides by D.A. Forsyth

coarse scale,high threshold

Page 16: Gradients and edges

Computer Vision - A Modern ApproachSet: Linear Filters

Slides by D.A. Forsyth

coarsescalelowthreshold

Page 17: Gradients and edges

Computer Vision - A Modern ApproachSet: Linear Filters

Slides by D.A. Forsyth

Orientation representations

• The gradient magnitude is affected by illumination changes– but it’s direction isn’t

• We can describe image patches by the swing of the gradient orientation

• Important types:– constant window

• small gradient mags– edge window

• few large gradient mags in one direction

– flow window• many large gradient mags

in one direction– corner window

• large gradient mags that swing

Page 18: Gradients and edges

Computer Vision - A Modern ApproachSet: Linear Filters

Slides by D.A. Forsyth

Representing Windows

• Types– constant

• small eigenvalues– Edge

• one medium, one small– Flow

• one large, one small– corner

• two large eigenvalues

H I I Twindow

Page 19: Gradients and edges

Computer Vision - A Modern ApproachSet: Linear Filters

Slides by D.A. Forsyth

Page 20: Gradients and edges

Computer Vision - A Modern ApproachSet: Linear Filters

Slides by D.A. Forsyth

Page 21: Gradients and edges

Computer Vision - A Modern ApproachSet: Linear Filters

Slides by D.A. Forsyth

Page 22: Gradients and edges

Computer Vision - A Modern ApproachSet: Linear Filters

Slides by D.A. Forsyth

Page 23: Gradients and edges

Computer Vision - A Modern ApproachSet: Linear Filters

Slides by D.A. Forsyth

Harris Corner detector• Le regioni uniformi hanno tutti I gradienti uniformi• I bordi lineari hanno tutti i gradienti allineati• gli angoli sono I punti di congiunzione di due bordi e

quindi avra` I gradienti attorno allineati lungo due direttrici fondamentali

Page 24: Gradients and edges

Computer Vision - A Modern ApproachSet: Linear Filters

Slides by D.A. Forsyth

Harris Corner detector

• Tutti e due gli auovalori di H sono > 0• Rilevatore di angoli Harris: gli angoli sono massimi locali

della funzione R=det(H)-kTr(H)2

2

1

Page 25: Gradients and edges

Computer Vision - A Modern ApproachSet: Linear Filters

Slides by D.A. Forsyth

Page 26: Gradients and edges

Computer Vision - A Modern ApproachSet: Linear Filters

Slides by D.A. Forsyth

Page 27: Gradients and edges

Computer Vision - A Modern ApproachSet: Linear Filters

Slides by D.A. Forsyth

Edge Linking

Page 28: Gradients and edges

Computer Vision - A Modern ApproachSet: Linear Filters

Slides by D.A. Forsyth

Hough Transform

Page 29: Gradients and edges

Computer Vision - A Modern ApproachSet: Linear Filters

Slides by D.A. Forsyth

Page 30: Gradients and edges

Computer Vision - A Modern ApproachSet: Linear Filters

Slides by D.A. Forsyth

Page 31: Gradients and edges

Computer Vision - A Modern ApproachSet: Linear Filters

Slides by D.A. Forsyth

Metodi graph-based

Page 32: Gradients and edges

Computer Vision - A Modern ApproachSet: Linear Filters

Slides by D.A. Forsyth

Page 33: Gradients and edges

Computer Vision - A Modern ApproachSet: Linear Filters

Slides by D.A. Forsyth

Normalized Cut

Ai j

Ai Aj

Ai j

Ai Aj

jiw

jiw

jiw

jiw

AassoAcut

AassoAcutANcut

),(

),(

),(

),(

)()(

)()()(