CS131 Panoramic Image S1tching
Yuke Zhu 24-‐Oct-‐14
PA1 Session
1
18-Oct-13
Agenda
• Objec1ve • Main flow • Skeleton code • Results
Objec1ve Mul1ple images into one panorama!
Main Flow
(u1, u2, . . . , u128) • Detect key points
• Build the SIFT descriptors • Match SIFT descriptors • FiTng the transforma1on • RANSAC
(v1,v2,...,v128)
Main Flow
• Detect key points
Key Points Detec1on
PA1 Session
5
18-Oct-13
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
Main Flow
(u1, u2, . . . , u128)
(v1,v2,...,v128) • Detect key points
• Build the SIFT descriptors
Jiayuan Ma
PA1 Session
7 18-‐Oct-‐13
Build the SIFT Descriptors
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
• 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)
Main Flow
(u1, u2, . . . , u128)
(v1,v2,...,v128) • Detect key points
• Build the SIFT descriptors • Match SIFT descriptors
Match SIFT Descriptors
• Euclidean distance between descriptors
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)
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
FiTng the transforma1on
• 2D transforma1ons
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 )
Main Flow
(u1, u2, . . . , u128) • Detect key points
• Build the SIFT descriptors • Match SIFT descriptors • FiTng the transforma1on • RANSAC
(v1,v2,...,v128)
RANSAC
• A further refinement of matches
Skeleton Code
• RANSAC -‐ ComputeError
H = RANSACFit(p1, p2, match, maxIter, seedSetSize, maxInlierError, goodFitThresh )
Main Flow
(u1, u2, . . . , u128) • Detect key points
• Build the SIFT descriptors • Match SIFT descriptors • FiTng the transforma1on • RANSAC
(v1,v2,...,v128)
• 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)
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
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
Results
Results