optimizePoses

Optimize absolute poses using relative pose constraints

Description

example

vSetOptim = optimizePoses(vSet) returns an image view set whose absolute poses are optimized. vSetOptim and vSet are imageviewset objects.

The optimizePoses function performs pose graph optimization on the absolute poses for the Views in the view set using the relative pose constraints established by the Connections property. You can use optimizePoses to correct drift in odometry after detecting loop closures.

vSetOptim = optimizePoses(vSet, minNumMatches) additionally specifies the minimum number of matched feature points in a connection in order for the connection to be included in optimization.

vSetOptim = optimizePoses(___,Name,Value) uses additional options specified by one or more Name,Value pair arguments.

Examples

collapse all

Create a view set.

vSet = imageviewset;

Add four nodes and specify absolute poses.

absPoses = repelem(rigid3d, 4, 1);  

absPoses(1).Translation = [ 0   0 0];
absPoses(2).Translation = [ 1   0 0];
absPoses(3).Translation = [ 2   0 0];
absPoses(4).Translation = [ 0.1 0 0];

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

Define 4 edges, 3 odometry and 1 loop closure.

relPoses = repelem(rigid3d, 4, 1);

relPoses(1).Translation = [ 1   0 0];
relPoses(2).Translation = [ 1   0 0];
relPoses(3).Translation = [-1.9 0 0];
relPoses(4).Translation = [ 0.2 0 0];

vSet = addConnection(vSet, 1, 2, relPoses(1)); % odometry
vSet = addConnection(vSet, 2, 3, relPoses(2)); % odometry
vSet = addConnection(vSet, 3, 4, relPoses(3)); % odometry
vSet = addConnection(vSet, 4, 1, relPoses(4)); % loop closure

Optimize view set.

vSetOptim = optimizePoses(vSet);

DIsplay original and optimized locations.

disp('Original absolute translations:')
Original absolute translations:
disp(vertcat(vSet.Views.AbsolutePose.Translation))
         0         0         0
    1.0000         0         0
    2.0000         0         0
    0.1000         0         0
disp('Optimized absolute translations:')
Optimized absolute translations:
disp(vertcat(vSetOptim.Views.AbsolutePose.Translation))
         0         0         0
    0.9250         0         0
    1.8500         0         0
   -0.1250         0         0

Input Arguments

collapse all

Image view set, specified as an imageviewset object.

Minimum number of connections, specified as a positive integer. Set minNumMatches to the minimum number of matched feature points in a connection for the connection to be included in optimization.

Name-Value Pair Arguments

Specify optional comma-separated pairs of Name,Value arguments. Name is the argument name and Value is the corresponding value. Name must appear inside quotes. You can specify several name and value pair arguments in any order as Name1,Value1,...,NameN,ValueN.

Example: 'MaxIterations',300

Maximum number of iterations before optimization is terminated, specified as the comma-separated pair consisting of 'MaxIterations' and a positive integer. Increase this value for more accurate results. Decrease this value for faster results.

Tolerance of the optimization cost function between two iterations, specified as the comma-separated pair consisting of 'Tolerance' and a positive scalar. Optimization is terminated when the cost function changes by less than the Tolerance value between two iterations.

Display progress information, specified as the comma-separated pair consisting of Verbose and a logical scalar. Set 'Verbose' to true to display progress information.

Output Arguments

collapse all

Image view set that contains optimized absolute poses, specified as an imageviewset object.

Tips

  • To update a view set with optimized poses, use the updateView object function.

  • The optimizePoses object function holds the first view fixed.

Algorithms

The optimizePoses function uses the Levenberg Marquardt optimization algorithm with sparse Cholesky factorization from the general (hyper) graph optimization (g2o) library, (1).

References

[1] Kuemmerle, R., G. Grisetti, H. Strasdat, K. Konolige, and W. Burgard. "g2o: A General Framework for Graph Optimization IEEE International Conference on Robotics and Automation". Proceedings of the IEEE International Conference on Robotics and Automation, ICRA, 2011.

See Also

Functions

Objects

Introduced in R2020a