Main Content


Add connection between views in view set



vSet = addConnection(vSet,viewId1,viewId2) adds a connection between views viewId1 and viewId2 to the view set, vSet.

vSet = addConnection(vSet,viewId1,viewId2,relPose) specifies the relative pose of viewId2 with respect to viewId1.

vSet = addConnection(vSet,viewId1,viewId2,relPose,infoMat) specifies the information matrix associated with the connection.

vSet = addConnection(___,'Matches',featureMatches) specifies the indices of matched points between two views in addition to any of the input argument combinations in previous syntaxes.


collapse all

Create an empty image view set.

vSet = imageviewset;

Read two images into the workspace.

imageDir = fullfile(toolboxdir('vision'),'visiondata', ...
I1 = im2gray(imread(fullfile(imageDir,'image1.jpg')));
I2 = im2gray(imread(fullfile(imageDir,'image2.jpg')));

Detect interest points in each image.

points1 = detectSURFFeatures(I1);
points2 = detectSURFFeatures(I2);

Extract feature descriptors from the interest points.

[features1,validPoints1] = extractFeatures(I1,points1);
[features2,validPoints2] = extractFeatures(I2,points2);

Add the features and points for the two images to the image view set.

vSet = addView(vSet,1,'Features',features1,'Points',validPoints1);
vSet = addView(vSet,2,'Features',features2,'Points',validPoints2);

Match the features between the two images.

indexPairs = matchFeatures(features1,features2);

Store the matched features as a connection in the image view set.

vSet = addConnection(vSet,1,2,'Matches',indexPairs);

Input Arguments

collapse all

Image view set, specified as an imageviewset object.

View identifier 1, specified as an integer. View identifiers are unique to a specific view.

View identifier 2, specified as an integer. View identifiers are unique to a specific view.

Relative pose of viewId2 with respect to viewId1, specified as a rigid3d or an affine3d object.

Information matrix associated with the connection, specified as a 6-by-6 numeric matrix.

Indices of matched points between two views, specified as an M-b-2 matrix.

Output Arguments

collapse all

View set with added connections between views, returned as an imageviewset object.

Introduced in R2020a