-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtest.m
50 lines (41 loc) · 1.62 KB
/
test.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
close all;
original = imread('C:\Group Detection Project\Vignesh BG Substract\BGsubtract\1_1.jpg');
original = rgb2gray(original);
figure;
imshow(original);
scale = 1.3;
J = imresize(original,scale);
theta = 31;
distorted = imrotate(J,theta);
%distorted = imread('C:\Group Detection Project\Vignesh BG Substract\BGsubtract\dataset\2.jpg');
%distorted = rgb2gray(distorted);
figure
imshow(distorted)
ptsOriginal = detectSURFFeatures(original);
ptsDistorted = detectSURFFeatures(distorted);
[featuresOriginal,validPtsOriginal] = extractFeatures(original,ptsOriginal);
[featuresDistorted,validPtsDistorted] = extractFeatures(distorted,ptsDistorted);
indexPairs = matchFeatures(featuresOriginal,featuresDistorted);
matchedOriginal = validPtsOriginal(indexPairs(:,1));
matchedDistorted = validPtsDistorted(indexPairs(:,2));
figure
showMatchedFeatures(original,distorted,matchedOriginal,matchedDistorted)
title('Candidate matched points (including outliers)')
%Not Needed..................................................................
% [tform, inlierDistorted,inlierOriginal] = estimateGeometricTransform(matchedDistorted,matchedOriginal,'similarity');
%
% figure
% showMatchedFeatures(original,distorted,inlierOriginal,inlierDistorted)
% title('Matching points (inliers only)')
% legend('ptsOriginal','ptsDistorted')
%
% figure
% showMatchedFeatures(original,distorted,inlierOriginal,inlierDistorted)
% title('Matching points (inliers only)')
% legend('ptsOriginal','ptsDistorted')
%
% outputView = imref2d(size(original));
% recovered = imwarp(distorted,tform,'OutputView',outputView);
%
% figure
% imshowpair(original,recovered,'montage')