Main Content


Manage data for structure-from-motion, visual odometry, and visual SLAM


The imageviewset object manages view attributes and pairwise connections between views of data used in structure-from-motion, visual odometry, and simultaneous localization and mapping (SLAM) data. View attributes can be feature descriptors, feature points, or absolute camera poses. Pairwise connections between views can be point matches, relative camera poses, or an information matrix. You can also use this object to find point tracks used by triangulateMultiview and bundleAdjustment functions.




vSet = imageviewset() returns an imageviewset object. You can add views and connections using the addView and addConnection object functions.


expand all

This property is read-only.

View attributes, specified as a three-column table. The table contains columns as described in this table.

ViewIdView identifier for the view, specified as a unique integer
AbsolutePoseAbsolute pose of the view, specified as a rigid3d object.
FeaturesFeature vectors, specified as an M-by-N matrix of M feature vectors or as a binaryFeatures.

Image points, specified as one of these options:

  • M-by-2 matrix of coordinates in the format [x,y]

  • M-element feature point array.

For more details, see Point Feature Types.

This property is read-only.

Pairwise connections between views, specified as a four-column table. The table contains columns as described in this table. Each row corresponds to one connection.

ViewId1View identifier for the first view, specified as a unique integer.
ViewId2View identifier for the second view, specified as a unique integer.
RelativePoseRelative pose of the second view with respect to the first view, specified as a rigid3d or an affine3d object. When you specify an affine3d object, the relative pose must represent a 3-D similarity transformation.
InformationMatrixInformation matrix, specified as a 6-by-6 matrix when you specify the RelativePoseas a rigid3d object. When you specify RelativePose as an affine3d object, InformationMatrix must be a 7-by-7 matrix . The information matrix represents the uncertainty of the measurement error and is the inverse of the covariance matrix.
MatchesIndices of matched feature points between two views, specified as M-by-2 matrix.

This property is read-only.

Number of views, specified as a nonnegative integer.

This property is read-only.

Number of connections, specified as a nonnegative integer.

Object Functions

addViewAdd views to view set
updateViewUpdate view in view set
deleteViewDelete view from view set
hasViewCheck if view is in view set
addConnectionAdd connection between views in view set
updateConnectionUpdate connection between views in a view set
deleteConnectionDelete a connection between views in view set
hasConnectionCheck if connection between two views is in view set
findViewFind views associated with view identifiers
findConnectionFind connections associated with view identifiers
connectedViewsReturn connected views
posesAbsolute poses associated with views in view set
createPoseGraphCreate pose graph
findTracksFind matched points across multiple views
optimizePosesOptimize absolute poses using relative pose constraints
plotPlot view set views and connections


collapse all

Load images in the workspace.

imageDir = fullfile(toolboxdir('vision'),'visiondata','structureFromMotion');
images = imageDatastore(imageDir);

Compute features for the first image.

I = im2gray(readimage(images,1));
pointsPrev = detectSURFFeatures(I);
[featuresPrev,pointsPrev] = extractFeatures(I,pointsPrev);

Create an image view set and add one view to the set.

vSet = imageviewset;
vSet = addView(vSet,1,'Features',featuresPrev,'Points',pointsPrev);

Compute features and matches for the rest of the images.

for i = 2:numel(images.Files)
  I = im2gray(readimage(images, i));
  points = detectSURFFeatures(I);
  [features, points] = extractFeatures(I,points);
  vSet = addView(vSet,i,'Features',features,'Points',points);
  pairsIdx = matchFeatures(featuresPrev,features);
  vSet = addConnection(vSet,i-1,i,'Matches',pairsIdx);
  featuresPrev = features;

Find point tracks across views in the image view set.

tracks = findTracks(vSet);
Introduced in R2020a