-
Notifications
You must be signed in to change notification settings - Fork 5
/
examplesurf.m
61 lines (42 loc) · 1.46 KB
/
examplesurf.m
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
%% PROJECT 1 Analysis and Search of Visual Data - SURF Testing
%% Federico Favia, Mayank Gulati, September 2019
%% reading image and converting
I = imread('data1/obj1_5.jpg');
G= rgb2gray(I); %grayscale
figure()
imshow(uint8(ref));
%% Applying SURF
surf_ref = detectSURFFeatures(G);
surf_ref_best = surf_ref.selectStrongest(250);
%plot(surf.selectStrongest(250));
n_detected_original=133;
%% scaling repeatability
% m=1.2; %scale factor
% for i=1:9
% figure()
% target = imresize(ref,m.^(i-1));
% imshow(uint8(target));
% [sift_tar,sift_tar_des] = vl_sift(target,'PeakThresh',peakthresh,'EdgeThresh',edgethresh);
% h2 = vl_plotframe(sift_tar);
% [matches,scores]= vl_ubcmatch(sift_ref_des,sift_tar_des,1.7);
% %plot(matches(1,:),matches(2,:),'--');
% repeatiblity_scale(i) = (size(matches,2))./(n_detected_original);
% end
%% rotation repeatability
angle=15; %rotation step
for i=1:25
x(i) = (i-1).*angle;
target = imrotate(G,x(i));
surf_tar = detectSURFFeatures(target);
surf_tar_best = surf_tar.selectStrongest(250);
[f1,vpts1] = extractFeatures(G,surf_ref_best);
[f2,vpts2] = extractFeatures(target,surf_tar_best);
indexPairs = matchFeatures(f1,f2);
repeatibility_rotation(i) = (size(indexPairs,1))./(n_detected_original);
end
%% plot repeatibility
figure()
plot(x,repeatibility_rotation);
title('SURF Repeatibility rotation')
xlabel('Angle (degrees)')
ylabel('Repeatibility')