注:此次实现中用到的函数需要在matlab2013后的版本才能正常运行,故顺手附上matlab2014b下载地址: http://download.csdn.net/detail/lrrent/9499859
close all;
clear all;
clc;
boxImage = imread('2_2.jpg');
sceneImage = imread('2.jpeg');
sceneImage = rgb2gray(sceneImage);
boxImage = rgb2gray(boxImage);
boxPoints = detectSURFFeatures(boxImage);
scenePoints = detectSURFFeatures(sceneImage);
[boxFeatures,boxPoints] = extractFeatures(boxImage,boxPoints);
[sceneFeatures,scenePoints] = extractFeatures(sceneImage,scenePoints);
boxPairs = matchFeatures(boxFeatures,sceneFeatures);
% display putatively matched features
matchedBoxPoints = boxPoints(boxPairs(:,1),:);
matchedScenePoints = scenePoints(boxPairs(:,2),:);
fi