1 Image Features Hao Jiang Sept. 2014. Image Matching 2.

51
1 Image Features Hao Jiang Sept. 2014

Transcript of 1 Image Features Hao Jiang Sept. 2014. Image Matching 2.

Page 1: 1 Image Features Hao Jiang Sept. 2014. Image Matching 2.

1

Image Features

Hao Jiang

Sept. 2014

Page 2: 1 Image Features Hao Jiang Sept. 2014. Image Matching 2.

Image Matching

2

Page 3: 1 Image Features Hao Jiang Sept. 2014. Image Matching 2.

Image Mosaicing

3

Page 4: 1 Image Features Hao Jiang Sept. 2014. Image Matching 2.

How can This be Done Automatically?

4

Page 5: 1 Image Features Hao Jiang Sept. 2014. Image Matching 2.

5

Easy to match Hard to match

Page 6: 1 Image Features Hao Jiang Sept. 2014. Image Matching 2.

Image Local Structures

6

Step Ridge

Peak

Valley

Corner Junction

Page 7: 1 Image Features Hao Jiang Sept. 2014. Image Matching 2.

Image Local Structures

7

Step Ridge

Peak

Valley

Corner Junction

Line Structures:“Edge”

Point Structures:“Corners”

Page 8: 1 Image Features Hao Jiang Sept. 2014. Image Matching 2.

Regions

8

Page 9: 1 Image Features Hao Jiang Sept. 2014. Image Matching 2.

An Example

9

edgeRegion

corners

Page 10: 1 Image Features Hao Jiang Sept. 2014. Image Matching 2.

Edge Detection in Matlab

10

>> im = imread('flower.jpg');>> im = im2double(im);>> im = rgb2gray(im);>> ed = edge(im, 'canny', 0.15);

Page 11: 1 Image Features Hao Jiang Sept. 2014. Image Matching 2.

How to Find an Edge?

11

A 1D edge

Page 12: 1 Image Features Hao Jiang Sept. 2014. Image Matching 2.

12

f(x)

f’(x)

f’’(x)

Page 13: 1 Image Features Hao Jiang Sept. 2014. Image Matching 2.

Extend to 2D

13

ab

There is a direction in whichimage f(x,y) increases thefastest. The direction is calledthe gradient direction.

Gradient [df/dx df/dy]Magnitude: sqrt(fx^2 + fy^2)Direction: atan2(fy, fx)

Page 14: 1 Image Features Hao Jiang Sept. 2014. Image Matching 2.

Finite Difference

Approximating derivatives using finite difference.

Finite difference and convolution

14

Page 15: 1 Image Features Hao Jiang Sept. 2014. Image Matching 2.

Noise Reduction

15

0.01 noise

0.03 noise

Page 16: 1 Image Features Hao Jiang Sept. 2014. Image Matching 2.

Noise Reduction

16

Page 17: 1 Image Features Hao Jiang Sept. 2014. Image Matching 2.

Gaussian Filtering in Edge Detection

17

Page 18: 1 Image Features Hao Jiang Sept. 2014. Image Matching 2.

Gaussian Filtering in Edge Detection

18

h * (g * f) = (h * g) * f

Difference Kernel Gaussian Kernel

image

DifferenceGaussian Kernel

18

[1,-1]

Page 19: 1 Image Features Hao Jiang Sept. 2014. Image Matching 2.

Edge Detection in Images

Gaussian smoothed filtering in x and y directions: Ix, Iy Non-maximum suppression for |Ix|+|Iy|

Edge Tracing – double thresholding.

19

Page 20: 1 Image Features Hao Jiang Sept. 2014. Image Matching 2.

Edge Detection Using Matlab

Canny edge detector:

edge(image, ‘canny’, threshold) Sobel edge detector:

edge(image, ‘sobel’, threshold) Prewitt edge detector:

edge(image, ‘prewitt’, threshold)

20

Page 21: 1 Image Features Hao Jiang Sept. 2014. Image Matching 2.

21D. Martin, C. Fowlkes, D. Tal, J. Malik. "A Database of Human Segmented Natural Images and its Application to Evaluating Segmentation Algorithms and Measuring Ecological Statistics”, ICCV, 2001

Berkeley Segmentation DataSet [BSDS]

Page 22: 1 Image Features Hao Jiang Sept. 2014. Image Matching 2.

Corner Detection

Corner is a point feature that has large changing rate in all directions.

22

Step LineCorner

Flat region

Page 23: 1 Image Features Hao Jiang Sept. 2014. Image Matching 2.

Harris corner detector

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

Page 24: 1 Image Features Hao Jiang Sept. 2014. Image Matching 2.

The Basic Idea

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

Page 25: 1 Image Features Hao Jiang Sept. 2014. Image Matching 2.

Harris Detector: Basic Idea

“flat” region:no change in all directions

“edge”:no change along the edge direction

“corner”:significant change in all directions

