+ All Categories
Home > Documents > CS131...

CS131...

Date post: 01-Mar-2021
Category:
Upload: others
View: 2 times
Download: 0 times
Share this document with a friend
26
CS131 Panoramic Image S1tching Yuke Zhu 24Oct14 PA1 Session 1 18-Oct-13
Transcript
Page 1: CS131 PanoramicImageS1tchingvision.stanford.edu/teaching/cs131_fall1415/lectures/lecture_panorama.pdfOct 18, 2013  · SkeletonCode% % •Detectkeypoints(Doneforyou!) % UnderKeypointDetect

CS131    Panoramic  Image  S1tching  

 

Yuke  Zhu  24-­‐Oct-­‐14    

PA1 Session

1

18-Oct-13

Page 2: CS131 PanoramicImageS1tchingvision.stanford.edu/teaching/cs131_fall1415/lectures/lecture_panorama.pdfOct 18, 2013  · SkeletonCode% % •Detectkeypoints(Doneforyou!) % UnderKeypointDetect

Agenda    

•  Objec1ve    •  Main  flow    •  Skeleton  code    •  Results    

Page 3: CS131 PanoramicImageS1tchingvision.stanford.edu/teaching/cs131_fall1415/lectures/lecture_panorama.pdfOct 18, 2013  · SkeletonCode% % •Detectkeypoints(Doneforyou!) % UnderKeypointDetect

Objec1ve    Mul1ple  images  into  one  panorama!  

 

Page 4: CS131 PanoramicImageS1tchingvision.stanford.edu/teaching/cs131_fall1415/lectures/lecture_panorama.pdfOct 18, 2013  · SkeletonCode% % •Detectkeypoints(Doneforyou!) % UnderKeypointDetect

Main  Flow    

(u1,  u2,  .  .  .  ,  u128)    •  Detect  key  points  

 •  Build  the  SIFT  descriptors    •  Match  SIFT  descriptors    •  FiTng  the  transforma1on    •  RANSAC    

(v1,v2,...,v128)    

Page 5: CS131 PanoramicImageS1tchingvision.stanford.edu/teaching/cs131_fall1415/lectures/lecture_panorama.pdfOct 18, 2013  · SkeletonCode% % •Detectkeypoints(Doneforyou!) % UnderKeypointDetect

Main  Flow    

•  Detect  key  points    

Page 6: CS131 PanoramicImageS1tchingvision.stanford.edu/teaching/cs131_fall1415/lectures/lecture_panorama.pdfOct 18, 2013  · SkeletonCode% % •Detectkeypoints(Doneforyou!) % UnderKeypointDetect

Key  Points  Detec1on  

PA1 Session

5

18-Oct-13

Page 7: CS131 PanoramicImageS1tchingvision.stanford.edu/teaching/cs131_fall1415/lectures/lecture_panorama.pdfOct 18, 2013  · SkeletonCode% % •Detectkeypoints(Doneforyou!) % UnderKeypointDetect

Skeleton  Code    

•  Detect  key  points  (Done  for  you!)     -­‐Under  KeypointDetect  

 

[feature,  DoG  pyr,  Gaussian  pyr]  =  detect_features(input  image)    

Tips  addpath(‘KeypointDetect’);  help  detect_features  

Page 8: CS131 PanoramicImageS1tchingvision.stanford.edu/teaching/cs131_fall1415/lectures/lecture_panorama.pdfOct 18, 2013  · SkeletonCode% % •Detectkeypoints(Doneforyou!) % UnderKeypointDetect

Main  Flow    

(u1,  u2,  .  .  .  ,  u128)    

(v1,v2,...,v128)    •  Detect  key  points  

 •  Build  the  SIFT  descriptors    

Jiayuan  Ma    

PA1  Session    

7    18-­‐Oct-­‐13    

Page 9: CS131 PanoramicImageS1tchingvision.stanford.edu/teaching/cs131_fall1415/lectures/lecture_panorama.pdfOct 18, 2013  · SkeletonCode% % •Detectkeypoints(Doneforyou!) % UnderKeypointDetect

Build  the  SIFT  Descriptors    

Page 10: CS131 PanoramicImageS1tchingvision.stanford.edu/teaching/cs131_fall1415/lectures/lecture_panorama.pdfOct 18, 2013  · SkeletonCode% % •Detectkeypoints(Doneforyou!) % UnderKeypointDetect

Skeleton  Code    

