viewSet class

Object for managing data for structure-from-motion and visual odometry

Syntax

vSet = viewSet

Description

Note

The viewSet object will be removed in a future release. Use the imageviewset object instead.

vSet = viewSet returns an empty viewSet object that stores views and connections between views. A view includes feature points and an absolute camera pose. A connection between two views includes point correspondences and the relative camera pose between them. Once you populate a viewSet object, you can use it to find point tracks across multiple views and retrieve the camera poses to be used by triangulateMultiview and bundleAdjustment functions.

Code Generation Support:
Supports Code Generation: No
Supports MATLAB Function block: No
Code Generation Support, Usage Notes, and Limitations

Properties

expand all

These properties are read-only.

Number of views, stored as an integer.

View attributes, stored as a four-column table. The table contains columns for ViewID, Points, Orientation, and Location. Use the poses method to obtain the IDs, orientation, and location for the points.

Pairwise connections between views, stored as a five-column table. The columns are ViewID1, ViewID2, Matches, RelativeOrientation, and RelativeLocation. The number of entries in the table represent the number of connections. Each index in the Matches column represents a connection between the two views indicated by the view IDs.

Output Arguments

expand all

viewSet object used to store views and connections between the views.

Methods

addConnectionAdd a connection between two views
addViewAdd a new view to view set object
deleteConnectionDelete a connection between two views from view set object
deleteViewDelete an existing view from view set object
findTracksFind matched points across multiple views
hasConnectionCheck if a connection exists between two views
hasViewCheck if view exists
posesReturns camera poses associated to views
updateConnectionModify a connection between two views in a view set object
updateViewModify an existing view in a view set object

Examples

collapse all

Load images.

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

Compute features for the first image.

I = rgb2gray(read(images, 1));
pointsPrev = detectSURFFeatures(I);
[featuresPrev,pointsPrev] = extractFeatures(I,pointsPrev);

Create a viewSet object.

vSet = viewSet;
vSet = addView(vSet,1,'Points',pointsPrev);

Compute features and matches for the rest of the images.

for i = 2:images.Count
 I = rgb2gray(read(images,i));
 points = detectSURFFeatures(I);
 [features, points] = extractFeatures(I,points);
 vSet = addView(vSet,i,'Points',points);
 pairsIdx = matchFeatures(featuresPrev,features);
 vSet = addConnection(vSet,i-1,i,'Matches',pairsIdx);
 featuresPrev = features;
end

Find point tracks.

tracks = findTracks(vSet);
Introduced in R2016a