Main Content

addConnection

(To be removed) Add connection between two views

The viewSet object and its addConnection function will be removed in a future release. Use the imageviewset object and its addConnection function instead. For more information, see Compatibility Considerations.

Description

vSet = addConnection(vSet,viewId1,viewId2) adds a connection between two views in the specified viewSet object, vSet.

example

vSet = addConnection(vSet,viewId1,viewId2,Name,Value) specifies additional options using one or more name-value pair arguments.

Examples

collapse all

Create an empty viewSet object.

vSet = viewSet;

Read a pair of images.

imageDir = fullfile(toolboxdir('vision'),'visiondata','structureFromMotion');
I1 = im2gray(imread(fullfile(imageDir,'image1.jpg')));
I2 = im2gray(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);

Input Arguments

collapse all

viewSet object.

View ID 1 in the viewSet object, specified as an integer.

View ID 2 in the viewSet object, specified as an integer.

Name-Value Arguments

Specify optional comma-separated pairs of Name,Value arguments. Name is the argument name and Value is the corresponding value. Name must appear inside quotes. You can specify several name and value pair arguments in any order as Name1,Value1,...,NameN,ValueN.

Example: 'Location','[0,0,0]'

Indices of matched points between two views, specified as the comma-separated pair consisting of 'Matches' and an M-by-2 matrix.

Orientation of the second camera relative to the first camera, specified as the comma-separated pair consisting of 'Orientation' and a 3-by-3 matrix that represents the [x,y,z] orientation of the second camera.

Location of the second camera relative to the first camera, specified as the comma-separated pair consisting of 'Location' and a three-element vector that represents the [x,y,z] location of the second camera in the first camera’s coordinate system.

Output Arguments

collapse all

viewSet object.

Compatibility Considerations

expand all

Not recommended starting in R2020a

Introduced in R2016a