Code covered by the BSD License

# March 2013 Japanese webinar "Introduction to Image Processing and Computer Vision with MATLAB"

### Masa Otobe (view profile)

25 Mar 2013 (Updated )

Script used in the Japanese webinar for image processing and computer vision held on Mar. 01, 2013.

S2_3_SURFfeatureMatchingEx.m
```%% Copyright 2013 The MathWorks, Inc.
% This is a script for SURF feature matching.
%
% Original version can be found by the following command
%     web([docroot '/images/examples/find-image-rotation-and-scale-using-automated-feature-matching.html'])
% or in the following URL.
%     http://www.mathworks.com/help/releases/R2012b/images/examples/find-image-rotation-and-scale-using-automated-feature-matching_ja_JP.html

clear all; close all; clc;
%% _x[Xł̃}b`O[Nt[
% 摜[h
I2 = imresize(imrotate(I1,-20), 0.6);   %]AXP[O
figure; imshowpair(I1, I2, 'montage');

%% SURF_̒o
points1 = detectSURFFeatures(I1);
points2 = detectSURFFeatures(I2);

% SURF(f1,f2)o
[f1, vpts1] = extractFeatures(I1, points1);
[f2, vpts2] = extractFeatures(I2, points2);

% 25̓_̏ꏊE̕\
figure; subplot(1,2,1), imshow(I1), hold on;
strongestPoints1 = vpts1.selectStrongest(20);
strongestPoints1.plot('showOrientation',true); hold off;
subplot(1,2,2), imshow(I2), hold on;
strongestPoints2 = vpts2.selectStrongest(20);
strongestPoints2.plot('showOrientation',true); hold off;

%% (f1,f2)̃}b`O
index_pairs = matchFeatures(f1, f2) ;
matched_pts1 = vpts1(index_pairs(:, 1));  % I1̈ʒuo
matched_pts2 = vpts2(index_pairs(:, 2));  % I2̈ʒuo

% }b`Oʕ\   (ꕔ outlier )
figure; showMatchedFeatures(I1,I2,matched_pts1,matched_pts2, 'montage');

```