mapillary / mapillary/OpenSfM

Doubt regarding apply_similarity_pose function

Open
#836 2 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 a doubt regarding the function "apply_similarity_pose" in align.py
So given a transform from Camera world to similarity world, this function computes the reverse.
So the existing inverse function is calculated as ,

Rp = R.dot(A.T)
tp = -Rp.dot(b) + s * t

But according to derivation, the inverse function looks like

Rp = (R/s).dot(A.T)
tp = -Rp.dot(b) + t

An example for verification:
Lets assume,

R = A = I(3x3)
b = t = [0, 0, 0]
s = 2

Basically, there is only a scale difference between similarity and camera world. So coordinates in similarity world is obtained by just multiplying 2 with camera coordinates

Now according to the formula in align.py
Rp becomes I(3x3).dot(I(3x3)) = I(3x3)
tp becomes -[0, 0, 0] + s * [0, 0, 0] = [0, 0, 0]
With this Rp, tp the coordinates in similarity world coordinates remains same during Similarity->Camera world conversion and is not scaled down. With the formula that I have posted the similarity world coordinates gets scaled down appropriately.

So Am I missing something in this calculation such that the existing calculation in align.py is correct?. Or is the scale neglected ? since down the pipeline we usually use a normalised unit scale point to do triangulation?

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 in align.py at apply_similarity_pose and trace how the camera-world to similarity-world transform is represented and consumed downstream. Reproduce the identity-and-scale example from the issue, compare both inverse formulas, and verify the expected coordinate scale before documenting or correcting the behavior.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
computer-vision
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.