Main Content

imageviewset

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

Since R2020a

Description

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.

Creation

Description

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

example

Properties

expand all

This property is read-only.

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

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

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.

ColumnDescription
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 rigidtform3d or simtform3d object.
InformationMatrixInformation matrix, specified as a 6-by-6 matrix (when you specify RelativePose as a rigidtform3d object) or 7-by-7 matrix (when you specify RelativePose as a simtform3d object). 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
connectedViewsReturns directly and indirectly 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 image view set views and connections

Examples

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;
end

Find point tracks across views in the image view set.

tracks = findTracks(vSet);

Extended Capabilities

Version History

Introduced in R2020a

expand all