mapillary / mapillary/OpenSfM

it seems a bug in align_two_reconstruction

Open
#619 2 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

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

Description

It seems a bug here:

def align_two_reconstruction(r1, r2, common_tracks, threshold):
"""Estimate similarity transform between two reconstructions."""
t1, t2 = r1.points, r2.points

if len(common_tracks) > 6:

<<<<<<<<<<<<<
p1 = np.array([t1[t[0]].coordinates for t in common_tracks])
p2 = np.array([t2[t[1]].coordinates for t in common_tracks])
<<<<<<<<<<<<<

I think it should be:
p1 = np.array([t1[t].coordinates for t in common_tracks])
p2 = np.array([t2[t].coordinates for t in common_tracks])
here, t stands for the common shot id

    # 3 samples / 100 trials / 50% outliers = 0.99 probability
    # with probability = 1-(1-(1-outlier)^model)^trial
    T, inliers = multiview.fit_similarity_transform(
        p1, p2, max_iterations=100, threshold=threshold)
    if len(inliers) > 0:
        return True, T, inliers
return False, None, None

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 at align_two_reconstruction and inspect how common_tracks is represented and consumed by multiview.fit_similarity_transform. Verify whether each entry is a common shot ID or a pair of IDs, then confirm the corrected indexing produces valid similarity-transform inputs and preserves the function's success and inlier behavior.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
computer-vision
Issue type
Bug
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
48/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.