Created by Codex.
Use a per-edge scale variable to express a Bilinear Angle-based Translation Averaging (BATA) direction residual.
Mathematical idea¶
For translations and a measured unit direction , the factor introduces one inverse-baseline scale and uses
BATA means Bilinear Angle-based Translation Averaging. The auxiliary scale avoids differentiating the normalized baseline . The formulation comes from Zhuang, Cheong, and Lee, Baseline Desensitizing in Translation Averaging, IEEE/CVF Conference on Computer Vision and Pattern Recognition (CVPR), 2018.
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.XModel and availability¶
The residual is abs(scale) * (T_b - T_a) - measured_direction. This avoids normalization and follows the Bilinear Angle-based Translation Averaging (BATA) formulation. Each observation needs its own scalar scale key.
The class is currently C++-only. Python users obtain it through LocationRecovery.buildGraph(edges, bilinear=True).
C++ example¶
#include <gtsam/sfm/TranslationFactor.h>
using namespace gtsam;
const auto noise = noiseModel::Isotropic::Sigma(3, 0.01);
BilinearAngleTranslationFactor factor(
Symbol('t', 0), Symbol('t', 1), Symbol('S', 0),
Unit3(1.0, 0.0, 0.0), noise);
const Vector3 residual = factor.evaluateError(
Point3(0, 0, 0), Point3(2, 0, 0), Vector1(0.5));
// residual is zero because 0.5 * (2, 0, 0) == (1, 0, 0).Because sign is removed with abs(scale), initialize scales away from zero for informative derivatives.