feature description and matching - cornell university
TRANSCRIPT
MatchingfeaturepointsWeknowhowtodetectgoodpointsNextquestion:Howtomatchthem?
Twointerrelatedquestions:1. Howdowedescribeeachfeaturepoint?2. Howdowematchdescriptions?
?
Featurematching
• Measurethedistancebetween(orsimilaritybetween)everypairofdescriptors
𝒚𝟏 𝒚𝟐
𝒙𝟏 𝑑(𝑥", 𝑦") 𝑑(𝑥", 𝑦#)
𝒙𝟐 𝑑(𝑥#, 𝑦") 𝑑(𝑥#, 𝑦#)
Invariancevs.discriminability
• Invariance:– Distancebetweendescriptorsshouldbesmallevenifimageistransformed
• Discriminability:– Descriptorshouldbehighlyuniqueforeachpoint(farawayfromotherpointsintheimage)
Invariance
• Mostfeaturedescriptorsaredesignedtobeinvariantto– Translation,2Drotation,scale
• Theycanusuallyalsohandle– Limited3Drotations(SIFTworksuptoabout60degrees)– Limitedaffinetransformations(somearefullyaffineinvariant)– Limitedillumination/contrastchanges
Howtoachieveinvariance
Designaninvariantfeaturedescriptor– Simplestdescriptor:asingle0
• What’sthisinvariantto?• Isthisdiscriminative?
– Nextsimplestdescriptor:asinglepixel• What’sthisinvariantto?• Isthisdiscriminative?
NCC- NormalizedCrossCorrelation
• Lightingandcolorchangepixelintensities• Example:increasebrightness/contrast• 𝐼2 = 𝛼𝐼 + 𝛽• Subtractpatchmean:invarianceto𝛽• Dividebynormofvector:invarianceto𝛼• 𝑥′ = 𝑥−< 𝑥 >
• 𝑥′′ = 92||92||
• similarity=𝑥22 ⋅ 𝑦′′
Basiccorrespondence
• Imagepatchasdescriptor,NCCassimilarity• Invariantto?
– Photometrictransformations?– Translation?– Rotation?
• Finddominantorientationoftheimagepatch– Thisisgivenbyxmax,theeigenvectorofM correspondingtolmax (the
larger eigenvalue)– Rotatethepatchaccordingtothisangle
Rotationinvarianceforfeaturedescriptors
FigurebyMatthewBrown
Take40x40squarewindowarounddetectedfeature– Scaleto1/5size(using
prefiltering)– Rotatetohorizontal– Sample8x8squarewindow
centeredatfeature– Intensitynormalizethe
windowbysubtractingthemean,dividingbythestandarddeviationinthewindow
CSE576:ComputerVision
MultiscaleOrientedPatcheS descriptor
8 pixels
AdaptedfromslidebyMatthewBrown
• Finddominantorientationoftheimagepatch– Thisisgivenbyxmax,theeigenvectorofM correspondingtolmax (the
larger eigenvalue)– Rotatethepatchaccordingtothisangle
Rotationinvarianceforfeaturedescriptors
FigurebyMatthewBrown
Detour:Imagetransformations
• Whatdoesitmeantorotateapatch?• Eachpixelhascoordinates(x,y)• RotationrepresentedbyamatrixR• Pixel’snewcoordinates:
• I’(x’,y’)=I(x,y)
x0
y0
�= R
xy
�
Detour:Imagetransformations
• Whatifdestinationpixelisfractional?• Flipcomputation:foreverydestinationpixelfigureoutsourcepixel– Useinterpolationifsourcelocationisfractional
• I’(x’,y’)=I(x,y)
xy
�= R�1
x0
y0
�
Take40x40squarewindowarounddetectedfeature– Scaleto1/5size(using
prefiltering)– Rotatetohorizontal– Sample8x8squarewindow
centeredatfeature– Intensitynormalizethe
windowbysubtractingthemean,dividingbythestandarddeviationinthewindow
CSE576:ComputerVision
MultiscaleOrientedPatcheS descriptor
8 pixels
AdaptedfromslidebyMatthewBrown
Towardsabetterfeaturedescriptor
• Matchpatternofedges– Edgeorientation– cluetoshape
• Beresilienttosmalldeformations– Deformationsmightmovepixelsaround,butslightly
– Deformationsmightchangeedgeorientations,butslightly
Invariancetodeformationbyquantization
g(✓) =
8>>>><
>>>>:
0 if 0 < ✓ < 2⇡/N1 if 2⇡/N < ✓ < 4⇡/N2 if 4⇡/N < ✓ < 6⇡/N
. . .N � 1 if 2(N � 1)⇡/N
T.Tuytelaars,B.Leibe
RotationInvariancebyOrientationNormalization
• Computeorientationhistogram• Selectdominantorientation• Normalize:rotatetofixedorientation
0 2p
[Lowe,SIFT,1999]
TheSIFTdescriptor
• Computeedgemagnitudes+orientations• Quantizeorientations(invariancetodef)• Divideintospatialcells• Computeorientationhistogramineachcell(spatialinvariance)
DistinctiveImageFeaturesfromScale-InvariantKeypoints.Lowe.InIJCV2004
Basicidea:• DoG forscale-spacefeaturedetection• Take16x16squarewindowarounddetectedfeature
• Computegradientorientationforeachpixel• Throwoutweakedges(thresholdgradientmagnitude)• Createhistogramofsurvivingedgeorientations
ScaleInvariantFeatureTransform
AdaptedfromslidebyDavidLowe
0 2p
angle histogram
SIFTdescriptorCreatehistogram
• Dividethe16x16windowintoa4x4gridofcells(2x2caseshownbelow)• Computeanorientationhistogramforeachcell• 16cells*8orientations=128dimensionaldescriptor
AdaptedfromslidebyDavidLowe
SIFTvectorformation• Computedonrotatedandscaledversionofwindowaccordingtocomputedorientation&scale– resamplethewindow
• BasedongradientsweightedbyaGaussian
Ensuresmoothness• Trilinear interpolation
– agivengradientcontributesto8bins:4inspacetimes2inorientation
Reduceeffectofillumination• 128-dimvectornormalizedto1• Thresholdgradientmagnitudestoavoidexcessiveinfluenceofhighgradients– afternormalization,clampgradients>0.2– renormalize
PropertiesofSIFTExtraordinarilyrobustmatchingtechnique
– Canhandlechangesinviewpoint• Uptoabout60degreeoutofplanerotation
– Canhandlesignificantchangesinillumination• Sometimesevendayvs.night(below)
– Fastandefficient—canruninrealtime– Lotsofcodeavailable:
http://people.csail.mit.edu/albert/ladypack/wiki/index.php/Known_implementations_of_SIFT
Summary• Keypoint detection:repeatableanddistinctive– Corners,blobs,stableregions– Harris,DoG
• Descriptors:robustandselective– spatialhistogramsoforientation– SIFTandvariantsaretypicallygoodforstitchingandrecognition
– But,neednotsticktoone
Featurematching
GivenafeatureinI1,howtofindthebestmatchinI2?1. Definedistancefunctionthatcomparestwo
descriptors2. TestallthefeaturesinI2,findtheonewithmin
distance
FeaturedistanceHowtodefinethedifferencebetweentwofeaturesf1,f2?
– Simpleapproach:L2 distance,||f1 - f2 ||– cangivegoodscorestoambiguous(incorrect)matches
I1 I2
f1 f2
f1 f2f2'
FeaturedistanceHowtodefinethedifferencebetweentwofeaturesf1,f2?
• Betterapproach:ratiodistance=||f1 - f2 ||/||f1 - f2’||• f2 isbestSSDmatchtof1 inI2• f2’is2nd bestSSDmatchtof1 inI2• giveslargevaluesforambiguousmatches
I1 I2