Skip to article frontmatterSkip to article content
Site not loading correctly?

This may be due to an incorrect BASE_URL configuration. See the MyST Documentation for reference.

ShonanAveraging

Created by Codex.

Implement the common staircase relaxation and optimality-certificate machinery for Shonan rotation averaging.

Open In Colab

Mathematical idea

Rotation averaging seeks absolute rotations whose relative rotations agree with measurements:

minRiSO(d)(i,j)RiRijRjF2.\min_{R_i\in\mathrm{SO}(d)}\sum_{(i,j)} \left\lVert R_iR_{ij}-R_j\right\rVert_F^2.

SO(d)\mathrm{SO}(d) is the special orthogonal group. Shonan averaging lifts the problem from SO(d)\mathrm{SO}(d) to successively larger SO(p)\mathrm{SO}(p) manifolds, searches for a certifiable optimum, and rounds the lifted solution back to dimension dd.

import gtsam
import numpy as np

from gtsam import symbol_shorthand

C = symbol_shorthand.C
K = symbol_shorthand.K
P = symbol_shorthand.P
S = symbol_shorthand.S
X = symbol_shorthand.X

Purpose and availability

ShonanAveraging<d> is the templated C++ implementation shared by the concrete ShonanAveraging2 and ShonanAveraging3 interfaces. It builds and optimizes problems on increasing SO(p) levels, checks the minimum eigenvalue certificate, descends through a negative-curvature direction when needed, and rounds a lifted solution back to rotations.

Use the concrete classes in application code. The base template itself is not directly exposed in Python.

C++ sketch

#include <gtsam/sfm/ShonanAveraging.h>

using namespace gtsam;

ShonanAveragingParameters<3> parameters;
ShonanAveraging<3>::Measurements measurements = /* relative Rot3 edges */;
ShonanAveraging<3> shonan(measurements, parameters);

auto [rotations, certificate] = shonan.run(/* minP = */ 3,
                                           /* maxP = */ 10);

In ordinary code prefer ShonanAveraging3, which provides the same main API and stable explicit template instantiation.