Repository navigation
feat: scale, orientation and strength raise for features that do not have them - #275
Merged
Merged
Conversation
…have them They returned the keypoint size, angle and response whether or not the detector sets them, so Harris features reported an orientation of 0 and a scale of 0. Add a strength flag beside the scale and orientation flags, raise ValueError when a flag is off, and correct the flags: ORB, BRISK and AKAZE do have a scale and an orientation. Slicing, adding and sorting now keep the flags and the image, and the orientation is printed in degrees, not radians with a degree sign. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Up to standards ✅🟢 Issues
|
| Metric | Results |
|---|---|
| Complexity | 37 |
| 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.
Makes
scale,orientationandstrengthof a feature set raiseValueErrorwhen the features do not have that quantity, and corrects which algorithms say they have what. It is the first step of the work onComboFeature(item 19 of the bug list), where a detector and a descriptor are combined and the result has only what they provide.The problem. The properties returned the keypoint's
size,angleandresponsewhatever the detector did. For a detector that sets none of them the value is a constant: Harris features reported a scale of 0 and an orientation of 0. The_has_scaleand_has_orientflags only decided whatprintandplotshowed, and they were wrong. I compared each algorithm's flags with the keypoints it returns:The change.
strength, next to the other two (default on, as every detector gives a response).scale,orientationandstrengthraiseValueError("FAST features have no scale") if the flag is off.plot(filled=True)needs a scale andplot(hand=True)an orientation, so those raise the same way; a plainplot()needs neither.sort("scale")andfilter(minscale=...)raise for a set with no scale.print,table()andlist()of those features now show them, andplot(filled=True, hand=True)works on them._like()helper makes a new set with the flags, the feature type and the image copied, and slicing,+andsort(inplace=False)use it. Before,+andsortforgot the flags and the image (sift[:50] + sift[50:100]lost its scale and orientation), and a slice forgot the image.orient=0.5°). It is now printed in degrees. The test that pinned the old output is corrected... versionchanged:: 2.5.0on the three properties.Not changed here, found while doing this:
gridify()returns a set whose keypoints are feature sets, andHarris(scale=15)has no effect on the detector, because itsscaleoption is swallowed by the flag of the same name. Each will be its own PR.Tests. The flags are checked against the keypoints of the real algorithms (SIFT, ORB, BRISK, AKAZE, Harris): where a flag is on the values must vary, where it is off they must be constant and the property must raise. Also: raising for each property and for a single feature, drawing needing a scale or an orientation, the flags and image kept by slicing, adding, sorting and subsetting, and the printing. 21 of the new tests fail on the old code. mypy reports no issues and the full suite passes (2325 passed, 30 skipped). The chapter 12 notebook uses
.strengthon Harris and.scaleon SIFT, which both still work.AI-assisted: written with Claude Code (Claude Sonnet 5.5) and reviewed by the maintainer.
🤖 Generated with Claude Code