Main Content

viewSet

(To be removed) Object for managing data for structure-from-motion and visual odometry

    The viewSet object will be removed in a future release. Use the imageviewset object instead. For more information, see Version History.

    Description

    A viewSet object 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 the triangulateMultiview and bundleAdjustment functions.

    Creation

    Description

    vSet = viewSet creates an empty viewSet object. You can add views and connections using the addView and addConnection object functions.

    example

    Properties

    expand all

    This property is read-only.

    Number of views, stored as an integer.

    This property is read-only.

    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.

    This property is read-only.

    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.

    Object Functions

    addConnection(To be removed) Add connection between two views
    addView(To be removed) Add new view to view set object
    deleteConnection(To be removed) Delete connection between two views from view set object
    deleteView(To be removed) Delete existing view from view set object
    findTracks(To be removed) Find matched points across multiple views
    hasConnection(To be removed) Check if connection exists between two views
    hasView(To be removed) Check if view exists
    poses(To be removed) Returns camera poses associated to views
    updateConnection(To be removed) Modify connection between two views in view set object
    updateView(To be removed) Modify existing view in view set object

    Examples

    collapse all

    Load images.

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

    Compute features for the first image.

    I = rgb2gray(read(imds));
    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:length(imds.Files)
     I = rgb2gray(read(imds));
     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);

    Version History

    Introduced in R2016a

    collapse all

    R2020a: viewSet object will be removed

    The viewSet object will be removed in a future release. Manage views and pairwise connections between views of data using the imageviewset object instead. The imageviewset object adds additional support for simultaneous localization and mapping (SLAM) data,

    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.