•  Build  the  SIFT  descriptors     -­‐  Read  this  paper  hcp://www.cs.ubc.ca/~lowe/papers/ijcv04.pdf  first!  

 

•  Input     -­‐  Gaussian  pyramid  

 -­‐  key  point  loca1on    -­‐  key  point  scale  index    

•  Output     -­‐  A  set  of  128-­‐dimensional  vectors  

 Jiayuan  Ma    

PA1  Session    

9    18-­‐Oct-­‐13    

Page 11: CS131 PanoramicImageS1tchingvision.stanford.edu/teaching/cs131_fall1415/lectures/lecture_panorama.pdfOct 18, 2013  · SkeletonCode% % •Detectkeypoints(Doneforyou!) % UnderKeypointDetect

•  Build  the  SIFT  descriptors  (30  lines  of  code)     -­‐  Compute  gradient  magnitude  and  orienta1on  

 -­‐  For  each  key  point     •  Find  a  patch  (tricky  round-­‐off)  

 •  Compute  orienta1on  of  the  patch    •  Build  the  histogram  (edge  case)    

Skeleton  Code    

descriptors  =  SIFTDescriptor(pyramid,  keyPtLoc,  keyPtScale)  

Page 12: CS131 PanoramicImageS1tchingvision.stanford.edu/teaching/cs131_fall1415/lectures/lecture_panorama.pdfOct 18, 2013  · SkeletonCode% % •Detectkeypoints(Doneforyou!) % UnderKeypointDetect

Main  Flow    

(u1,  u2,  .  .  .  ,  u128)    

(v1,v2,...,v128)    •  Detect  key  points  

 •  Build  the  SIFT  descriptors    •  Match  SIFT  descriptors    

Page 13: CS131 PanoramicImageS1tchingvision.stanford.edu/teaching/cs131_fall1415/lectures/lecture_panorama.pdfOct 18, 2013  · SkeletonCode% % •Detectkeypoints(Doneforyou!) % UnderKeypointDetect

Match  SIFT  Descriptors    

•  Euclidean  distance  between  descriptors    

Page 14: CS131 PanoramicImageS1tchingvision.stanford.edu/teaching/cs131_fall1415/lectures/lecture_panorama.pdfOct 18, 2013  · SkeletonCode% % •Detectkeypoints(Doneforyou!) % UnderKeypointDetect

Skeleton  Code    

•  Match  SIFT  descriptors  (6  lines  of  code)     -­‐  Input:  D1,  D2,  thresh  (default  0.7)  

 -­‐  Output:  match  [D1’s  index,  D2’s  index]    -­‐  Try  to  use  one  for  loop    -­‐  Useful  command     •  repmat  

 •  sort    

match  =  SIFTSimpleMatcher(descriptor1,  descriptor2,  thresh)  

Page 15: CS131 PanoramicImageS1tchingvision.stanford.edu/teaching/cs131_fall1415/lectures/lecture_panorama.pdfOct 18, 2013  · SkeletonCode% % •Detectkeypoints(Doneforyou!) % UnderKeypointDetect

Main  Flow    

(u1,  u2,  .  .  .  ,  u128)    •  Detect  key  points  

 •  Build  the  SIFT  descriptors    •  Match  SIFT  descriptors    •  FiTng  the  transforma1on    

(v1,v2,...,v128)    

t11  t12  t13    T  =                t21  t22  t23  

  0  0  1    

Page 16: CS131 PanoramicImageS1tchingvision.stanford.edu/teaching/cs131_fall1415/lectures/lecture_panorama.pdfOct 18, 2013  · SkeletonCode% % •Detectkeypoints(Doneforyou!) % UnderKeypointDetect

FiTng  the  transforma1on    

•  2D  transforma1ons    

Page 17: CS131 PanoramicImageS1tchingvision.stanford.edu/teaching/cs131_fall1415/lectures/lecture_panorama.pdfOct 18, 2013  · SkeletonCode% % •Detectkeypoints(Doneforyou!) % UnderKeypointDetect

Skeleton  Code    

•  Fit  the  transforma1on  matrix    

h11    H  =    h21  

  0    •  Six  variables  

 

h12  h13    h22  h23     0  1    

-­‐  each  point  give  two  equa1ons    -­‐  at  least  three  points    •  Least  squares  

 

x2    y2    1    

=  H  x1    y1    1    

H  =  ComputeAffineMatrix(  Pt1,  Pt2  )  

