Skip to content

fix: keep the inlier status of a FeatureMatch an array when it is indexed - #265

Merged
petercorke merged 2 commits into
mainfrom
bug/featurematch-inliers
Nov 23, 2026
Merged

petercorke merged 2 commits into
mainfrom
bug/featurematch-inliers

Conversation

@petercorke

Copy link
Copy Markdown
Owner

Fixes bug list item 34, found while typing ImagePointFeatures.py (Issue 60), and two more FeatureMatch failures next to it. I reproduced all of them with ORB matches of the two Eiffel images after estimate() set the inlier status.

  • Inlier status after indexing. FeatureMatch.__getitem__ left the status as a bare bool for an int index, and as a list for a bool or int array index (a slice was fine). Then .outliers raised TypeError (~ of a list), and .inliers or .outliers of one match raised ValueError (indexing by a bool). The status is now stored as a bool array, whatever it was given as, and indexed with the same index as the matches. The two # type: ignore comments that marked the bug are gone.
  • List or tuple index. matches[[0, 1, 2]] raised ValueError: index must be an int, slice, sequence or array, though a sequence is one of the things the message lists, and BaseFeature2D accepts a list. A list or tuple of ints or bools now works, as does an empty one. A string is still refused.
  • status. It raised ValueError (the truth value of an array) for more than one match. It now gives "+", "-" or "" per match, and a single string for one match, as the scalar_result decorator does for other properties. The docstring said :rtype: bool, and now says what it returns. It has a .. versionchanged:: 2.5.0 note.

Tests: the status stays an array of the right length for an int, slice, bool array, int array, list, tuple and bool list index, inliers and outliers of a selection and of one match, status of many matches (set and unset), inliers given as a list, and list and tuple indexing. 11 of them fail on the old code. mypy reports no issues and the full suite passes (2171 passed, 33 skipped).

AI-assisted: written with Claude Code (Claude Sonnet 5.5) and reviewed by the maintainer.

🤖 Generated with Claude Code

petercorke and others added 2 commits November 23, 2026 19:48
…exed

FeatureMatch.__getitem__ left the inlier status as a bare bool for an int index
and as a list for a bool or int array index, so inliers and outliers then
failed (~ of a list, or indexing by a bool). It now stores the status as a bool
array and indexes it with the same index. A list or tuple index, which the
error message said was allowed but raised ValueError, now works. status raised
ValueError for more than one match, and now gives one string per match.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
@codacy-production

Copy link
Copy Markdown

Up to standards ✅

🟢 Issues 0 issues

Results:
0 new issues

View in Codacy

🟢 Metrics 9 complexity · 0 duplication

Metric Results
Complexity 9
Duplication 0

View in Codacy

NEW Get contextual insights on your PRs based on Codacy's metrics, along with PR and Jira context, without leaving GitHub. Enable AI reviewer
TIP This summary will be updated as you push new changes.

@petercorke
petercorke merged commit c75544b into main Nov 23, 2026
34 checks passed
@petercorke
petercorke deleted the bug/featurematch-inliers branch November 23, 2026 12:13
@github-actions github-actions Bot mentioned this pull request Nov 23, 2026
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.

1 participant