www.gusucode.com > vision 源码程序 matlab案例代码 > vision/DisplayCorrespondingPtsBetweenTwoRotatedAndScaledImagesExample.m

    %% Display Corresponding Points Between Two Rotated and Scaled Images
% Use SURF features to find corresponding points between two images rotated and scaled with respect to each other.
%% Read images.

% Copyright 2015 The MathWorks, Inc.

I1 = imread('cameraman.tif');
I2 = imresize(imrotate(I1,-20), 1.2);
%% Detect SURF features.
points1 = detectSURFFeatures(I1);
points2 = detectSURFFeatures(I2);
%% Extract features.
[f1, vpts1] = extractFeatures(I1, points1);
[f2, vpts2] = extractFeatures(I2, points2);
%% Match features.
indexPairs = matchFeatures(f1, f2) ;
matchedPoints1 = vpts1(indexPairs(:, 1));
matchedPoints2 = vpts2(indexPairs(:, 2));
%% Visualize candidate matches.
figure; ax = axes;
showMatchedFeatures(I1,I2,matchedPoints1,matchedPoints2,'Parent',ax);
title(ax, 'Putative point matches');
legend(ax,'Matched points 1','Matched points 2');