Main Content

updateLimitsAndDirection

Update distance limits and viewing direction

Since R2022b

Description

example

wpSet = updateLimitsAndDirection(wpSet,pointIndices,viewTable) updates the distance limits and viewing direction of world points in the world point set object, wpSet. The viewing direction is based on a table of views, viewTable. pointIndices is the index to the world point related to the update. Use this syntax if you added points using the addWorldPoints function without specifying unique point identifiers pointIds.

wpSet = updateLimitsAndDirection(wpSet,pointIds,viewTable) updates the distance limits and viewing direction of world points in the world point set object, wpSet. The viewing direction is based on a table of views, viewTable. pointIds is the point identifier to the world point related to the update. Use this syntax if you added points using the addWorldPoints function by specifying unique point identifiers pointIds.

Examples

collapse all

Create a worldpointset object and add world points and correspondences for view 1 and view 2.

wpSet = worldpointset;
worldPoints = rand(10,3);
wpSet = addWorldPoints(wpSet,worldPoints);
pointIndices = 1:10;
featureIndices = 1:10;
viewId1 = 1;
wpSet = addCorrespondences(wpSet,viewId1,pointIndices,featureIndices);
viewId2 = 2;
wpSet = addCorrespondences(wpSet,viewId1,pointIndices,featureIndices);

Create an imageviewset object and add views and poses to the set. Add a translation in the x-axis for pose 2.

vSet  = imageviewset;
pose1 = rigidtform3d;
vSet  = addView(vSet, viewId1, pose1);
pose2 = rigidtform3d([0 0 0],[1 0 0]);
vSet  = addView(vSet,viewId2,pose2);

Update the distance limit and viewing direction.

viewTable = findView(vSet,[viewId1,viewId2]);
wpSet = updateLimitsAndDirection(wpSet,pointIndices,viewTable);

Check distance limits and viewing direction.

wpSet.ViewingDirection
ans = 10x3 single matrix

    0.7703    0.1490    0.6200
    0.6820    0.7308    0.0269
    0.0988    0.7444    0.6604
    0.6554    0.3483    0.6702
    0.5161    0.6532    0.5540
    0.1255    0.1826    0.9751
    0.3099    0.4693    0.8269
    0.4812    0.8058    0.3451
    0.6815    0.5638    0.4665
    0.7035    0.6996    0.1248

wpSet.DistanceLimits
ans = 10x2 single matrix

    1.0576    1.0576
    1.3281    1.3281
    1.2858    1.2858
    1.3936    1.3936
    1.2252    1.2252
    0.7771    0.7771
    0.8987    0.8987
    1.1364    1.1364
    1.4050    1.4050
    1.3715    1.3715

Create a worldpointset object and add world points and correspondences for view 1 and view 2.

wpSet = worldpointset;
worldPoints = rand(10,3);
pointIds = randperm(10);
wpSet = addWorldPoints(wpSet,worldPoints,pointIds);
featureIndices = 1:10;
viewId1 = 1;
wpSet = addCorrespondences(wpSet,viewId1,pointIds(1:10),featureIndices);
viewId2 = 2;
wpSet = addCorrespondences(wpSet,viewId1,pointIds(1:10),featureIndices);

Create an imageviewset object and add views and poses to the set. Add a translation in the x-axis for pose 2.

vSet  = imageviewset;
pose1 = rigidtform3d;
vSet  = addView(vSet, viewId1, pose1);
pose2 = rigidtform3d([0 0 0],[1 0 0]);
vSet  = addView(vSet,viewId2,pose2);

Update the distance limit and viewing direction.

viewTable = findView(vSet,[viewId1,viewId2]);
wpSet = updateLimitsAndDirection(wpSet,pointIds(1:10),viewTable);

Check distance limits and viewing direction.

wpSet.ViewingDirection
ans = 10x3 single matrix

    0.7703    0.1490    0.6200
    0.6820    0.7308    0.0269
    0.0988    0.7444    0.6604
    0.6554    0.3483    0.6702
    0.5161    0.6532    0.5540
    0.1255    0.1826    0.9751
    0.3099    0.4693    0.8269
    0.4812    0.8058    0.3451
    0.6815    0.5638    0.4665
    0.7035    0.6996    0.1248

wpSet.DistanceLimits
ans = 10x2 single matrix

    1.0576    1.0576
    1.3281    1.3281
    1.2858    1.2858
    1.3936    1.3936
    1.2252    1.2252
    0.7771    0.7771
    0.8987    0.8987
    1.1364    1.1364
    1.4050    1.4050
    1.3715    1.3715

Input Arguments

collapse all

World point set, specified as a worldpointset object.

Point index, specified as an M-element column vector of integers, where M is the number of world points. The function updates the distance limits and viewing direction of the point that corresponds to the specified index. Use this input when sequential indices are used for the points in the wpSet object.

World point identifiers, returned as an M-element vector of integers. M is the number of world points. The function updates the distance limits and viewing direction of the point that corresponds to the specified point identifier. Use this input when points were added using addWorldPoints.

One or more connected or indirectly connected views, specified as a four-column table. The table must contain the 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.

Output Arguments

collapse all

World point set, returned as a worldpointset object.

Extended Capabilities

C/C++ Code Generation
Generate C and C++ code using MATLAB® Coder™.

Version History

Introduced in R2022b