Main Content

createPoseGraph

Create pose graph

Since R2020a

Description

example

G = createPoseGraph(vSet) returns a pose graph derived from the views and connections in the view set, vSet.

You can use the pose graph for inspection, modification, visualization, and pose graph optimization.

Examples

collapse all

Create an empty image view set.

vSet = imageviewset;

Define three relative poses.

relPoses = repelem(rigidtform3d,3,1);
relPoses(1).Translation = [3 0 0];
relPoses(2).Translation = [5 0 0];
relPoses(3).Translation = [2 0 0];

Accumulate absolute poses.

absPoses = repelem(rigidtform3d,4,1);
absPoses(2).A = absPoses(1).A*relPoses(1).A;
absPoses(3).A = absPoses(2).A*relPoses(2).A;
absPoses(4).A = absPoses(3).A*relPoses(3).A;

Add four views to the image view set.

vSet = addView(vSet,1,absPoses(1));
vSet = addView(vSet,2,absPoses(2));
vSet = addView(vSet,3,absPoses(3));
vSet = addView(vSet,4,absPoses(4));

Add three connections to the image view set.

vSet = addConnection(vSet,1,2,relPoses(1));
vSet = addConnection(vSet,2,3,relPoses(2));
vSet = addConnection(vSet,3,4,relPoses(3));

Add a loop closure connection to the image view set.

relPoses(4).Translation = [9 0 0];
vSet = addConnection(vSet,4,1,relPoses(4));

Create a pose graph.

G = createPoseGraph(vSet)
G = 
  digraph with properties:

    Edges: [4x4 table]
    Nodes: [4x2 table]

Input Arguments

collapse all

View set, specified as an imageviewset object.

Output Arguments

collapse all

Pose graph, returned as a digraph object. The nodes in the object correspond to views, and the edges in the object correspond to connections.

The EndNodes of the Edges in the G digraph correspond to indices into the Views table, (not ViewIds).

Tips

  • The EndNodes of the Edges in the G digraph correspond to indices into the Views table, (not ViewIds).

  • Use Directed and Undirected Graphs to inspect, modify, or visualize the pose graph.

  • Use the optimizePoseGraph (Navigation Toolbox) function to optimize the pose graph. Use of this function requires the Navigation Toolbox™.

Extended Capabilities

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

Version History

Introduced in R2020a

See Also

Functions

Objects