Skip to content

Fix StereoFromMotion words3D indexing for RGB-only input - #1798

Merged
matlabbe merged 6 commits into
introlab:masterfrom
Miller2018:fix/stereofrommotion-words3d-indexing
Oct 19, 2026
Merged

matlabbe merged 6 commits into
introlab:masterfrom
Miller2018:fix/stereofrommotion-words3d-indexing

Conversation

@Miller2018

Copy link
Copy Markdown
Contributor

Fix StereoFromMotion 3D-word indexing on RGB-only input

Fixes #1797.

Problem

With Mem/StereoFromMotion=true on RGB-only input, Memory::createSignature filled words3D
via push_back while iterating the words multimap (word-id order), so words3D[i] did not
belong to kptIdx i. Every consumer (DBDriverSqlite3.cpp:4624, RegistrationVis) indexes
words3D by kptIdx, so loop-closure PnP always produced 0 inliers
(Not enough inliers 0/20 (matches=N)), making loop closure unusable.

Fix

In the words3DWasEmpty branch, pre-size words3D to words.size() with NaN, then use the
same words3D[iter->second] = jter->second write as the non-empty branch. No behavior change
for RGB-D/stereo input (non-empty path untouched).

if(words3DWasEmpty)
{
    words3D.resize(words.size(), cv::Point3f(bad_point,bad_point,bad_point));
}

Validation

  • Real 12-min indoor RGB-only dataset (external VIO odometry, rtabmap 0.23.7):
    loop 3→63 PnP goes 0/97 → 48/65 inliers (0.65 px reprojection); the run logged
    Not enough inliers 0/20 (matches=43) before the fix.
  • Root-cause probe + raw measurements can be shared on request (see issue).
  • Patch applies cleanly on master and 0.23.7 (git apply --check).

…ller2018/rtabmap into Miller2018-fix/stereofrommotion-words3d-indexing
matlabbe
matlabbe previously approved these changes Oct 18, 2026

@matlabbe matlabbe left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM! Thanks for the PR

@Miller2018
Miller2018 dismissed matlabbe’s stale review October 18, 2026 21:28

The merge-base changed after approval.

@matlabbe
matlabbe changed the base branch from master to rolling-devel October 18, 2026 21:29
@matlabbe
matlabbe changed the base branch from rolling-devel to master October 18, 2026 21:29
matlabbe
matlabbe previously approved these changes Oct 18, 2026
@matlabbe
matlabbe merged commit 8091a10 into introlab:master Oct 19, 2026
33 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

StereoFromMotion misindexes words3D on RGB-only input → loop-closure PnP always 0 inliers

2 participants