Skip to content

Add OpenCV 5 features wrappers: ALIKED, DISK, LightGlue, ANNIndex, AffineFeature - #1926

Merged
shimat merged 1 commit into
5.xfrom
feature/features-modern
Jun 24, 2026
Merged

shimat merged 1 commit into
5.xfrom
feature/features-modern

Conversation

@shimat

@shimat shimat commented Jun 24, 2026

Copy link
Copy Markdown
Owner

Summary

Implements the remaining features (formerly features2d) module classes from #1924 (OpenCV 5 API coverage).

New wrappers

  • ALIKED / DISK — deep-learning local feature detectors & descriptors (Feature2D, ONNX via the dnn module). Each exposes Create (model file path) and CreateFromMemory (in-memory buffer). DISK additionally exposes MaxKeypoints / ScoreThreshold / ImageSize.
  • LightGlueMatcher — attention-based descriptor matcher (DescriptorMatcher) with SetPairInfo / ClearPairInfo.
  • ANNIndex — Annoy-based approximate nearest neighbor index (modern FLANN alternative): AddItems / Build / KnnSearch / Save / Load / GetTreeNumber / GetItemNumber / SetOnDiskBuild / SetSeed, plus the ANNIndexDistance enum.
  • AffineFeature — affine-invariant (ASIFT-style) wrapper over a backend Feature2D, with SetViewParams / GetViewParams.

Native bridge

  • DNN-dependent classes (DISK, ALIKED, LightGlueMatcher) are guarded with #ifdef HAVE_OPENCV_DNN.
  • Model-path / index-path string entry points use the existing Windows/NotWindows marshaling split for correct Unicode handling.
  • ANNIndex lives in a new features_ANNIndex.h (it is neither Feature2D nor DescriptorMatcher); the others are added to the existing grouped headers.

Test

  • AffineFeatureTest and ANNIndexTest exercise the classes end-to-end (detect over SIFT backend; add/build/knnSearch round-trip + save/load).
  • DiskAlikedLightGlueTest verifies entry-point wiring (missing model / garbage buffer → OpenCVException), since the ONNX models are not committed to the repo.
  • Rebuilt OpenCvSharpExtern locally; full Features suite green (51 passed).

Refs #1924.

🤖 Generated with Claude Code

…dex, AffineFeature

Wraps the new and previously-unwrapped classes from the OpenCV 5 features
module (formerly features2d):

- ALIKED, DISK: deep-learning local feature detectors/descriptors (Feature2D,
  ONNX via dnn). Both expose Create (file path) and CreateFromMemory (buffer).
- LightGlueMatcher: attention-based descriptor matcher (DescriptorMatcher) with
  SetPairInfo/ClearPairInfo.
- ANNIndex: Annoy-based approximate nearest neighbor index (modern FLANN
  alternative) with add/build/knnSearch/save/load and ANNIndexDistance enum.
- AffineFeature: affine-invariant wrapper over a backend Feature2D (ASIFT).

DNN-dependent classes are guarded with HAVE_OPENCV_DNN in the native bridge.
Model-path string entry points use the Windows/NotWindows marshaling split.

Tests: AffineFeature and ANNIndex are exercised end-to-end; DISK/ALIKED/
LightGlue verify entry-point wiring (missing model -> OpenCVException) since
their ONNX models are not committed. Full Features suite green (51 passed).

Refs #1924.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
@shimat
shimat merged commit 853c67a into 5.x Jun 24, 2026
11 checks passed
@shimat
shimat deleted the feature/features-modern branch June 24, 2026 09:00
@shimat shimat self-assigned this Jun 25, 2026
@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