mirror of
https://github.com/zebrajr/opencv.git
synced 2025-12-06 00:19:46 +01:00
hal/riscv-rvv: implement FAST keypoint detection #27391 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.93 detect::Fast_Params::(20, 2, false, "cv/inpaint/orig.png") 4.605 7.168 0.64 detect::Fast_Params::(20, 2, true, "cv/cameracalibration/chess9.png") 26.228 24.689 1.06 detect::Fast_Params::(20, 2, true, "cv/inpaint/orig.png") 7.134 7.561 0.94 detect::Fast_Params::(30, 2, false, "cv/cameracalibration/chess9.png") 19.488 21.407 0.91 detect::Fast_Params::(30, 2, false, "cv/inpaint/orig.png") 3.481 5.404 0.64 detect::Fast_Params::(30, 2, true, "cv/cameracalibration/chess9.png") 22.309 22.145 1.01 detect::Fast_Params::(30, 2, true, "cv/inpaint/orig.png") 4.826 5.654 0.85 detect::Fast_Params::(100, 2, false, "cv/cameracalibration/chess9.png") 14.108 8.205 1.72 detect::Fast_Params::(100, 2, false, "cv/inpaint/orig.png") 2.520 1.072 2.35 detect::Fast_Params::(100, 2, true, "cv/cameracalibration/chess9.png") 14.133 8.410 1.68 detect::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.06 detect::Fast_Params::(20, 2, false, "cv/inpaint/orig.png") 4.987 7.168 0.70 detect::Fast_Params::(20, 2, true, "cv/cameracalibration/chess9.png") 28.035 24.467 1.15 detect::Fast_Params::(20, 2, true, "cv/inpaint/orig.png") 6.760 7.503 0.90 detect::Fast_Params::(30, 2, false, "cv/cameracalibration/chess9.png") 22.954 21.373 1.07 detect::Fast_Params::(30, 2, false, "cv/inpaint/orig.png") 3.838 5.330 0.72 detect::Fast_Params::(30, 2, true, "cv/cameracalibration/chess9.png") 24.523 21.998 1.11 detect::Fast_Params::(30, 2, true, "cv/inpaint/orig.png") 4.795 5.543 0.87 detect::Fast_Params::(100, 2, false, "cv/cameracalibration/chess9.png") 16.799 8.102 2.07 detect::Fast_Params::(100, 2, false, "cv/inpaint/orig.png") 2.874 1.024 2.81 detect::Fast_Params::(100, 2, true, "cv/cameracalibration/chess9.png") 16.950 8.073 2.10 detect::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.66 detect::Fast_Params::(20, 2, false, "cv/inpaint/orig.png") 4.837 9.157 0.53 detect::Fast_Params::(20, 2, true, "cv/cameracalibration/chess9.png") 25.479 33.576 0.76 detect::Fast_Params::(20, 2, true, "cv/inpaint/orig.png") 7.549 9.716 0.78 detect::Fast_Params::(30, 2, false, "cv/cameracalibration/chess9.png") 18.463 30.087 0.61 detect::Fast_Params::(30, 2, false, "cv/inpaint/orig.png") 3.716 6.544 0.57 detect::Fast_Params::(30, 2, true, "cv/cameracalibration/chess9.png") 21.548 31.374 0.69 detect::Fast_Params::(30, 2, true, "cv/inpaint/orig.png") 5.107 6.928 0.74 detect::Fast_Params::(100, 2, false, "cv/cameracalibration/chess9.png") 13.763 8.712 1.58 detect::Fast_Params::(100, 2, false, "cv/inpaint/orig.png") 2.578 1.284 2.01 detect::Fast_Params::(100, 2, true, "cv/cameracalibration/chess9.png") 13.804 8.831 1.56 detect::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.67 detect::Fast_Params::(20, 2, false, "cv/inpaint/orig.png") 5.284 10.107 0.52 detect::Fast_Params::(20, 2, true, "cv/cameracalibration/chess9.png") 26.487 35.978 0.74 detect::Fast_Params::(20, 2, true, "cv/inpaint/orig.png") 7.146 10.612 0.67 detect::Fast_Params::(30, 2, false, "cv/cameracalibration/chess9.png") 21.155 32.858 0.64 detect::Fast_Params::(30, 2, false, "cv/inpaint/orig.png") 4.101 7.153 0.57 detect::Fast_Params::(30, 2, true, "cv/cameracalibration/chess9.png") 23.321 33.505 0.70 detect::Fast_Params::(30, 2, true, "cv/inpaint/orig.png") 5.106 7.415 0.69 detect::Fast_Params::(100, 2, false, "cv/cameracalibration/chess9.png") 15.597 8.792 1.77 detect::Fast_Params::(100, 2, false, "cv/inpaint/orig.png") 2.922 1.228 2.38 detect::Fast_Params::(100, 2, true, "cv/cameracalibration/chess9.png") 15.626 8.817 1.77 detect::Fast_Params::(100, 2, true, "cv/inpaint/orig.png") 2.963 1.240 2.39 ``` ### 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 - [ ] 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
28 lines
1.2 KiB
CMake
28 lines
1.2 KiB
CMake
cmake_minimum_required(VERSION ${MIN_VER_CMAKE} FATAL_ERROR)
|
|
|
|
set(RVV_HAL_INCLUDE_DIR include)
|
|
set(RVV_HAL_SOURCE_DIR src)
|
|
|
|
file(GLOB rvv_hal_headers RELATIVE "${CMAKE_CURRENT_LIST_DIR}" "${RVV_HAL_INCLUDE_DIR}/*.hpp")
|
|
file(GLOB rvv_hal_sources RELATIVE "${CMAKE_CURRENT_LIST_DIR}" "${RVV_HAL_SOURCE_DIR}/**/*.cpp")
|
|
|
|
set(HAL_LIB_NAME "rvv_hal")
|
|
add_library(${HAL_LIB_NAME} STATIC)
|
|
target_sources(${HAL_LIB_NAME} PRIVATE ${rvv_hal_headers} ${rvv_hal_sources})
|
|
|
|
set_target_properties(${HAL_LIB_NAME} PROPERTIES ARCHIVE_OUTPUT_DIRECTORY ${3P_LIBRARY_OUTPUT_PATH})
|
|
if(NOT BUILD_SHARED_LIBS)
|
|
ocv_install_target(${HAL_LIB_NAME} EXPORT OpenCVModules ARCHIVE DESTINATION ${OPENCV_3P_LIB_INSTALL_PATH} COMPONENT dev)
|
|
endif()
|
|
target_include_directories(${HAL_LIB_NAME} PRIVATE
|
|
${CMAKE_CURRENT_SOURCE_DIR}
|
|
${CMAKE_SOURCE_DIR}/modules/core/include
|
|
${CMAKE_SOURCE_DIR}/modules/imgproc/include
|
|
${CMAKE_SOURCE_DIR}/modules/features2d/include)
|
|
|
|
set(RVV_HAL_FOUND TRUE CACHE INTERNAL "")
|
|
set(RVV_HAL_VERSION "0.0.1" CACHE INTERNAL "")
|
|
set(RVV_HAL_LIBRARIES ${HAL_LIB_NAME} CACHE INTERNAL "")
|
|
set(RVV_HAL_HEADERS "rvv_hal.hpp" CACHE INTERNAL "")
|
|
set(RVV_HAL_INCLUDE_DIRS "${CMAKE_CURRENT_SOURCE_DIR}" CACHE INTERNAL "")
|