NikolausDemmel/rootba

Why inverse the coordinate to add pertubation

Closed this issue · 2 comments

Hi Nikolaus,

In the code file bal_problem.cpp, there is a inversion transformation to add perturbation, so as to add noise in camera 2 world coordinate I think, My question is that is it necessary to do the transformation? What is the motivation to do this step?

Bests

Reference code

if (rotation_sigma > 0 || translation_sigma > 0) {
    for (auto& cam : cameras_) {
      // perturb camera center in world coordinates
      if (translation_sigma > 0) {
        SE3 T_w_c = cam.T_c_w.inverse();
        T_w_c.translation() += perturbation<Scalar, 3>(translation_sigma, eng);
        cam.T_c_w = T_w_c.inverse();
      }
      // local rotation perturbation in camera frame
      if (rotation_sigma > 0) {
        cam.T_c_w.so3() =
            SO3::exp(perturbation<Scalar, 3>(rotation_sigma, eng)) *
            cam.T_c_w.so3();
      }
    }
  }

IIRC it's just to literally do what the documentation says, i.e. perturb the position of the camera.

But you are right, we could also perturb the translation of T_c_w directly. Compared to perturbing the translation T_w_c there would be a rotation of the noise (and also negation). Since the noise is (almost) isotropic, it should not make a significant difference IMHO.

Thank you for your explaination, still, this inversion operation makes the code look more precise, because we should add noise in the camera coordinate.