mapillary / mapillary/OpenSfM

Question about scale information in Global Bundle Adjustment

Open
#973 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Python
Stars
3.8k
Forks
899
PR merge metrics
No merged PRs in 30d

Description

I have some doubts when using openSfM for global BA, BA is a 7-dofs problem with 3 axes, 3 rotations scale. If the Pose of some of the images is not fixed in BA only through images, the scale of the whole scene may change after BA. So similar to colmap, it fixes the Pose of the first camera and the translation x component between the two cameras, which will introduce scale information. I didn't find out which parts of the global BA are fixed by the rig instance model of openSfM, There is actually a function "SetGaugeFixShots" in bundle_adjuster.cc and AddTranslationPriorError into problem, but I found that it was not used in the reconstruction. I hope you can give me some inspiration。

void BundleAdjuster::SetGaugeFixShots(const std::string &shot_origin,
                                      const std::string &shot_scale) {
  Shot *shot = &shots_.at(shot_origin);
  shot->GetRigInstance()->SetParametersToOptimize({});
  gauge_fix_shots_.SetValue(std::make_pair(shot_origin, shot_scale));
}
// Gauge fix
if (gauge_fix_shots_.HasValue()) {
  const auto &gauge_shots = gauge_fix_shots_.Value();
  auto instance1 = shots_.at(gauge_shots.first).GetRigInstance();
  auto instance2 = shots_.at(gauge_shots.second).GetRigInstance();
  const double norm =
      (instance1->GetValue().GetOrigin() - instance2->GetValue().GetOrigin())
          .norm();

  ceres::CostFunction *cost_function =
      new ceres::AutoDiffCostFunction<TranslationPriorError, 1, 6, 6>(
          new TranslationPriorError(norm));

  problem.AddResidualBlock(cost_function, nullptr,
                           instance1->GetValueData().data(),
                           instance2->GetValueData().data());
}

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by tracing the reconstruction path that configures global bundle adjustment and inspect bundle_adjuster.cc, especially SetGaugeFixShots and AddTranslationPriorError. Compare those call paths with the rig instance model and determine whether gauge and scale constraints are applied. Done means documenting the current scale behavior and identifying the concrete change needed, if any.

Written by the indexing model from the issue text.

Assessment

Tech stack
cpp, python
Domain
computer-vision
Issue type
Bug
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.