-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathsift.m
More file actions
22 lines (16 loc) · 781 Bytes
/
sift.m
File metadata and controls
22 lines (16 loc) · 781 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
function [leftF,rightF,prunedMatches] = sift(leftImg,rightImg,pruneVal)
%SIFT Get necessary variables for panoramic stitching
% produces list of features using SIFT from the provided 2 images as well
% as the list of sorted feature matches
% Detect keypoints and extract descriptors
[leftF, leftD] = vl_sift(leftImg);
[rightF, rightD] = vl_sift(rightImg);
% Basic matching algorithm using vl_ubcmatch
[matches, scores] = vl_ubcmatch(leftD, rightD);
% Sort distances from lowest to highest and get sort index returned as a vector
[~, sortedIndex] = sort(scores);
% Sort matches vector according to how scores was sorted so the index values
% still match between matches and scores
sortedMatches = matches(:, sortedIndex);
prunedMatches = sortedMatches(:,1:pruneVal);
end