mirror of
https://github.com/opencv/opencv.git
synced 2026-09-11 12:52:33 -05:00
Xfeat feature - #29361 ## PR Description ### Summary Integrate XFeat into OpenCV's `features` module as a native `Feature2D` implementation, enabling lightweight neural feature detection and descriptor extraction through OpenCV's standard feature extraction API. --- ### What's included #### New class - **`cv::XFeat`** extends `Feature2D` - CNN-based keypoint detection - 64-D descriptor extraction via ONNX/DNN - Score-map based keypoint selection - Descriptor sampling from the dense feature map --- ### Files added | File | Description | |------|-------------| | `src/feature2d_xfeat.cpp` | XFeat `Feature2D` implementation | | `test/test_xfeat.cpp` | XFeat unit and regression tests | --- ### Files modified - `features.hpp` - Add `cv::XFeat` declaration and public factory APIs --- ### Usage ```cpp #include <opencv2/features.hpp> using namespace cv; // Feature extraction Ptr<XFeat> xfeat = XFeat::create("xfeat.onnx", 2000, 0.5f, 640); std::vector<KeyPoint> keypoints; Mat descriptors; xfeat->detectAndCompute(image, noArray(), keypoints, descriptors); ``` --- ### Test dependency Depends on the opencv_extra changes adding the XFeat ONNX model and reference outputs. Required test data: https://github.com/opencv/opencv_extra/pull/1383 - `xfeat.onnx` - `xfeat_lena_640_kpts.npy` - `xfeat_lena_640_desc.npy` These files are required for the `Features2d_XFeat` tests in the main OpenCV repository to validate XFeat feature extraction and descriptor generation. ### Pull Request Readiness Checklist See details at https://github.com/opencv/opencv/wiki/How_to_contribute#making-a-good-pull-request - [x] I agree to contribute to the project under Apache 2 License. - [x] To the best of my knowledge, the proposed patch is not based on a code under GPL or another license that is incompatible with OpenCV - [x] The PR is proposed to the proper branch - [ ] There is a reference to the original bug report and related work - [x] There is accuracy test, performance test and test data in opencv_extra repository, if applicable Patch to opencv_extra has the same branch name. - [x] The feature is well documented and sample code can be built with the project CMake