Main Content

connectedViews

Returns directly and indirectly connected views

Since R2020a

Description

example

viewTable = connectedViews(vSet,viewId) returns a table of views from vSet that are connected and indirectly connected to the view specified by viewId.

[viewTable,dist] = connectedViews(___) also returns the distances between the viewId view and each view in viewTable.

viewTable = connectedViews(vSet,viewId,Name=Value) specifies options using one or more name-value arguments in addition to any combination of arguments from previous syntaxes For example, MaxDistance=1 additionally sets the distance between two connected views.

Examples

collapse all

Create an empty imageviewset object.

vSet = imageviewset;

Add views to the image view set.

pose1 = rigidtform3d;
vSet = addView(vSet,1,pose1,Features=rand(10,3),Points=rand(10,2));
pose2 = rigidtform3d([0 0 0],[1 0 0]);
vSet = addView(vSet,2,pose2,Features=rand(10,3),Points=rand(10,2));
pose3 = rigidtform3d([0 0 0],[2 0 0]);
vSet = addView(vSet,3,pose3,Features=rand(10,3),Points=rand(10,2));
pose4 = rigidtform3d([0 0 0],[0 1 0]);
vSet = addView(vSet,4,pose4,Features=rand(10,3),Points=rand(10,2));
pose5 = rigidtform3d([0 0 0],[0 -1 0]);
vSet = addView(vSet,5,pose5,Features=rand(10,3),Points=rand(10 ,2));

Connect views in the image view set.

vSet = addConnection(vSet,1,2,Matches=[1 2; 2 3; 3 4; 4 5]);
vSet = addConnection(vSet,2,3,Matches=[1 2; 2 3; 3 4]);
vSet = addConnection(vSet,2,4,Matches=[4 1]);
vSet = addConnection(vSet,3,4,Matches=[4 1]);
vSet = addConnection(vSet,1,5,Matches=[1 2; 4 1]);

Display the view set with view IDs.

plot(vSet,ShowViewIds="on");

Figure contains an axes object. The axes object contains an object of type graphplot.

Get the strongly connected views of view 2 with the at least 3 matched feature points.

viewTableStrong = connectedViews(vSet,2,MinNumMatches=3)
viewTableStrong=2×4 table
    ViewId      AbsolutePose        Features          Points    
    ______    ________________    _____________    _____________

      1       1×1 rigidtform3d    {10×3 double}    {10×2 double}
      3       1×1 rigidtform3d    {10×3 double}    {10×2 double}

Get views with maximum distance of 2, within view 3.

[viewTableNeaby,dist] = connectedViews(vSet,3,MaxDistance=2)
viewTableNeaby=3×4 table
    ViewId      AbsolutePose        Features          Points    
    ______    ________________    _____________    _____________

      2       1×1 rigidtform3d    {10×3 double}    {10×2 double}
      4       1×1 rigidtform3d    {10×3 double}    {10×2 double}
      1       1×1 rigidtform3d    {10×3 double}    {10×2 double}

dist = 3×1

     1
     1
     2

Input Arguments

collapse all

Image view set, specified as an imageviewset object.

View identifier, specified as an integer. View identifiers are unique to a specific view.

Name-Value Arguments

Specify optional pairs of arguments as Name1=Value1,...,NameN=ValueN, where Name is the argument name and Value is the corresponding value. Name-value arguments must appear after other arguments, but the order of the pairs does not matter.

Before R2021a, use commas to separate each name and value, and enclose Name in quotes.

Example: MaxDistance=2 sets the distance between two connected views to 2.

Maximum distance between connected views and the view that corresponds to viewId, specified as a positive integer. The distance between any two connected views must be equal to 1. To find indirectly connected views, set MaxDistance to a value greater than 1.

Minimum number of matched feature points in a connection for the view to be counted as a connected view, specified as a nonnegative integer.

Output Arguments

collapse all

One or more connected or indirectly connected views, returned as a three-column table. The table must contain the columns as described in this table.

ColumnDescription
ViewID

View identifier, specified as an integer. View identifiers are unique to a specific view.

AbsolutePoseAbsolute pose of the view, specified as a rigidtform3d object.
PointsPoint cloud for the view, specified as a pointCloud object.

By default, the function returns only directly connected views. The distance between any two directly connected views must be equal to 1. To find indirectly connected views, set the MaxDistance name-value argument to a value greater than 1.

Distance between the view identified in viewID and each view in the view table viewTable, specified as an M-by-1 vector of positive integers.

Extended Capabilities

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

Version History

Introduced in R2020a

expand all

Query indirectly-connected camera views in an imageviewset

Added a new Name-Value argument, MaxDistance. Use MaxDistance to find indirectly-connected views by setting it to a value greater than 1.

See Also

Objects