Main Content


(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 Compatibility Considerations.


    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.




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


    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


    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;

    Find point tracks.

    tracks = findTracks(vSet);

    Compatibility Considerations

    expand all

    Not recommended starting in R2020a

    Introduced in R2016a