Page 26: 1 Image Features Hao Jiang Sept. 2014. Image Matching 2.

Find a Corner

26

Compute matrix H =

in each window. If the ratio (Ix2 * Iy2 – Ixy ^2 )R =------------------------ > T (Ix2 + Iy2 + eps)We have a corner

Ix2 IxyIxy Iy2=

Page 27: 1 Image Features Hao Jiang Sept. 2014. Image Matching 2.

Harris Detector: Workflow

Page 28: 1 Image Features Hao Jiang Sept. 2014. Image Matching 2.

Harris Detector: Workflow

Compute corner response R

Page 29: 1 Image Features Hao Jiang Sept. 2014. Image Matching 2.

Harris Detector: Workflow

Find points with large corner response: R>threshold

Page 30: 1 Image Features Hao Jiang Sept. 2014. Image Matching 2.

Harris Detector: Workflow

Take only the points of local maxima of R

Page 31: 1 Image Features Hao Jiang Sept. 2014. Image Matching 2.

Harris Detector: Workflow

Page 32: 1 Image Features Hao Jiang Sept. 2014. Image Matching 2.

Corner Detection Programming

32

Page 33: 1 Image Features Hao Jiang Sept. 2014. Image Matching 2.

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

Page 34: 1 Image Features Hao Jiang Sept. 2014. Image Matching 2.

Harris Detector: Some Properties Partial invariance to affine intensity change

Only derivatives are used => invariance to intensity shift I I + b

Intensity scale: I a I

R

x (image coordinate)

threshold

R

x (image coordinate)

Page 35: 1 Image Features Hao Jiang Sept. 2014. Image Matching 2.

Harris Detector: Some Properties

But: non-invariant to image scale!

All points will be classified as edges

Corner !

Page 36: 1 Image Features Hao Jiang Sept. 2014. Image Matching 2.

Scale Invariant Detection

Consider regions (e.g. circles) of different sizes around a point Regions of corresponding sizes will look the same in both

images

Page 37: 1 Image Features Hao Jiang Sept. 2014. Image Matching 2.

Scale Invariant Detection

The problem: how do we choose corresponding circles independently in each image?

Choose the scale of the “best” corner

Page 38: 1 Image Features Hao Jiang Sept. 2014. Image Matching 2.

Descriptors Invariant to Rotation

Find local orientation

Dominant direction of gradient

• Extract image patches relative to this orientation

Page 39: 1 Image Features Hao Jiang Sept. 2014. Image Matching 2.

Descriptor Vector

Orientation = blurred gradient Rotation Invariant Frame

Scale-space position (x, y, s) + orientation ()

Page 40: 1 Image Features Hao Jiang Sept. 2014. Image Matching 2.

Scale and Rotation Invariant Feature

SIFT (D. Lowe, UBC)

40

Page 41: 1 Image Features Hao Jiang Sept. 2014. Image Matching 2.

Stable Feature

41

Page 42: 1 Image Features Hao Jiang Sept. 2014. Image Matching 2.

Stable Feature

42

Local max/min point’s valuesare stable when the scale changes

Page 43: 1 Image Features Hao Jiang Sept. 2014. Image Matching 2.

SIFT

43

Filteringthe imageusing filters at differentscales.(for example using Gaussian filter)

Page 44: 1 Image Features Hao Jiang Sept. 2014. Image Matching 2.

Difference of Gaussian

44

Page 45: 1 Image Features Hao Jiang Sept. 2014. Image Matching 2.

SIFT Feature Points

45

(b) Shows the points at the local max/min of DOG scale space forthe image in (a).

Page 46: 1 Image Features Hao Jiang Sept. 2014. Image Matching 2.

Feature matching

?

Page 47: 1 Image Features Hao Jiang Sept. 2014. Image Matching 2.

Feature matching

• Exhaustive search for each feature in one image, look at all the other features

in the other image(s)

• Hashing compute a short descriptor from each feature vector, or hash

longer descriptors (randomly)

• Nearest neighbor techniques kd-trees and their variants

Page 48: 1 Image Features Hao Jiang Sept. 2014. Image Matching 2.

What about outliers?

?

Page 49: 1 Image Features Hao Jiang Sept. 2014. Image Matching 2.

Feature-space outlier rejection Let’s not match all features, but only these that have

“similar enough” matches? How can we do it?

SSD(patch1,patch2) < threshold How to set threshold?

Page 50: 1 Image Features Hao Jiang Sept. 2014. Image Matching 2.

Feature-space outlier rejection

A better way [Lowe, 1999]: 1-NN: SSD of the closest match 2-NN: SSD of the second-closest match Look at how much better 1-NN is than 2-NN, e.g. 1-NN/2-NN That is, is our best match so much better than the rest?

Page 51: 1 Image Features Hao Jiang Sept. 2014. Image Matching 2.

Feature-space outliner rejection

Can we now compute H from the blue points? No! Still too many outliers… What can we do?