Skip to content

Remove unused Ptr_xxx_get P/Invoke declarations from features2d NativeMethods - #1879

Merged
shimat merged 1 commit into
mainfrom
claude/remove-dead-pinvoke-declarations
May 26, 2026
Merged

Remove unused Ptr_xxx_get P/Invoke declarations from features2d NativeMethods#1879
shimat merged 1 commit into
mainfrom
claude/remove-dead-pinvoke-declarations

Conversation

@shimat

@shimat shimat commented May 26, 2026

Copy link
Copy Markdown
Owner

Summary

Cleanup of dead code found while investigating the #1846 migration.

All feature detector Create() methods (SIFT, BRISK, ORB, MSER, FastFeatureDetector, AgastFeatureDetector, GFTTDetector, SimpleBlobDetector, KAZE, AKAZE) retrieve the raw pointer via the shared features2d_Ptr_Feature2D_get. The individual Ptr_xxx_get declarations were added to NativeMethods_features2d_Feature2D.cs during #1846 but:

  • Are never called anywhere in the managed codebase
  • Have no corresponding C++ implementations in features2d_Feature2D.h

Removes all 10 dead declarations.

Summary by CodeRabbit

  • Refactor
    • Cleaned up internal method declarations for feature detection algorithms (SIFT, BRISK, ORB, MSER, FastFeatureDetector, AgastFeatureDetector, GFTTDetector, SimpleBlobDetector, KAZE, AKAZE). Core functionality remains intact.

…eMethods

All feature detector Create() methods (SIFT, BRISK, ORB, MSER,
FastFeatureDetector, AgastFeatureDetector, GFTTDetector, SimpleBlobDetector,
KAZE, AKAZE) use the shared features2d_Ptr_Feature2D_get to retrieve the raw
pointer. The individual Ptr_xxx_get declarations were added during #1846 but
never called, and have no corresponding C++ implementation.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@shimat shimat self-assigned this May 26, 2026
@coderabbitai

coderabbitai Bot commented May 26, 2026

Copy link
Copy Markdown
Contributor
📝 Walkthrough

Walkthrough

This PR removes ten unused P/Invoke method declarations from the features2d native method bindings. The removed methods are pointer getter operations (*_get) for various feature detector types. All other P/Invoke declarations in those regions remain unchanged.

Changes

Cohort / File(s) Summary
P/Invoke cleanup
src/OpenCvSharp/Internal/PInvoke/NativeMethods/features2d/NativeMethods_features2d_Feature2D.cs
Removed 10 P/Invoke declarations for feature detector pointer getters (SIFT, BRISK, ORB, MSER, FastFeatureDetector, AgastFeatureDetector, GFTTDetector, SimpleBlobDetector, KAZE, AKAZE). No additions; only deletions.

Estimated code review effort

🎯 1 (Trivial) | ⏱️ ~3 minutes

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed The title accurately summarizes the main change: removal of ten unused Ptr_xxx_get P/Invoke declarations from the features2d NativeMethods file.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch claude/remove-dead-pinvoke-declarations

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@shimat
shimat merged commit eb65782 into main May 26, 2026
12 of 20 checks passed
@shimat
shimat deleted the claude/remove-dead-pinvoke-declarations branch May 26, 2026 13:27
@shimat shimat added the enhancement New feature or improvement to OpenCvSharp label Jul 25, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or improvement to OpenCvSharp

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant