surf featuresjacky/...intelligentmobilerobotics/.../l03_su… · robot localization texture...

50
SURF Features Jacky Baltes Dept. of Computer Science University of Manitoba Email: [email protected] WWW: http://www.cs.umanitoba.ca/~jacky

Upload: others

Post on 14-Oct-2020

3 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: SURF Featuresjacky/...IntelligentMobileRobotics/.../L03_Su… · Robot localization Texture recognition. Covariant to Scale Change Changes in scale do not alter the structure of the

SURF Features

Jacky BaltesDept. of Computer Science

University of ManitobaEmail: [email protected]

WWW: http://www.cs.umanitoba.ca/~jacky

Page 2: SURF Featuresjacky/...IntelligentMobileRobotics/.../L03_Su… · Robot localization Texture recognition. Covariant to Scale Change Changes in scale do not alter the structure of the

Salient Spatial Features

● Trying to find interest points● Points that can be found independent of

perspective transformations– Distinctive (Unique in local region)

● Surrounding of pixel is rich in structure

– Repeatable (Different views)

– Stable under geometric, photometric transformations

– Stable to noise

– Well defined position in the image

Page 3: SURF Featuresjacky/...IntelligentMobileRobotics/.../L03_Su… · Robot localization Texture recognition. Covariant to Scale Change Changes in scale do not alter the structure of the

Applications

● Tracking● Object recognition● Human action recognition● Panorama stitching● Robot localization● Texture recognition

Page 4: SURF Featuresjacky/...IntelligentMobileRobotics/.../L03_Su… · Robot localization Texture recognition. Covariant to Scale Change Changes in scale do not alter the structure of the

Covariant to Scale Change

● Changes in scale do not alter the structure of the image

Page 5: SURF Featuresjacky/...IntelligentMobileRobotics/.../L03_Su… · Robot localization Texture recognition. Covariant to Scale Change Changes in scale do not alter the structure of the

Salient Features

● Scale Invariant Feature Transform (SIFT)

– David Lowe, 1999● Harris Affine Corner Detector

● Hessian Affine Corner Detector

● Edge Based Regions

● Intensity Based Regions

● Maximally Stable Extremal Regions (MSER)

● Entropy Based Salient Regions

Page 6: SURF Featuresjacky/...IntelligentMobileRobotics/.../L03_Su… · Robot localization Texture recognition. Covariant to Scale Change Changes in scale do not alter the structure of the

Scale Invariant Feature Transform (SIFT)

● Scale-space Theorem:– A local 3D Maximum of |NLOG| in (x,y,σ)

– Can be identified at different scales (scale invariant keypoint)

– Laplacian Kernel●

NLoG x , y , σ =σ 2∇ 2G

Page 7: SURF Featuresjacky/...IntelligentMobileRobotics/.../L03_Su… · Robot localization Texture recognition. Covariant to Scale Change Changes in scale do not alter the structure of the

The Laplacian of Gaussian (LoG)

● Convolution of an image by the following kernel

● Diameter t, L is called scale-space representation

● Based on Laplacian operator, which is sum of partial derivatives in Euclidean space

● A popular blob detector is based on LoG

g x , y , t =1

2 t 2e− x 2 y 2/2t

L x , y ; t =g x , y , t ∗I x , y

∇ norm2 L x , y ; t =t L xxL yy

Page 8: SURF Featuresjacky/...IntelligentMobileRobotics/.../L03_Su… · Robot localization Texture recognition. Covariant to Scale Change Changes in scale do not alter the structure of the

Everything Clear?

● Maybe if you are a mathematician● Another derivation● Sobel, Prewitt edge detectors are gradient

based● Maximum of 1st derivative● Or zero-crossing of 2nd derivative● How to calculate 2nd derivative?

Page 9: SURF Featuresjacky/...IntelligentMobileRobotics/.../L03_Su… · Robot localization Texture recognition. Covariant to Scale Change Changes in scale do not alter the structure of the

Laplacian● Need to calculate 2nd derivative

– Change in 1st derivative

● 4 connectedness– (f – e) – (e – d) + (h-e) – (e-b)

– = +f +d +h+b-4e

● 8 Connectedness– (f – e) – (e – d) + (h-e) – (e-b) +

(i-e) – (e – a) + (c-e) – (e – g)

– = +f + d + h + b + i + a + c + g - 8e

a b c

d e f

g h i

1 1 1

1 -8 1

1 1 1

0 1 0

1 -4 1

0 1 0

Page 10: SURF Featuresjacky/...IntelligentMobileRobotics/.../L03_Su… · Robot localization Texture recognition. Covariant to Scale Change Changes in scale do not alter the structure of the

Laplacian

● Detect the zero crossing of the Laplacian to detect edges

● Because of the use of the 2nd derivative, very sensitive to noise

● Remove noise by blurring the image first with a Gaussian kernel of size σ

LoG x , y =−1

4 [1−x2 y2

22 ]e−x2

y2

2 2

Page 11: SURF Featuresjacky/...IntelligentMobileRobotics/.../L03_Su… · Robot localization Texture recognition. Covariant to Scale Change Changes in scale do not alter the structure of the

Gradient based procedure

Sobel

Sobel

Page 12: SURF Featuresjacky/...IntelligentMobileRobotics/.../L03_Su… · Robot localization Texture recognition. Covariant to Scale Change Changes in scale do not alter the structure of the

Laplacian

1 1 1

1 -8 1

1 1 1

Page 13: SURF Featuresjacky/...IntelligentMobileRobotics/.../L03_Su… · Robot localization Texture recognition. Covariant to Scale Change Changes in scale do not alter the structure of the

Sobel

-1 0 1

-2 0 2

-1 0 1

-1 -2 -1

0 0 0

1 2 1

Page 14: SURF Featuresjacky/...IntelligentMobileRobotics/.../L03_Su… · Robot localization Texture recognition. Covariant to Scale Change Changes in scale do not alter the structure of the

Laplacian

1 1 1

1 -8 1

1 1 1

Page 15: SURF Featuresjacky/...IntelligentMobileRobotics/.../L03_Su… · Robot localization Texture recognition. Covariant to Scale Change Changes in scale do not alter the structure of the

Zero-crossing based procedure

LoG

Page 16: SURF Featuresjacky/...IntelligentMobileRobotics/.../L03_Su… · Robot localization Texture recognition. Covariant to Scale Change Changes in scale do not alter the structure of the

Laplacian of Gaussian

Page 17: SURF Featuresjacky/...IntelligentMobileRobotics/.../L03_Su… · Robot localization Texture recognition. Covariant to Scale Change Changes in scale do not alter the structure of the

Gaussian

● Plot in Scilab

Page 18: SURF Featuresjacky/...IntelligentMobileRobotics/.../L03_Su… · Robot localization Texture recognition. Covariant to Scale Change Changes in scale do not alter the structure of the

Edge-based Segmentation: examples

Prewitt: needs edge linking Canny: needs “cleaning”

Page 19: SURF Featuresjacky/...IntelligentMobileRobotics/.../L03_Su… · Robot localization Texture recognition. Covariant to Scale Change Changes in scale do not alter the structure of the

Difference of Gaussian

● Calculate the difference of Gaussian– Radius 1 = 1.0, Radius 2 = 2.0

Page 20: SURF Featuresjacky/...IntelligentMobileRobotics/.../L03_Su… · Robot localization Texture recognition. Covariant to Scale Change Changes in scale do not alter the structure of the

Difference of Gaussian

● Approximation of Laplacian |NLoG|●

● Invariant to scale and rotation

DoG x , y ,=G x , y , k−G x , y ,

Page 21: SURF Featuresjacky/...IntelligentMobileRobotics/.../L03_Su… · Robot localization Texture recognition. Covariant to Scale Change Changes in scale do not alter the structure of the

SIFT Features

Page 22: SURF Featuresjacky/...IntelligentMobileRobotics/.../L03_Su… · Robot localization Texture recognition. Covariant to Scale Change Changes in scale do not alter the structure of the

Scale Space Representation

● L is the scale-space representation● Obtained by convoluting with a Gaussian

kernel of size t●

● And partial derivatives of L●

g x , y , t =1

2 t 2e− x 2 y 2/2t

L x , y ; t =g x , y , t ∗I x , y

L x=∂ L∂ x, L y=

∂ L∂ y

Page 23: SURF Featuresjacky/...IntelligentMobileRobotics/.../L03_Su… · Robot localization Texture recognition. Covariant to Scale Change Changes in scale do not alter the structure of the

Structure Tensor

● Also called 2nd moment matrix● Derived from the gradient● Measures the pre-dominant gradient in a

neighborhood and its coherence

Sw p= [ I x2 p I x p I y p

I x p I y p I y2 p ]

Page 24: SURF Featuresjacky/...IntelligentMobileRobotics/.../L03_Su… · Robot localization Texture recognition. Covariant to Scale Change Changes in scale do not alter the structure of the

Harris Affine Corner Detector

● Gradient distribution matrix (M)●

● Calculate Eigenvalues of M

M=D2 g 1 [ I x

2 p ,D I x p ,D I y p ,D

I x p ,D I y p ,D I y2 p ,D ]

Page 25: SURF Featuresjacky/...IntelligentMobileRobotics/.../L03_Su… · Robot localization Texture recognition. Covariant to Scale Change Changes in scale do not alter the structure of the

Eigenvectors and Eigenvalues

● Are vectors and scalars such for a matrix M such that

● Only exists if (M-λI) has no inverse.● Characteristic/secular equation

– det(M-λI)=0

M∗x=∗x

Page 26: SURF Featuresjacky/...IntelligentMobileRobotics/.../L03_Su… · Robot localization Texture recognition. Covariant to Scale Change Changes in scale do not alter the structure of the

Eigenvectors and Eigenvalues

● Given a 2*2 matrix M●

M= [a11 a12

a21 a22]

det M− I =0

1,2=a11a22±a11a22

2−4a11a22−a12a21

2

Page 27: SURF Featuresjacky/...IntelligentMobileRobotics/.../L03_Su… · Robot localization Texture recognition. Covariant to Scale Change Changes in scale do not alter the structure of the

Harris Affine Corner Detector

● Eigenvalues show● the direction of change●

● Curvature●

● Corners are stable under different lighting conditions

C=det M −k trace2M

C=12−k 122

Page 28: SURF Featuresjacky/...IntelligentMobileRobotics/.../L03_Su… · Robot localization Texture recognition. Covariant to Scale Change Changes in scale do not alter the structure of the

Hessian Affine Corner Detector

● The Hessian of a function with two arguments is defined as

● If function is continuous, then●

H p= [∂2 I

∂ x2 p∂2 I

∂ x∂ y p

∂2 I∂ y∂ x

p∂2 I

∂ y2 p ]∂2 I

∂ x ∂ y p=

∂2 I∂ y ∂ x

p

Page 29: SURF Featuresjacky/...IntelligentMobileRobotics/.../L03_Su… · Robot localization Texture recognition. Covariant to Scale Change Changes in scale do not alter the structure of the

Hessian Approximation

● Hessian approximation using Gaussians●

● Convolution of image by Gaussian●

● Blob detector using maximums of the determinant

H p ,=[ Lxx p , L xy p ,

Lxy p , L yy p , ]

L xx p ,=∂2 I

∂ x2 g ∗I p

Page 30: SURF Featuresjacky/...IntelligentMobileRobotics/.../L03_Su… · Robot localization Texture recognition. Covariant to Scale Change Changes in scale do not alter the structure of the

SURF Algorithm

● Uses the integral image to compute averages over areas efficiently (4 lookups and 3 arithmetic operations)

Page 31: SURF Featuresjacky/...IntelligentMobileRobotics/.../L03_Su… · Robot localization Texture recognition. Covariant to Scale Change Changes in scale do not alter the structure of the

Integral Image

● Sum of all the pixels to the left and top of the pixel

● Sum of any rectangular region can be extracted in constant time using four lookups and arithmetic

+ Bottum Right

- Top Right

- Bottum Left

+ Top Left

Page 32: SURF Featuresjacky/...IntelligentMobileRobotics/.../L03_Su… · Robot localization Texture recognition. Covariant to Scale Change Changes in scale do not alter the structure of the

SURF and Hessian Matrix

● SURF is based on calculating the Hessian matrix

● Authors claim more robust than Harris detector

● Hessian is an approximation of 2nd order derivative – large values for maxima and minima

Page 33: SURF Featuresjacky/...IntelligentMobileRobotics/.../L03_Su… · Robot localization Texture recognition. Covariant to Scale Change Changes in scale do not alter the structure of the

Approximation of Gaussian

● 2nd order partial derivatives● Cropped and discretized

– L_yy L_xy

Page 34: SURF Featuresjacky/...IntelligentMobileRobotics/.../L03_Su… · Robot localization Texture recognition. Covariant to Scale Change Changes in scale do not alter the structure of the

Box Filters

● Coarse approximation allows computation of value by integral image

– L_yy L_xy

Page 35: SURF Featuresjacky/...IntelligentMobileRobotics/.../L03_Su… · Robot localization Texture recognition. Covariant to Scale Change Changes in scale do not alter the structure of the

Scale Space Transform

● Useful for finding interest points● Can scale filter without increased

computational cost

Page 36: SURF Featuresjacky/...IntelligentMobileRobotics/.../L03_Su… · Robot localization Texture recognition. Covariant to Scale Change Changes in scale do not alter the structure of the

Scale Space

● What filter sizes do we need to use?● 9x9 box filters are approximations of

Gaussian with σ = 1.2●

● W is a weight that corrects for the approximation of the Gaussian.

● Analysis shows that w=0.9 is a good enough approximation

det H¿=Dxx∗D yy−wD xy

2

Page 37: SURF Featuresjacky/...IntelligentMobileRobotics/.../L03_Su… · Robot localization Texture recognition. Covariant to Scale Change Changes in scale do not alter the structure of the

Scale Space

● The approximation of the Hessian determinant is equivalent to finding blobs

● Used to detect local maximas in the scale space using different sized filters

● Stored in the so-called blob response map

Page 38: SURF Featuresjacky/...IntelligentMobileRobotics/.../L03_Su… · Robot localization Texture recognition. Covariant to Scale Change Changes in scale do not alter the structure of the

Scale Space

● Doubling of σ represents one octave of the scale space

● Each octave has a constant number of scale levels

● Filter sized needs to be increased by 6 pixels

– Lobes are set of 1/3 of filter

– Needs to be increased by 2

– To keep a central pixel

Page 39: SURF Featuresjacky/...IntelligentMobileRobotics/.../L03_Su… · Robot localization Texture recognition. Covariant to Scale Change Changes in scale do not alter the structure of the

Scale Space

Page 40: SURF Featuresjacky/...IntelligentMobileRobotics/.../L03_Su… · Robot localization Texture recognition. Covariant to Scale Change Changes in scale do not alter the structure of the

Scale Space

● 9,15,21,27 are first octave– Corresponds to a change of σ of 1.2 to 3.2

– Min and max scale leves per octave are used to suppress maximas that are not maximas in scale space

● Filter size increase doubles per octave● 15,27,39,51● Large change in σ in first two octaves

can be avoided by scaling image first

