Repository navigation
fix: gridify keeps the descriptors and flags, and copes with features at the far edge - #277
Merged
Merged
Conversation
… at the far edge gridify built its result with self.__class__(keep), which put whole feature objects into _kp, left the descriptors as None and lost the scale, orientation and strength flags. It also divided by the integer cell size, so when the image size was not a multiple of the number of cells a feature in the last few pixels fell in a cell past the grid and raised IndexError. It now collects indices and returns self[keep], and the last cell takes the leftover pixels. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Not up to standards ⛔🔴 Issues
|
| Category | Results |
|---|---|
| ErrorProne | 2 high |
🟢 Metrics 9 complexity · 0 duplication
Metric Results Complexity 9 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.
gridifybuilt its result withself.__class__(keep). That put whole feature objects into_kp, left the descriptors asNoneand lost the scale, orientation and strength flags. So a gridded ORB set of 500 features gave 45 "keypoints" that were reallyORBFeatureobjects, and it could not be matched.It also divided by the integer cell size (
width // nw). When the image size is not a multiple of the number of cells, a feature in the last few pixels fell in a cell past the grid and raisedIndexError. For a 1280-pixel-wide image with 13 cells, any feature at x of 1274 or more would fail.Now
gridifycollects the indices of the kept features and returnsself[keep], the same path slicing uses, so keypoints, descriptors and flags survive. The last cell takes the leftover pixels.Tests: the result has real keypoints, descriptors and flags, each kept feature has its own descriptor row, the result can be matched, no cell holds more than
nfeat, and features at the far edges don't raise. Five of the six new tests fail on the old code. I ran the full suite and mypy, and both are clean.AI-assisted: written with Claude Code.
🤖 Generated with Claude Code