Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

hal/riscv-rvv: implement FAST keypoint detection#27391

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Merged
asmorkalov merged 27 commits intoopencv:4.xfromHaosonn:pr-rvv-hal-fast
Aug 11, 2025

Conversation

@Haosonn
Copy link
Contributor

An implementation of FAST keypoint detection with NMS/noNMS version.

A new perf test is written, and the perf test is evaluated in two platforms: K1/K230.
Accelaration is achieved when threshold is high, however, weird stat shows that the acceleration doesn't work when threshold is low (the number of keypoint candidates is high).

K1:

# GCC                             Name of Test                               scalar  rvv      rvv                                                                                          vs                                                                                        scalar                                                                                      (x-factor)detect::Fast_Params::(20, 2, false, "cv/cameracalibration/chess9.png")  22.113 23.721    0.93detect::Fast_Params::(20, 2, false, "cv/inpaint/orig.png")              4.605  7.168     0.64detect::Fast_Params::(20, 2, true, "cv/cameracalibration/chess9.png")   26.228 24.689    1.06detect::Fast_Params::(20, 2, true, "cv/inpaint/orig.png")               7.134  7.561     0.94detect::Fast_Params::(30, 2, false, "cv/cameracalibration/chess9.png")  19.488 21.407    0.91detect::Fast_Params::(30, 2, false, "cv/inpaint/orig.png")              3.481  5.404     0.64detect::Fast_Params::(30, 2, true, "cv/cameracalibration/chess9.png")   22.309 22.145    1.01detect::Fast_Params::(30, 2, true, "cv/inpaint/orig.png")               4.826  5.654     0.85detect::Fast_Params::(100, 2, false, "cv/cameracalibration/chess9.png") 14.108 8.205     1.72detect::Fast_Params::(100, 2, false, "cv/inpaint/orig.png")             2.520  1.072     2.35detect::Fast_Params::(100, 2, true, "cv/cameracalibration/chess9.png")  14.133 8.410     1.68detect::Fast_Params::(100, 2, true, "cv/inpaint/orig.png")              2.556  1.097     2.33# Clang                             Name of Test                               scalar  rvv      rvv                                                                                          vs                                                                                        scalar                                                                                      (x-factor)detect::Fast_Params::(20, 2, false, "cv/cameracalibration/chess9.png")  25.130 23.695    1.06detect::Fast_Params::(20, 2, false, "cv/inpaint/orig.png")              4.987  7.168     0.70detect::Fast_Params::(20, 2, true, "cv/cameracalibration/chess9.png")   28.035 24.467    1.15detect::Fast_Params::(20, 2, true, "cv/inpaint/orig.png")               6.760  7.503     0.90detect::Fast_Params::(30, 2, false, "cv/cameracalibration/chess9.png")  22.954 21.373    1.07detect::Fast_Params::(30, 2, false, "cv/inpaint/orig.png")              3.838  5.330     0.72detect::Fast_Params::(30, 2, true, "cv/cameracalibration/chess9.png")   24.523 21.998    1.11detect::Fast_Params::(30, 2, true, "cv/inpaint/orig.png")               4.795  5.543     0.87detect::Fast_Params::(100, 2, false, "cv/cameracalibration/chess9.png") 16.799 8.102     2.07detect::Fast_Params::(100, 2, false, "cv/inpaint/orig.png")             2.874  1.024     2.81detect::Fast_Params::(100, 2, true, "cv/cameracalibration/chess9.png")  16.950 8.073     2.10detect::Fast_Params::(100, 2, true, "cv/inpaint/orig.png")              2.899  1.027     2.82

K230

# GCC                             Name of Test                               scalar  rvv      rvv                                                                                          vs                                                                                        scalar                                                                                      (x-factor)detect::Fast_Params::(20, 2, false, "cv/cameracalibration/chess9.png")  21.082 32.090    0.66detect::Fast_Params::(20, 2, false, "cv/inpaint/orig.png")              4.837  9.157     0.53detect::Fast_Params::(20, 2, true, "cv/cameracalibration/chess9.png")   25.479 33.576    0.76detect::Fast_Params::(20, 2, true, "cv/inpaint/orig.png")               7.549  9.716     0.78detect::Fast_Params::(30, 2, false, "cv/cameracalibration/chess9.png")  18.463 30.087    0.61detect::Fast_Params::(30, 2, false, "cv/inpaint/orig.png")              3.716  6.544     0.57detect::Fast_Params::(30, 2, true, "cv/cameracalibration/chess9.png")   21.548 31.374    0.69detect::Fast_Params::(30, 2, true, "cv/inpaint/orig.png")               5.107  6.928     0.74detect::Fast_Params::(100, 2, false, "cv/cameracalibration/chess9.png") 13.763 8.712     1.58detect::Fast_Params::(100, 2, false, "cv/inpaint/orig.png")             2.578  1.284     2.01detect::Fast_Params::(100, 2, true, "cv/cameracalibration/chess9.png")  13.804 8.831     1.56detect::Fast_Params::(100, 2, true, "cv/inpaint/orig.png")              2.615  1.289     2.03# Clang                             Name of Test                               scalar  rvv      rvv                                                                                          vs                                                                                        scalar                                                                                      (x-factor)detect::Fast_Params::(20, 2, false, "cv/cameracalibration/chess9.png")  23.424 35.072    0.67detect::Fast_Params::(20, 2, false, "cv/inpaint/orig.png")              5.284  10.107    0.52detect::Fast_Params::(20, 2, true, "cv/cameracalibration/chess9.png")   26.487 35.978    0.74detect::Fast_Params::(20, 2, true, "cv/inpaint/orig.png")               7.146  10.612    0.67detect::Fast_Params::(30, 2, false, "cv/cameracalibration/chess9.png")  21.155 32.858    0.64detect::Fast_Params::(30, 2, false, "cv/inpaint/orig.png")              4.101  7.153     0.57detect::Fast_Params::(30, 2, true, "cv/cameracalibration/chess9.png")   23.321 33.505    0.70detect::Fast_Params::(30, 2, true, "cv/inpaint/orig.png")               5.106  7.415     0.69detect::Fast_Params::(100, 2, false, "cv/cameracalibration/chess9.png") 15.597 8.792     1.77detect::Fast_Params::(100, 2, false, "cv/inpaint/orig.png")             2.922  1.228     2.38detect::Fast_Params::(100, 2, true, "cv/cameracalibration/chess9.png")  15.626 8.817     1.77detect::Fast_Params::(100, 2, true, "cv/inpaint/orig.png")              2.963  1.240     2.39

Pull Request Readiness Checklist

See details athttps://github.com/opencv/opencv/wiki/How_to_contribute#making-a-good-pull-request

  • I agree to contribute to the project under Apache 2 License.
  • 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
  • The PR is proposed to the proper branch
  • There is a reference to the original bug report and related work
  • There is accuracy test, performance test and test data in opencv_extra repository, if applicable
    Patch to opencv_extra has the same branch name.
  • The feature is well documented and sample code can be built with the project CMake

opencv-alalek, fengyuentau, vpisarev, and IskXCr reacted with thumbs up emoji
@param type FAST type
*/
inlineinthal_ni_FAST(const uchar* src_data,size_t src_step,int width,int height,uchar* keypoints_data,size_t* keypoints_count,int threshold,bool nonmax_suppression,int/*cv::FastFeatureDetector::DetectorType*/ type) {return CV_HAL_ERROR_NOT_IMPLEMENTED; }
inlineinthal_ni_FAST(const uchar* src_data,size_t src_step,int width,int height,std::vector<cv::KeyPoint>& keypoints,int threshold,bool nonmax_suppression,int/*cv::FastFeatureDetector::DetectorType*/ type) {return CV_HAL_ERROR_NOT_IMPLEMENTED; }
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