Page 41: SURF Featuresjacky/...IntelligentMobileRobotics/.../L03_Su… · Robot localization Texture recognition. Covariant to Scale Change Changes in scale do not alter the structure of the

Scale Space

Page 42: SURF Featuresjacky/...IntelligentMobileRobotics/.../L03_Su… · Robot localization Texture recognition. Covariant to Scale Change Changes in scale do not alter the structure of the

Haar Wavelets

Page 43: SURF Featuresjacky/...IntelligentMobileRobotics/.../L03_Su… · Robot localization Texture recognition. Covariant to Scale Change Changes in scale do not alter the structure of the

Orientation

● S is the scale at which an interest point was detected

● Calculate response of Haar wavelets in the x and y direction around the interest point

● Radius is 6*s– Sampling is s

– So take 6 samples along one direction

● Size of the Haar wavelets is 4*s

Page 44: SURF Featuresjacky/...IntelligentMobileRobotics/.../L03_Su… · Robot localization Texture recognition. Covariant to Scale Change Changes in scale do not alter the structure of the

Orientation

● Responses weighted by Gaussian with σ=2s

● X direction is Haar wavelet response in x● Y direction is Haar wavelet response in y● Sum all points in 60 deg. ● window

– Import parameter

● Orientation is window with the longest vector

Page 45: SURF Featuresjacky/...IntelligentMobileRobotics/.../L03_Su… · Robot localization Texture recognition. Covariant to Scale Change Changes in scale do not alter the structure of the

Feature Descriptors

● Similar to SIFT (David Lowe)● Generate square window

– Size is 20s

– Orientation along the orientation calculated

● Split window into 4x4 square subregions● Calculate Haar wavelet response in x and y● Rotate along the orientation● Weight with a Gaussian of σ=3.3s

Page 46: SURF Featuresjacky/...IntelligentMobileRobotics/.../L03_Su… · Robot localization Texture recognition. Covariant to Scale Change Changes in scale do not alter the structure of the

Feature Descriptor

Page 47: SURF Featuresjacky/...IntelligentMobileRobotics/.../L03_Su… · Robot localization Texture recognition. Covariant to Scale Change Changes in scale do not alter the structure of the

Feature Descriptor

● Calculate sum of changes as well as absolute sum of changes

● 4 entries per field, 16 sub-regions = 64 entries

Page 48: SURF Featuresjacky/...IntelligentMobileRobotics/.../L03_Su… · Robot localization Texture recognition. Covariant to Scale Change Changes in scale do not alter the structure of the

Robustness to Noise

Page 49: SURF Featuresjacky/...IntelligentMobileRobotics/.../L03_Su… · Robot localization Texture recognition. Covariant to Scale Change Changes in scale do not alter the structure of the

Evaluation

● The set of features of the feature descriptors was arrived at by experimentation

● Evaluations– Camera calibration

– Object detection

● Faster and more robust than other detectors

Page 50: SURF Featuresjacky/...IntelligentMobileRobotics/.../L03_Su… · Robot localization Texture recognition. Covariant to Scale Change Changes in scale do not alter the structure of the

References

● Herbert Bay, Andreas Ess, Tinne Tuytelaars, Luc Van Gool, "SURF: Speeded Up Robust Features", Computer Vision and Image Understanding (CVIU), Vol. 110, No. 3, pp. 346--359, 2008

● SURF, David Tam (Ryerson), Computer Robotics Vision (CRV) Tutorials 2010, www.computerroboticsvision.org

● Salient Feature Detectors and Descriptors: Affine-Hessian, Harris, MSER, SIFT, SURF, Amir-Hossein Shabani, Computer Robotics Vision (CRV) Tutorials 2009, www.computerroboticsvision.org

● Chris Evans. Notes on the OpenSURF Library. January 18, 2009, http://opensurf1.googlecode.com/files/OpenSURF.pdf

● http://en.wikipedia.org/wiki/Hessian_matrix