www.gusucode.com > vision 源码程序 matlab案例代码 > vision/AddConnectionBetweenTwoViewsInAViewSetObjectExample.m
%% Add Connection Between Two Views in View Set Object % %% % Create an empty |viewSet| object. vSet = viewSet; %% % Read a pair of images. imageDir = fullfile(toolboxdir('vision'),'visiondata','structureFromMotion'); I1 = rgb2gray(imread(fullfile(imageDir,'image1.jpg'))); I2 = rgb2gray(imread(fullfile(imageDir,'image2.jpg'))); %% % Detect interest points in the two images. points1 = detectSURFFeatures(I1); points2 = detectSURFFeatures(I2); %% % Add the points to the |viewSet| object. vSet = addView(vSet,1,'Points',points1); vSet = addView(vSet,2,'Points',points2); %% % Extract feature descriptors from both images. features1 = extractFeatures(I1,points1); features2 = extractFeatures(I2,points2); %% % Match features and store the matches. indexPairs = matchFeatures(features1,features2); %% % Add the connection between the two views. vSet = addConnection(vSet,1,2,'Matches',indexPairs);