It's dangerous replacement. HAL uses C style API without std::vector on purpose. HAL may be a binary built with own STL. It means that std::vector on HAL side and OpenCV side may be different with different memory layout.

Copy link
ContributorAuthor

@HaosonnHaosonnJun 2, 2025
edited
Loading

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

Indeed. But I haven't figured out a way to modify the membersize instd::vector<cv::KeyPoint>& keypoints by simply reinterpretingkeypoints.data() touchar*. The originalCALL_HAL, causes wrong keypoint count in accuracy test since it compares the membersize of the outputstd::vector<cv::KeyPoint>. Is there any solution for the problem?

asmorkalov reacted with eyes emoji
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

A simple solution is that you can extract the macro of calling HAL, manually call HAL function and do a resize on the vector before returning. E.g.

diff --git a/modules/features2d/src/fast.cpp b/modules/features2d/src/fast.cppindex a9615da5bd..b00b80818d 100644--- a/modules/features2d/src/fast.cpp+++ b/modules/features2d/src/fast.cpp@@ -438,8 +438,12 @@ void FAST(InputArray _img, std::vector<KeyPoint>& keypoints, int threshold, bool     size_t keypoints_count = 10000;     keypoints.clear();     keypoints.resize(keypoints_count);-    CALL_HAL(fast, cv_hal_FAST, img.data, img.step, img.cols, img.rows,-             (uchar*)(keypoints.data()), &keypoints_count, threshold, nonmax_suppression, type);+    int hal_ret = cv_hal_FAST(img.data, img.step, img.cols, img.rows, (uchar *)(keypoints.data()),+                              &keypoints_count, threshold, nonmax_suppression, type);+    if (hal_ret == CV_HAL_ERROR_OK) {+        keypoints.resize(keypoints_count);+        return;+    }      switch(type) {     case FastFeatureDetector::TYPE_5_8:

@HaosonnHaosonnforce-pushed thepr-rvv-hal-fast branch 2 times, most recently from64415e0 to2ed698eCompareJune 2, 2025 10:28
Copy link
Member

@fengyuentaufengyuentau left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

Also take a look at the trailing whitespaces:

hal/riscv-rvv/CMakeLists.txt:20: trailing whitespace.+  ${CMAKE_SOURCE_DIR}/modules/imgproc/include hal/riscv-rvv/src/features2d/fast.cpp:60: trailing whitespace.+inline uint8_t cornerScore(const uint8_t* ptr, const vuint16m2_t& v_offset, int64_t row_stride) hal/riscv-rvv/src/features2d/fast.cpp:64: trailing whitespace.+    hal/riscv-rvv/src/features2d/fast.cpp:76: trailing whitespace.+    hal/riscv-rvv/src/features2d/fast.cpp:108: trailing whitespace.+inline int fast_16(const uchar* src_data, size_t src_step, int width, int height, std::vector<KeyPoint>& keypoints, int threshold, bool nonmax_suppression) hal/riscv-rvv/src/features2d/fast.cpp:[19](https://github.com/opencv/opencv/actions/runs/15389955155/job/43296989535?pr=27391#step:14:20)0: trailing whitespace.+                    hal/riscv-rvv/src/features2d/fast.cpp:[20](https://github.com/opencv/opencv/actions/runs/15389955155/job/43296989535?pr=27391#step:14:21)7: trailing whitespace.

fengyuentau
fengyuentau previously approved these changesJun 16, 2025
Copy link
Member

@fengyuentaufengyuentau left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

LGTM 👍

@asmorkalov
Copy link
Contributor

Muse Pi v30 board (./opencv_test_features2d):

[ RUN      ] Features2d/DescriptorImage.no_crash/6, where GetParam() = "shared/pic*.png"0. image: /home/opencv/opencv_extra/testdata/cv/shared/pic1.png:        400x300        AKAZE:MLDB                        (149 keypoints, descriptor size = 61)        AKAZE:MLDB_UPRIGHT                        (149 keypoints, descriptor size = 61)        AKAZE:MLDB_256                        (149 keypoints, descriptor size = 32)        AKAZE:MLDB_UPRIGHT_256                        (149 keypoints, descriptor size = 32)        AKAZE:KAZE                        (135 keypoints, descriptor size = 64)        AKAZE:KAZE_UPRIGHT                        (135 keypoints, descriptor size = 64)        KAZE                        (265 keypoints, descriptor size = 64)        ORB                        (557 keypoints, descriptor size = 32)        BRISK                        (151 keypoints, descriptor size = 64)1. image: /home/opencv/opencv_extra/testdata/cv/shared/pic2.png:        400x300        AKAZE:MLDB                        (412 keypoints, descriptor size = 61)        AKAZE:MLDB_UPRIGHT                        (412 keypoints, descriptor size = 61)        AKAZE:MLDB_256                        (412 keypoints, descriptor size = 32)        AKAZE:MLDB_UPRIGHT_256                        (412 keypoints, descriptor size = 32)        AKAZE:KAZE                        (388 keypoints, descriptor size = 64)        AKAZE:KAZE_UPRIGHT                        (388 keypoints, descriptor size = 64)        KAZE                        (393 keypoints, descriptor size = 64)        ORBdouble free or corruption (!prev)[1]    2696 segmentation fault (core dumped)  ./opencv_test_features2d
Haosonn reacted with eyes emoji

@Haosonn
Copy link
ContributorAuthor

Muse Pi v30 board (./opencv_test_features2d):

[ RUN      ] Features2d/DescriptorImage.no_crash/6, where GetParam() = "shared/pic*.png"0. image: /home/opencv/opencv_extra/testdata/cv/shared/pic1.png:        400x300        AKAZE:MLDB                        (149 keypoints, descriptor size = 61)        AKAZE:MLDB_UPRIGHT                        (149 keypoints, descriptor size = 61)        AKAZE:MLDB_256                        (149 keypoints, descriptor size = 32)        AKAZE:MLDB_UPRIGHT_256                        (149 keypoints, descriptor size = 32)        AKAZE:KAZE                        (135 keypoints, descriptor size = 64)        AKAZE:KAZE_UPRIGHT                        (135 keypoints, descriptor size = 64)        KAZE                        (265 keypoints, descriptor size = 64)        ORB                        (557 keypoints, descriptor size = 32)        BRISK                        (151 keypoints, descriptor size = 64)1. image: /home/opencv/opencv_extra/testdata/cv/shared/pic2.png:        400x300        AKAZE:MLDB                        (412 keypoints, descriptor size = 61)        AKAZE:MLDB_UPRIGHT                        (412 keypoints, descriptor size = 61)        AKAZE:MLDB_256                        (412 keypoints, descriptor size = 32)        AKAZE:MLDB_UPRIGHT_256                        (412 keypoints, descriptor size = 32)        AKAZE:KAZE                        (388 keypoints, descriptor size = 64)        AKAZE:KAZE_UPRIGHT                        (388 keypoints, descriptor size = 64)        KAZE                        (393 keypoints, descriptor size = 64)        ORBdouble free or corruption (!prev)[1]    2696 segmentation fault (core dumped)  ./opencv_test_features2d

I've checked this test. This cause of this failure is that the count of keypoints in this case is greater than 10000 which is set in the initialization inmodules/features2d/src/fast.cpp:438. A wider range solves the problem.

    size_t keypoints_count = 10000;    keypoints.clear();    keypoints.resize(keypoints_count); // reserve space for keypoints
asmorkalov reacted with eyes emoji

@asmorkalov
Copy link
Contributor

Looks like we need some API change here.

fengyuentau reacted with eyes emoji

@fengyuentaufengyuentau dismissed theirstale reviewJune 23, 2025 07:29

Introduced new changes

@asmorkalovasmorkalov added this to the4.13.0 milestoneJun 27, 2025
Comment on lines 104 to 106
@param realloc_func function for reallocation
*/
inlineinthal_ni_FAST(const uchar* src_data,size_t src_step,int width,int height,uchar* keypoints_data,size_t* keypoints_count,int threshold,bool nonmax_suppression,int/*cv::FastFeatureDetector::DetectorType*/ type) {return CV_HAL_ERROR_NOT_IMPLEMENTED; }
inlineinthal_ni_FAST(const uchar* src_data,size_t src_step,int width,int height,void** keypoints_data,size_t* keypoints_count,int threshold,bool nonmax_suppression,int/*cv::FastFeatureDetector::DetectorType*/ type,void* (*realloc_func)(void*,size_t)) {return CV_HAL_ERROR_NOT_IMPLEMENTED; }
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

We usually presume backward compatibility in HAL. I propose to presume the original API and add new entrypoint with realloc, e.g.hal_ni_FAST_withRealloc.
On caller side you need to try the new one, then the old one and then default impl.

fengyuentau reacted with eyes emoji
Copy link
Contributor

@vpisarevvpisarevJul 23, 2025
edited
Loading

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

@asmorkalov,

  1. hal_ni_FAST_withRealloc is quite bad name, I would say. We may have some next revisions of API and describing all improvements in the function name is a super-verbose method. I'd suggest to simply add "v2": hal_ni_FASTv2.

  2. Are you fine that inside cv::FAST() we will just call the new HAL API (v2)? Or we need to call the old API as well?

@fengyuentau
Copy link
Member

Found regression on the CI configuration

[  FAILED  ] 2 tests, listed below:[  FAILED  ] Features2d_Detector_FAST.regression[  FAILED  ] Features2d_FAST.regression

But these two test were fine on spacemit k1.

{
pixel_u[i] = pixel_u[i -16];
}
v_offset =__riscv_vle16_v_u16m2(pixel_u,25);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

CI node has 128x2-bit width of register, so max number of uint16_t elements in a lane is 16. 25 is just wrong.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

Reminder.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

Fixed.

{
pixel_u[i] = pixel_u[i -16];
}
v_offset =__riscv_vle16_v_u16m2(pixel_u,25);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

Reminder.

@fengyuentau
Copy link
Member

@asmorkalov Regression is fixed. Manually tested on my side both on the QEMU setup and K1. Performance is slightly better thanbefore:

GCC:

Geometric mean (ms)                             Name of Test                               base-gcc patch-gcc patch-gcc                                                                                                vs                                                                                                base-gcc                                                                                            (x-factor)detect::Fast_Params::(20, 2, false, "cv/cameracalibration/chess9.png")   22.308   22.860      0.98   detect::Fast_Params::(20, 2, false, "cv/inpaint/orig.png")               4.816     6.844      0.70   detect::Fast_Params::(20, 2, true, "cv/cameracalibration/chess9.png")    26.150   23.757      1.10   detect::Fast_Params::(20, 2, true, "cv/inpaint/orig.png")                7.114     7.313      0.97   detect::Fast_Params::(30, 2, false, "cv/cameracalibration/chess9.png")   19.625   20.619      0.95   detect::Fast_Params::(30, 2, false, "cv/inpaint/orig.png")               3.572     5.055      0.71   detect::Fast_Params::(30, 2, true, "cv/cameracalibration/chess9.png")    22.323   21.209      1.05   detect::Fast_Params::(30, 2, true, "cv/inpaint/orig.png")                4.873     5.372      0.91   detect::Fast_Params::(100, 2, false, "cv/cameracalibration/chess9.png")  14.156    7.986      1.77   detect::Fast_Params::(100, 2, false, "cv/inpaint/orig.png")              2.582     1.077      2.40   detect::Fast_Params::(100, 2, true, "cv/cameracalibration/chess9.png")   14.257    8.017      1.78   detect::Fast_Params::(100, 2, true, "cv/inpaint/orig.png")               2.618     1.086      2.41

Clang:

Geometric mean (ms)                             Name of Test                               base-clang patch-clang patch-clang                                                                                                   vs                                                                                                    base-clang                                                                                                (x-factor) detect::Fast_Params::(20, 2, false, "cv/cameracalibration/chess9.png")    25.594     21.132       1.21    detect::Fast_Params::(20, 2, false, "cv/inpaint/orig.png")                5.453       6.325       0.86    detect::Fast_Params::(20, 2, true, "cv/cameracalibration/chess9.png")     29.278     22.377       1.31    detect::Fast_Params::(20, 2, true, "cv/inpaint/orig.png")                 7.782       6.918       1.12    detect::Fast_Params::(30, 2, false, "cv/cameracalibration/chess9.png")    23.346     19.093       1.22    detect::Fast_Params::(30, 2, false, "cv/inpaint/orig.png")                4.332       4.691       0.92    detect::Fast_Params::(30, 2, true, "cv/cameracalibration/chess9.png")     25.912     19.999       1.30    detect::Fast_Params::(30, 2, true, "cv/inpaint/orig.png")                 5.524       5.049       1.09    detect::Fast_Params::(100, 2, false, "cv/cameracalibration/chess9.png")   17.603      7.406       2.38    detect::Fast_Params::(100, 2, false, "cv/inpaint/orig.png")               3.256       0.961       3.39    detect::Fast_Params::(100, 2, true, "cv/cameracalibration/chess9.png")    17.665      7.444       2.37    detect::Fast_Params::(100, 2, true, "cv/inpaint/orig.png")                3.267       0.961       3.40

@asmorkalov
Copy link
Contributor

Build issue on Mac:

[1094/2306] Building CXX object modules/features2d/CMakeFiles/opencv_features2d.dir/src/fast.cpp.oFAILED: modules/features2d/CMakeFiles/opencv_features2d.dir/src/fast.cpp.o /opt/homebrew/bin/ccache /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/c++ -DCVAPI_EXPORTS -D_USE_MATH_DEFINES -D__OPENCV_BUILD=1 -D__STDC_CONSTANT_MACROS -D__STDC_FORMAT_MACROS -D__STDC_LIMIT_MACROS -I/Users/opencv-cn/GHA-OCV-1/_work/opencv/opencv/opencv/modules/features2d/include -I/Users/opencv-cn/GHA-OCV-1/_work/opencv/opencv/build/modules/features2d -I/Users/opencv-cn/GHA-OCV-1/_work/opencv/opencv/opencv/modules/core/include -I/Users/opencv-cn/GHA-OCV-1/_work/opencv/opencv/opencv/modules/flann/include -I/Users/opencv-cn/GHA-OCV-1/_work/opencv/opencv/opencv/modules/imgproc/include -isystem /Users/opencv-cn/GHA-OCV-1/_work/opencv/opencv/build -isystem /opt/homebrew/include/eigen3 -fsigned-char -W -Wall -Wreturn-type -Wnon-virtual-dtor -Waddress -Wsequence-point -Wformat -Wformat-security -Wmissing-declarations -Wmissing-prototypes -Wstrict-prototypes -Wundef -Winit-self -Wpointer-arith -Wshadow -Wsign-promo -Wuninitialized -Wno-delete-non-virtual-dtor -Wno-unnamed-type-template-args -Wno-comment -fdiagnostics-show-option -Qunused-arguments -Wno-semicolon-before-method-body -ffunction-sections -fdata-sections  -fvisibility=hidden -fvisibility-inlines-hidden -Wno-deprecated-copy -O3 -DNDEBUG  -DNDEBUG -arch arm64 -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX12.3.sdk -mmacosx-version-min=12.0 -fPIC -std=c++11 -MD -MT modules/features2d/CMakeFiles/opencv_features2d.dir/src/fast.cpp.o -MF modules/features2d/CMakeFiles/opencv_features2d.dir/src/fast.cpp.o.d -o modules/features2d/CMakeFiles/opencv_features2d.dir/src/fast.cpp.o -c /Users/opencv-cn/GHA-OCV-1/_work/opencv/opencv/opencv/modules/features2d/src/fast.cpp/Users/opencv-cn/GHA-OCV-1/_work/opencv/opencv/opencv/modules/features2d/src/fast.cpp:441:19: error: use of undeclared identifier 'cv_hal_FASTv2'    int hal_ret = cv_hal_FASTv2(img.data, img.step, img.cols, img.rows, (void**)&kps,                  ^1 error generated.

@vpisarevvpisarev self-requested a reviewAugust 11, 2025 09:51
@asmorkalovasmorkalov merged commit75d9ac3 intoopencv:4.xAug 11, 2025
28 checks passed
@asmorkalovasmorkalov mentioned this pull requestAug 13, 2025
D00E pushed a commit to D00E/opencv that referenced this pull requestSep 19, 2025
hal/riscv-rvv: implement FAST keypoint detectionopencv#27391An implementation of FAST keypoint detection with NMS/noNMS version.A new perf test is written, and the perf test is evaluated in two platforms: K1/K230.Accelaration is achieved when threshold is high, however, weird stat shows that the acceleration doesn't work when threshold is low (the number of keypoint candidates is high).K1:```# GCC                             Name of Test                               scalar  rvv      rvv                                                                                          vs                                                                                        scalar                                                                                      (x-factor)detect::Fast_Params::(20, 2, false, "cv/cameracalibration/chess9.png")  22.113 23.721    0.93detect::Fast_Params::(20, 2, false, "cv/inpaint/orig.png")              4.605  7.168     0.64detect::Fast_Params::(20, 2, true, "cv/cameracalibration/chess9.png")   26.228 24.689    1.06detect::Fast_Params::(20, 2, true, "cv/inpaint/orig.png")               7.134  7.561     0.94detect::Fast_Params::(30, 2, false, "cv/cameracalibration/chess9.png")  19.488 21.407    0.91detect::Fast_Params::(30, 2, false, "cv/inpaint/orig.png")              3.481  5.404     0.64detect::Fast_Params::(30, 2, true, "cv/cameracalibration/chess9.png")   22.309 22.145    1.01detect::Fast_Params::(30, 2, true, "cv/inpaint/orig.png")               4.826  5.654     0.85detect::Fast_Params::(100, 2, false, "cv/cameracalibration/chess9.png") 14.108 8.205     1.72detect::Fast_Params::(100, 2, false, "cv/inpaint/orig.png")             2.520  1.072     2.35detect::Fast_Params::(100, 2, true, "cv/cameracalibration/chess9.png")  14.133 8.410     1.68detect::Fast_Params::(100, 2, true, "cv/inpaint/orig.png")              2.556  1.097     2.33# Clang                             Name of Test                               scalar  rvv      rvv                                                                                          vs                                                                                        scalar                                                                                      (x-factor)detect::Fast_Params::(20, 2, false, "cv/cameracalibration/chess9.png")  25.130 23.695    1.06detect::Fast_Params::(20, 2, false, "cv/inpaint/orig.png")              4.987  7.168     0.70detect::Fast_Params::(20, 2, true, "cv/cameracalibration/chess9.png")   28.035 24.467    1.15detect::Fast_Params::(20, 2, true, "cv/inpaint/orig.png")               6.760  7.503     0.90detect::Fast_Params::(30, 2, false, "cv/cameracalibration/chess9.png")  22.954 21.373    1.07detect::Fast_Params::(30, 2, false, "cv/inpaint/orig.png")              3.838  5.330     0.72detect::Fast_Params::(30, 2, true, "cv/cameracalibration/chess9.png")   24.523 21.998    1.11detect::Fast_Params::(30, 2, true, "cv/inpaint/orig.png")               4.795  5.543     0.87detect::Fast_Params::(100, 2, false, "cv/cameracalibration/chess9.png") 16.799 8.102     2.07detect::Fast_Params::(100, 2, false, "cv/inpaint/orig.png")             2.874  1.024     2.81detect::Fast_Params::(100, 2, true, "cv/cameracalibration/chess9.png")  16.950 8.073     2.10detect::Fast_Params::(100, 2, true, "cv/inpaint/orig.png")              2.899  1.027     2.82```K230```# GCC                             Name of Test                               scalar  rvv      rvv                                                                                          vs                                                                                        scalar                                                                                      (x-factor)detect::Fast_Params::(20, 2, false, "cv/cameracalibration/chess9.png")  21.082 32.090    0.66detect::Fast_Params::(20, 2, false, "cv/inpaint/orig.png")              4.837  9.157     0.53detect::Fast_Params::(20, 2, true, "cv/cameracalibration/chess9.png")   25.479 33.576    0.76detect::Fast_Params::(20, 2, true, "cv/inpaint/orig.png")               7.549  9.716     0.78detect::Fast_Params::(30, 2, false, "cv/cameracalibration/chess9.png")  18.463 30.087    0.61detect::Fast_Params::(30, 2, false, "cv/inpaint/orig.png")              3.716  6.544     0.57detect::Fast_Params::(30, 2, true, "cv/cameracalibration/chess9.png")   21.548 31.374    0.69detect::Fast_Params::(30, 2, true, "cv/inpaint/orig.png")               5.107  6.928     0.74detect::Fast_Params::(100, 2, false, "cv/cameracalibration/chess9.png") 13.763 8.712     1.58detect::Fast_Params::(100, 2, false, "cv/inpaint/orig.png")             2.578  1.284     2.01detect::Fast_Params::(100, 2, true, "cv/cameracalibration/chess9.png")  13.804 8.831     1.56detect::Fast_Params::(100, 2, true, "cv/inpaint/orig.png")              2.615  1.289     2.03# Clang                             Name of Test                               scalar  rvv      rvv                                                                                          vs                                                                                        scalar                                                                                      (x-factor)detect::Fast_Params::(20, 2, false, "cv/cameracalibration/chess9.png")  23.424 35.072    0.67detect::Fast_Params::(20, 2, false, "cv/inpaint/orig.png")              5.284  10.107    0.52detect::Fast_Params::(20, 2, true, "cv/cameracalibration/chess9.png")   26.487 35.978    0.74detect::Fast_Params::(20, 2, true, "cv/inpaint/orig.png")               7.146  10.612    0.67detect::Fast_Params::(30, 2, false, "cv/cameracalibration/chess9.png")  21.155 32.858    0.64detect::Fast_Params::(30, 2, false, "cv/inpaint/orig.png")              4.101  7.153     0.57detect::Fast_Params::(30, 2, true, "cv/cameracalibration/chess9.png")   23.321 33.505    0.70detect::Fast_Params::(30, 2, true, "cv/inpaint/orig.png")               5.106  7.415     0.69detect::Fast_Params::(100, 2, false, "cv/cameracalibration/chess9.png") 15.597 8.792     1.77detect::Fast_Params::(100, 2, false, "cv/inpaint/orig.png")             2.922  1.228     2.38detect::Fast_Params::(100, 2, true, "cv/cameracalibration/chess9.png")  15.626 8.817     1.77detect::Fast_Params::(100, 2, true, "cv/inpaint/orig.png")              2.963  1.240     2.39```### Pull Request Readiness ChecklistSee details athttps://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- [ ] 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.- [ ] The feature is well documented and sample code can be built with the project CMake
Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment

Reviewers

@fengyuentaufengyuentaufengyuentau left review comments

@vpisarevvpisarevvpisarev approved these changes

@asmorkalovasmorkalovasmorkalov approved these changes

Assignees

@vpisarevvpisarev

Projects

None yet

Milestone

4.13.0

Development

Successfully merging this pull request may close these issues.

5 participants

@Haosonn@asmorkalov@fengyuentau@vpisarev@opencv-alalek

[8]ページ先頭

©2009-2025 Movatter.jp