Repository navigation
feat: Image.ComboFeature joins any supported detector to any descriptor - #286
Merged
Merged
Conversation
Detectors: FAST, AGAST, GFTT, Harris, SIFT, ORB, BRISK, AKAZE. Descriptors: SIFT, ORB, BRISK, AKAZE, FREAK, BRIEF, DAISY, LATCH, LUCID, BOOST. The result is a feature set of the descriptor's class. The two pairs OpenCV cannot make (AKAZE descriptor with another detector, ORB descriptor with SIFT) raise a ValueError that says why. BaseFeature2D.match now raises a clear ValueError for two sets with different kinds of descriptor, instead of an OpenCV error. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
The octave of a SIFT keypoint is reset to full resolution before ORB reads it, which makes the pair work in OpenCV 4 and 5. The docstring has a table of the 8 detectors by 10 descriptors, and its wording and the errors now say keypoints. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
…nts what it joins
A feature is a detected keypoint with its descriptor, so str() names the algorithm
once when it provides both ("SIFT features, 2985 points", as in the book) and as
"detector+descriptor" for ComboFeature ("FAST+BRIEF features, 462 points"). The
ComboFeature docstring has a table of descriptors by detectors, a table of what each
detector provides, and an example that prints the result.
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
…scriptors Fifteen entries: the comparison of detectors and descriptors by Paul et al., then one paper for each of the 14 algorithms, in alphabetical order. The references come from OpenCV's own bibliography. The ORB docstring had none. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Not up to standards ⛔🔴 Issues
|
| Category | Results |
|---|---|
| ErrorProne | 2 high |
🟢 Metrics 54 complexity · 0 duplication
Metric Results Complexity 54 Duplication 0
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.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Image.ComboFeaturewas a stub that raisedNotImplementedError. It now detects keypoints with one algorithm and describes them with another. There are 8 detectors (FAST, AGAST, GFTT, Harris, SIFT, ORB, BRISK, AKAZE) and 10 descriptors (SIFT, ORB, BRISK, AKAZE, FREAK, BRIEF, DAISY, LATCH, LUCID, BOOST). 73 of the 80 pairs work. The result is a feature set of the descriptor's class, soimg.ComboFeature("FAST", "BRIEF")returns aBRIEFFeature.The docstring has a table of the combinations, a table of what each detector provides (position, scale, orientation, strength), and a References section. The References section has the Paul et al. comparison of detectors and descriptors, then a paper for each of the 14 algorithms, taken from OpenCV's bibliography. The ORB docstring had no reference, so this adds one.
The seven pairs that fail are the AKAZE descriptor with any other detector. It raises a
ValueErrorthat says why. SIFT keypoints with the ORB descriptor works by resetting each keypoint's octave to 0, which means ORB ignores their scale. SIFT with ORB gives 81% geometrically consistent matches betweeneiffel-1.pngandeiffel-2.png, as good as the other pairs I tried. LUCID needs a color image.A feature is a detected keypoint with its descriptor, so
str()now names the algorithm once when it provides both ("SIFT features, 2985 points", as in the book) and as "FAST+BRIEF features, 462 points" for a combination. This replaces "SIFTFeature features". A single feature prints "SIFT feature: (u, v), …" instead of "SIFTFeature: (u, v), …".BaseFeature2D.matchnow raises aValueErrornaming both descriptor kinds when two sets have different kinds, for example BRIEF and DAISY. Before, OpenCV raised an opaque error.Tests: one for each supported pair, plus tests for options,
nfeat,id, the scale and orientation flags, matching, naming, and each error. The full suite and mypy are clean. OpenCV 4.14 and 5.0 behave the same for the pairs that work, from the OpenCV-only probe. The Toolbox test suite ran on OpenCV 5 only, and CI covers OpenCV 4.AI-assisted: written with Claude Code.
🤖 Generated with Claude Code