Page 18: CS131 PanoramicImageS1tchingvision.stanford.edu/teaching/cs131_fall1415/lectures/lecture_panorama.pdfOct 18, 2013  · SkeletonCode% % •Detectkeypoints(Doneforyou!) % UnderKeypointDetect

Main  Flow    

(u1,  u2,  .  .  .  ,  u128)    •  Detect  key  points  

 •  Build  the  SIFT  descriptors    •  Match  SIFT  descriptors    •  FiTng  the  transforma1on    •  RANSAC    

(v1,v2,...,v128)    

Page 19: CS131 PanoramicImageS1tchingvision.stanford.edu/teaching/cs131_fall1415/lectures/lecture_panorama.pdfOct 18, 2013  · SkeletonCode% % •Detectkeypoints(Doneforyou!) % UnderKeypointDetect

RANSAC    

•  A  further  refinement  of  matches    

Page 20: CS131 PanoramicImageS1tchingvision.stanford.edu/teaching/cs131_fall1415/lectures/lecture_panorama.pdfOct 18, 2013  · SkeletonCode% % •Detectkeypoints(Doneforyou!) % UnderKeypointDetect

Skeleton  Code  

•  RANSAC     -­‐  ComputeError  

 

H  =  RANSACFit(p1,  p2,  match,  maxIter,  seedSetSize,  maxInlierError,  goodFitThresh  )  

Page 21: CS131 PanoramicImageS1tchingvision.stanford.edu/teaching/cs131_fall1415/lectures/lecture_panorama.pdfOct 18, 2013  · SkeletonCode% % •Detectkeypoints(Doneforyou!) % UnderKeypointDetect

Main  Flow    

(u1,  u2,  .  .  .  ,  u128)    •  Detect  key  points  

 •  Build  the  SIFT  descriptors    •  Match  SIFT  descriptors    •  FiTng  the  transforma1on    •  RANSAC    

(v1,v2,...,v128)    

Page 22: CS131 PanoramicImageS1tchingvision.stanford.edu/teaching/cs131_fall1415/lectures/lecture_panorama.pdfOct 18, 2013  · SkeletonCode% % •Detectkeypoints(Doneforyou!) % UnderKeypointDetect

•  Mul1ple  S1tch  (2  lines  of  code)     -­‐  A  simplified  case  of  real-­‐world  scenario  

 -­‐  Transforma1on  is  associa1ve  and  inver1ble    -­‐  Useful  command     •  pinv  

 

Image  S1tching  

•  Almost  done  for  you    

T  =  makeTransformToReferenceFrame(i_To_iPlusOne_Transform,  currentFrameIndex,  refFrameIndex)  

Page 23: CS131 PanoramicImageS1tchingvision.stanford.edu/teaching/cs131_fall1415/lectures/lecture_panorama.pdfOct 18, 2013  · SkeletonCode% % •Detectkeypoints(Doneforyou!) % UnderKeypointDetect

Tips  

•  Tester.m     -­‐  Scripts  that  help  you  to  get  started  

 

•  Evaluate.m     -­‐  Scripts  that  tests  your  solu1on  

  •  Load  fixed  input  from  checkpoint    •  Run  your  implementa1on    •  Compare  results  with  reference  solu1on    

•  Help  -­‐  Use  “help”  command  to  learn  how  func1ons  work    

Page 24: CS131 PanoramicImageS1tchingvision.stanford.edu/teaching/cs131_fall1415/lectures/lecture_panorama.pdfOct 18, 2013  · SkeletonCode% % •Detectkeypoints(Doneforyou!) % UnderKeypointDetect

Requirement    

•  Due  Date:  5pm  Oct  31,  2014    •  Electronic  submission  only     -­‐  [email protected]  

 •  Code  +  Report     -­‐  SIFT  invariance  and  why  it  helps  

 -­‐  DoG  v.s.  Dense  SIFT    -­‐  Why  RANSAC    -­‐  Your  own  s1tches    -­‐  Error  discussion    

Page 25: CS131 PanoramicImageS1tchingvision.stanford.edu/teaching/cs131_fall1415/lectures/lecture_panorama.pdfOct 18, 2013  · SkeletonCode% % •Detectkeypoints(Doneforyou!) % UnderKeypointDetect

Results    

Page 26: CS131 PanoramicImageS1tchingvision.stanford.edu/teaching/cs131_fall1415/lectures/lecture_panorama.pdfOct 18, 2013  · SkeletonCode% % •Detectkeypoints(Doneforyou!) % UnderKeypointDetect

Results    


Recommended