Skip to content

chore: annotate ImagePointFeatures and document estimate and plot_correspondence - #257

Merged
petercorke merged 2 commits into
mainfrom
chore/types-point-features
Nov 23, 2026
Merged

petercorke merged 2 commits into
mainfrom
chore/types-point-features

Conversation

@petercorke

Copy link
Copy Markdown
Owner

Annotates ImagePointFeatures.py, the next file in the type-hint work of Issue 60 (12 of 110 parameters were unannotated). Annotation and docstring changes only, no behaviour change.

  • BaseFeature2D.__getitem__ and FeatureMatch.__getitem__ take int | slice | Sequence[int] | np.ndarray, which is what they accept (an index array of ints or bools too, and BagOfWords indexes with a bool array). The docstrings said "int or slice". __radd__ takes a feature set, a list, an int or None, as __add__ and sum() need. FeatureMatch.__init__(m, inliers) and _image2feature are typed.
  • Docstrings: FeatureMatch and the mixin had none, and FeatureMatch.estimate and plot_correspondence had none. They do now.
  • Typing found a bug, left for its own PR: after estimate() sets the inlier mask, indexing a FeatureMatch by an int leaves a bare bool, and indexing by an int or bool array leaves a list (a slice is fine). Then .outliers raises TypeError (~ of a list) or ValueError. Two narrow # type: ignore[...] comments mark the lines, with a comment saying so.

I left alone the 26 :seealso: fields and 39 Example: blocks, which AGENTS.md says to migrate gradually.

mypy reports no issues and the full suite passes (2158 passed, 33 skipped).

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

🤖 Generated with Claude Code

…respondence

Part of Issue 60. Annotates the remaining parameters in
ImagePointFeatures.py: __getitem__ of BaseFeature2D and FeatureMatch (an int,
slice, sequence of ints or array), __radd__, FeatureMatch.__init__ and
_image2feature. Gives FeatureMatch, the mixin, estimate and plot_correspondence
docstrings. Two type: ignore comments mark a bug found while typing: indexing a
FeatureMatch by an int, or by an int or bool array, leaves its inlier status as
a bool or a list, so outliers then fails.

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

Copy link
Copy Markdown

Not up to standards ⛔

🔴 Issues 1 high

Alerts:
⚠ 1 issue (≤ 0 issues of at least minor severity)

Results:
1 new issue

Category Results
ErrorProne 1 high

View in Codacy

🟢 Metrics 0 complexity · 0 duplication

Metric Results
Complexity 0
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 ceef4cb into main Nov 23, 2026
33 of 34 checks passed
@petercorke
petercorke deleted the chore/types-point-features branch November 23, 2026 08:46
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