├── .gitignore ├── CMakeLists.txt ├── README.md ├── cmake └── overlook.cmake ├── images ├── 20230818154136.jpg ├── 20230818154255.jpg ├── 20230818154307.jpg ├── 20230818154326.jpg ├── 20230818154401.jpg ├── 20230818154430.jpg ├── 20230818154510.jpg ├── 20230818154528.jpg ├── 20230818154558.jpg └── test.jpg ├── qtproj └── SAMQT │ ├── .gitignore │ ├── CMakeLists.txt │ ├── libsam │ ├── main.cpp │ ├── mainwindow.cpp │ ├── mainwindow.h │ ├── mainwindow.ui │ ├── myqlabel.h │ └── style │ ├── DarkStyle.cpp │ └── DarkStyle.h ├── results ├── inpainted.jpg ├── rect_result_0.jpg ├── rect_result_1.jpg ├── rect_result_2.jpg ├── rect_result_3.jpg ├── result_0.jpg ├── result_1.jpg ├── result_2.jpg └── result_3.jpg ├── src ├── Runner │ ├── BaseRunner.cpp │ ├── BaseRunner.hpp │ ├── LamaInpaint.hpp │ ├── LamaInpaintAX650.hpp │ ├── LamaInpaintOnnx.hpp │ ├── OnnxWarpper │ │ └── OnnxWarpper.hpp │ ├── OpenvinoWarpper │ │ └── OpenvinoWarpper.hpp │ ├── SAM.hpp │ ├── SAMDecoderOnnx.hpp │ ├── SAMEncoder.hpp │ ├── SAMEncoderAX650.hpp │ ├── SAMEncoderOnnx.hpp │ ├── ax_model_runner.hpp │ ├── ax_model_runner_ax650.cpp │ ├── ax_model_runner_ax650.hpp │ ├── sample_log.h │ └── string_utility.hpp ├── cmdline.hpp ├── main.cpp └── main_inpaint.cpp ├── third_party ├── libopencv-4.6-aarch64-none │ ├── bin │ │ └── setup_vars_opencv4.sh │ ├── include │ │ └── opencv4 │ │ │ └── opencv2 │ │ │ ├── core.hpp │ │ │ ├── core │ │ │ ├── affine.hpp │ │ │ ├── async.hpp │ │ │ ├── base.hpp │ │ │ ├── bindings_utils.hpp │ │ │ ├── bufferpool.hpp │ │ │ ├── check.hpp │ │ │ ├── core.hpp │ │ │ ├── core_c.h │ │ │ ├── cuda.hpp │ │ │ ├── cuda.inl.hpp │ │ │ ├── cuda │ │ │ │ ├── block.hpp │ │ │ │ ├── border_interpolate.hpp │ │ │ │ ├── color.hpp │ │ │ │ ├── common.hpp │ │ │ │ ├── datamov_utils.hpp │ │ │ │ ├── detail │ │ │ │ │ ├── color_detail.hpp │ │ │ │ │ ├── reduce.hpp │ │ │ │ │ ├── reduce_key_val.hpp │ │ │ │ │ ├── transform_detail.hpp │ │ │ │ │ ├── type_traits_detail.hpp │ │ │ │ │ └── vec_distance_detail.hpp │ │ │ │ ├── dynamic_smem.hpp │ │ │ │ ├── emulation.hpp │ │ │ │ ├── filters.hpp │ │ │ │ ├── funcattrib.hpp │ │ │ │ ├── functional.hpp │ │ │ │ ├── limits.hpp │ │ │ │ ├── reduce.hpp │ │ │ │ ├── saturate_cast.hpp │ │ │ │ ├── scan.hpp │ │ │ │ ├── simd_functions.hpp │ │ │ │ ├── transform.hpp │ │ │ │ ├── type_traits.hpp │ │ │ │ ├── utility.hpp │ │ │ │ ├── vec_distance.hpp │ │ │ │ ├── vec_math.hpp │ │ │ │ ├── vec_traits.hpp │ │ │ │ ├── warp.hpp │ │ │ │ ├── warp_reduce.hpp │ │ │ │ └── warp_shuffle.hpp │ │ │ ├── cuda_stream_accessor.hpp │ │ │ ├── cuda_types.hpp │ │ │ ├── cv_cpu_dispatch.h │ │ │ ├── cv_cpu_helper.h │ │ │ ├── cvdef.h │ │ │ ├── cvstd.hpp │ │ │ ├── cvstd.inl.hpp │ │ │ ├── cvstd_wrapper.hpp │ │ │ ├── detail │ │ │ │ ├── async_promise.hpp │ │ │ │ ├── dispatch_helper.impl.hpp │ │ │ │ └── exception_ptr.hpp │ │ │ ├── directx.hpp │ │ │ ├── dualquaternion.hpp │ │ │ ├── dualquaternion.inl.hpp │ │ │ ├── eigen.hpp │ │ │ ├── fast_math.hpp │ │ │ ├── hal │ │ │ │ ├── hal.hpp │ │ │ │ ├── interface.h │ │ │ │ ├── intrin.hpp │ │ │ │ ├── intrin_avx.hpp │ │ │ │ ├── intrin_avx512.hpp │ │ │ │ ├── intrin_cpp.hpp │ │ │ │ ├── intrin_forward.hpp │ │ │ │ ├── intrin_msa.hpp │ │ │ │ ├── intrin_neon.hpp │ │ │ │ ├── intrin_rvv.hpp │ │ │ │ ├── intrin_rvv071.hpp │ │ │ │ ├── intrin_sse.hpp │ │ │ │ ├── intrin_sse_em.hpp │ │ │ │ ├── intrin_vsx.hpp │ │ │ │ ├── intrin_wasm.hpp │ │ │ │ ├── msa_macros.h │ │ │ │ └── simd_utils.impl.hpp │ │ │ ├── mat.hpp │ │ │ ├── mat.inl.hpp │ │ │ ├── matx.hpp │ │ │ ├── neon_utils.hpp │ │ │ ├── ocl.hpp │ │ │ ├── ocl_genbase.hpp │ │ │ ├── opencl │ │ │ │ ├── ocl_defs.hpp │ │ │ │ ├── opencl_info.hpp │ │ │ │ ├── opencl_svm.hpp │ │ │ │ └── runtime │ │ │ │ │ ├── autogenerated │ │ │ │ │ ├── opencl_clblas.hpp │ │ │ │ │ ├── opencl_clfft.hpp │ │ │ │ │ ├── opencl_core.hpp │ │ │ │ │ ├── opencl_core_wrappers.hpp │ │ │ │ │ ├── opencl_gl.hpp │ │ │ │ │ └── opencl_gl_wrappers.hpp │ │ │ │ │ ├── opencl_clblas.hpp │ │ │ │ │ ├── opencl_clfft.hpp │ │ │ │ │ ├── opencl_core.hpp │ │ │ │ │ ├── opencl_core_wrappers.hpp │ │ │ │ │ ├── opencl_gl.hpp │ │ │ │ │ ├── opencl_gl_wrappers.hpp │ │ │ │ │ ├── opencl_svm_20.hpp │ │ │ │ │ ├── opencl_svm_definitions.hpp │ │ │ │ │ └── opencl_svm_hsa_extension.hpp │ │ │ ├── opengl.hpp │ │ │ ├── operations.hpp │ │ │ ├── optim.hpp │ │ │ ├── ovx.hpp │ │ │ ├── parallel │ │ │ │ ├── backend │ │ │ │ │ ├── parallel_for.openmp.hpp │ │ │ │ │ └── parallel_for.tbb.hpp │ │ │ │ └── parallel_backend.hpp │ │ │ ├── persistence.hpp │ │ │ ├── quaternion.hpp │ │ │ ├── quaternion.inl.hpp │ │ │ ├── saturate.hpp │ │ │ ├── simd_intrinsics.hpp │ │ │ ├── softfloat.hpp │ │ │ ├── sse_utils.hpp │ │ │ ├── traits.hpp │ │ │ ├── types.hpp │ │ │ ├── types_c.h │ │ │ ├── utility.hpp │ │ │ ├── utils │ │ │ │ ├── allocator_stats.hpp │ │ │ │ ├── allocator_stats.impl.hpp │ │ │ │ ├── filesystem.hpp │ │ │ │ ├── fp_control_utils.hpp │ │ │ │ ├── instrumentation.hpp │ │ │ │ ├── logger.defines.hpp │ │ │ │ ├── logger.hpp │ │ │ │ ├── logtag.hpp │ │ │ │ ├── tls.hpp │ │ │ │ └── trace.hpp │ │ │ ├── va_intel.hpp │ │ │ ├── version.hpp │ │ │ └── vsx_utils.hpp │ │ │ ├── cvconfig.h │ │ │ ├── features2d.hpp │ │ │ ├── features2d │ │ │ ├── features2d.hpp │ │ │ └── hal │ │ │ │ └── interface.h │ │ │ ├── highgui.hpp │ │ │ ├── highgui │ │ │ └── highgui.hpp │ │ │ ├── imgproc.hpp │ │ │ ├── imgproc │ │ │ ├── bindings.hpp │ │ │ ├── detail │ │ │ │ └── gcgraph.hpp │ │ │ ├── hal │ │ │ │ ├── hal.hpp │ │ │ │ └── interface.h │ │ │ ├── imgproc.hpp │ │ │ ├── imgproc_c.h │ │ │ ├── segmentation.hpp │ │ │ └── types_c.h │ │ │ ├── opencv.hpp │ │ │ ├── opencv_modules.hpp │ │ │ ├── photo.hpp │ │ │ ├── photo │ │ │ ├── cuda.hpp │ │ │ ├── legacy │ │ │ │ └── constants_c.h │ │ │ └── photo.hpp │ │ │ ├── video.hpp │ │ │ └── video │ │ │ ├── background_segm.hpp │ │ │ ├── detail │ │ │ └── tracking.detail.hpp │ │ │ ├── legacy │ │ │ └── constants_c.h │ │ │ ├── tracking.hpp │ │ │ └── video.hpp │ └── lib │ │ └── cmake │ │ └── opencv4 │ │ ├── OpenCVConfig-version.cmake │ │ ├── OpenCVConfig.cmake │ │ ├── OpenCVModules-release.cmake │ │ └── OpenCVModules.cmake └── onnxruntime-aarch64-none-gnu-1.16.0 │ ├── include │ ├── cpu_provider_factory.h │ ├── onnxruntime_c_api.h │ ├── onnxruntime_cxx_api.h │ ├── onnxruntime_cxx_inline.h │ ├── onnxruntime_float16.h │ ├── onnxruntime_run_options_config_keys.h │ └── onnxruntime_session_options_config_keys.h │ └── lib │ ├── cmake │ └── onnxruntime │ │ ├── onnxruntimeConfig.cmake │ │ ├── onnxruntimeConfigVersion.cmake │ │ ├── onnxruntimeTargets-release.cmake │ │ └── onnxruntimeTargets.cmake │ ├── libonnxruntime.so.1.16.0 │ └── pkgconfig │ └── libonnxruntime.pc ├── toolchains └── aarch64-none-linux-gnu.toolchain.cmake └── webui.py /.gitignore: -------------------------------------------------------------------------------- 1 | # build 2 | build* 3 | 4 | # .vscode 5 | .vscode/ 6 | 7 | # data 8 | data/ 9 | 10 | # dynamic library/static library 11 | *.lib 12 | *.a 13 | *.dll 14 | *.so 15 | *.exp 16 | *.pdb 17 | 18 | # model 19 | ax_models 20 | onnx_models 21 | axpi_pro_bsp_sdk 22 | third_party/opencv-mobile-* 23 | third_party/*.zip 24 | third_party/*.onnx 25 | third_party/*.axmodel 26 | -------------------------------------------------------------------------------- /CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # set cmake_install_prefix path 2 | if(NOT DEFINED CMAKE_INSTALL_PREFIX) 3 | set(CMAKE_INSTALL_PREFIX "${CMAKE_BINARY_DIR}/install" CACHE PATH "Installation Directory") 4 | endif() 5 | 6 | message(STATUS "CMAKE_INSTALL_PREFIX = ${CMAKE_INSTALL_PREFIX}") 7 | 8 | # check if building type is not set 9 | if(NOT CMAKE_BUILD_TYPE) 10 | set(CMAKE_BUILD_TYPE Release CACHE STRING "Choose the type of build" FORCE) 11 | endif() 12 | 13 | # bsp 14 | if(NOT BSP_MSP_DIR) 15 | set(BSP_MSP_DIR ${CMAKE_SOURCE_DIR}/axpi_pro_bsp_sdk/msp/out) 16 | endif() 17 | 18 | message(STATUS "BSP_MSP_DIR = ${BSP_MSP_DIR}") 19 | 20 | # set(CMAKE_TOOLCHAIN_FILE ${CMAKE_SOURCE_DIR}/toolchains/aarch64-none-linux-gnu.toolchain.cmake) 21 | cmake_minimum_required(VERSION 3.0) 22 | project(SegmentAnything-AX650) 23 | 24 | # 添加 FLAGS 检查代码是否有明显 bug 25 | include(cmake/overlook.cmake) 26 | 27 | add_compile_options(-std=c++17) 28 | set(CMAKE_CXX_STANDARD 17) 29 | set(CMAKE_CXX_STANDARD_REQUIRED ON) 30 | 31 | # link third-party library onnxruntime-win-x64-1.14.1 and opencv4 32 | if(NOT ONNXRUNTIME_DIR) 33 | set(ONNXRUNTIME_DIR ${CMAKE_SOURCE_DIR}/third_party/onnxruntime-aarch64-none-gnu-1.16.0) 34 | endif() 35 | 36 | message(STATUS "ONNXRUNTIME_DIR Path: ${ONNXRUNTIME_DIR}") 37 | 38 | include_directories(${ONNXRUNTIME_DIR}/include) 39 | link_directories("${ONNXRUNTIME_DIR}/lib") 40 | set(ONNXRUNTIME_LIB onnxruntime) 41 | 42 | if(NOT OpenCV_DIR) 43 | set(OpenCV_DIR ${CMAKE_SOURCE_DIR}/third_party/libopencv-4.6-aarch64-none/lib/cmake/opencv4) 44 | endif() 45 | 46 | message(STATUS "OPENCV_DIR Path: ${OpenCV_DIR}") 47 | find_package(OpenCV REQUIRED) 48 | 49 | include_directories(${OpenCV_INCLUDE_DIRS}) 50 | include_directories(${BSP_MSP_DIR}/include) 51 | link_directories(${BSP_MSP_DIR}/lib) 52 | 53 | option(BUILD_WITH_AX650 "build with ax650" OFF) 54 | 55 | if(BUILD_WITH_AX650) 56 | add_compile_definitions(BUILD_WITH_AX650) 57 | endif() 58 | 59 | message(STATUS "BUILD_WITH_AX650 : ${BUILD_WITH_AX650}") 60 | 61 | add_library(sam STATIC 62 | src/Runner/BaseRunner.cpp 63 | src/Runner/ax_model_runner_ax650.cpp 64 | ) 65 | 66 | add_executable(main src/main.cpp) 67 | 68 | target_link_libraries(main sam) 69 | 70 | target_link_libraries(main ${OpenCV_LIBS}) 71 | target_link_libraries(main gomp ${ONNXRUNTIME_LIB}) 72 | 73 | if(BUILD_WITH_AX650) 74 | target_link_libraries(main ax_engine ax_interpreter ax_sys ax_ivps) 75 | endif() 76 | 77 | install(TARGETS main DESTINATION bin) 78 | 79 | 80 | add_executable(main_inpaint src/main_inpaint.cpp) 81 | 82 | target_link_libraries(main_inpaint sam) 83 | 84 | target_link_libraries(main_inpaint ${OpenCV_LIBS}) 85 | target_link_libraries(main_inpaint gomp ${ONNXRUNTIME_LIB}) 86 | 87 | if(BUILD_WITH_AX650) 88 | target_link_libraries(main_inpaint ax_engine ax_interpreter ax_sys ax_ivps) 89 | endif() 90 | 91 | install(TARGETS main_inpaint DESTINATION bin) 92 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Inpaint Anything 2 | 3 | https://github.com/ZHEQIUSHUI/SAM-ONNX-AX650-CPP/assets/46700201/82b35088-7e9c-46b8-980f-bc9a3bc9996c 4 | 5 | ## Build 6 | ```bash 7 | mkdir build 8 | cd build 9 | ``` 10 | if x86 onnxruntime 11 | ```bash 12 | cmake -DONNXRUNTIME_DIR=${onnxruntime_dir} -DOpenCV_DIR=${opencv_cmake_file_dir} .. 13 | ``` 14 | else if ax650 15 | ```bash 16 | cmake -DONNXRUNTIME_DIR=${onnxruntime_dir} -DOpenCV_DIR=${opencv_cmake_file_dir} -DBSP_MSP_DIR=${msp_out_dir} -DBUILD_WITH_AX650=ON .. 17 | ``` 18 | ```bash 19 | make -j4 20 | ``` 21 | 22 | ### Build with QT 23 | 24 | ```bash 25 | cd qtproj 26 | mkdir build 27 | ``` 28 | build for x86 (for example qt5.14.2,ubuntu 20.04,you need to download opencv and onnxruntime) 29 | ```bash 30 | cmake -DONNXRUNTIME_DIR=${onnxruntime_dir} -DOpenCV_DIR=${opencv_cmake_file_dir} -DQt5_DIR=${qt5_dir}/5.14.2/gcc_64/lib/cmake/Qt5 ../SAMQT/ 31 | ``` 32 | build for AX650 on board(爱芯派pro,you need to download opencv onnxruntime in this repos releases) 33 | ```bash 34 | apt install cmake qt6-base-dev qtcreator 35 | cmake -DONNXRUNTIME_DIR=${onnxruntime_dir} -DOpenCV_DIR=${opencv_cmake_file_dir} -DBSP_MSP_DIR=${msp_out_dir} -DBUILD_WITH_AX650=ON ../SAMQT/ 36 | ``` 37 | ``` 38 | make -j4 39 | ``` 40 | ## Usage 41 | 42 | ![](test.jpg) 43 | 44 | ### Segment Anything 45 | ``` 46 | /opt/test/sam # ./main -e ax_models/sam-encoder.axmodel -d ax_models/sam_vit_b_01ec64_decoder.onnx -i test.jpg 47 | Engine creating handle is done. 48 | Engine creating context is done. 49 | Engine get io info is done. 50 | Engine alloc io is done. 51 | [I][ init][ 233]: BGR MODEL 52 | Encoder Inference Cost time : 0.737574s 53 | Decoder Inference Cost time : 0.448962s 54 | 0.96 55 | 0.95 56 | 0.96 57 | 0.86 58 | Decoder Inference Cost time : 0.438249s 59 | 0.98 60 | 1.00 61 | 0.98 62 | 0.91 63 | ``` 64 | 65 | 66 | 67 | 68 | 69 | ### Inpaint 70 | ``` 71 | /opt/test/sam # ./main_inpaint -m big-lama-regular.axmodel -i test.jpg --mask result_1 72 | .jpg 73 | image 1920x1282 74 | mask 1920x1282 75 | Engine creating handle is done. 76 | Engine creating context is done. 77 | Engine get io info is done. 78 | Engine alloc io is done. 79 | [I][ init][ 275]: RGB MODEL 80 | Inpaint Inference Cost time : 0.582908s 81 | ``` 82 | 83 | 84 | ## Reference 85 | [segment-anything](https://github.com/facebookresearch/segment-anything)\ 86 | [MobileSAM](https://github.com/ChaoningZhang/MobileSAM)\ 87 | [lama](https://github.com/advimman/lama)\ 88 | [SegmentAnything-OnnxRunner](https://github.com/OroChippw/SegmentAnything-OnnxRunner) 89 | -------------------------------------------------------------------------------- /images/20230818154136.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ZHEQIUSHUI/SAM-ONNX-AX650-CPP/dacdc31a8aafa7628a70fae237ebcd48c454d9a2/images/20230818154136.jpg -------------------------------------------------------------------------------- /images/20230818154255.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ZHEQIUSHUI/SAM-ONNX-AX650-CPP/dacdc31a8aafa7628a70fae237ebcd48c454d9a2/images/20230818154255.jpg -------------------------------------------------------------------------------- /images/20230818154307.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ZHEQIUSHUI/SAM-ONNX-AX650-CPP/dacdc31a8aafa7628a70fae237ebcd48c454d9a2/images/20230818154307.jpg -------------------------------------------------------------------------------- /images/20230818154326.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ZHEQIUSHUI/SAM-ONNX-AX650-CPP/dacdc31a8aafa7628a70fae237ebcd48c454d9a2/images/20230818154326.jpg -------------------------------------------------------------------------------- /images/20230818154401.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ZHEQIUSHUI/SAM-ONNX-AX650-CPP/dacdc31a8aafa7628a70fae237ebcd48c454d9a2/images/20230818154401.jpg -------------------------------------------------------------------------------- /images/20230818154430.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ZHEQIUSHUI/SAM-ONNX-AX650-CPP/dacdc31a8aafa7628a70fae237ebcd48c454d9a2/images/20230818154430.jpg -------------------------------------------------------------------------------- /images/20230818154510.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ZHEQIUSHUI/SAM-ONNX-AX650-CPP/dacdc31a8aafa7628a70fae237ebcd48c454d9a2/images/20230818154510.jpg -------------------------------------------------------------------------------- /images/20230818154528.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ZHEQIUSHUI/SAM-ONNX-AX650-CPP/dacdc31a8aafa7628a70fae237ebcd48c454d9a2/images/20230818154528.jpg -------------------------------------------------------------------------------- /images/20230818154558.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ZHEQIUSHUI/SAM-ONNX-AX650-CPP/dacdc31a8aafa7628a70fae237ebcd48c454d9a2/images/20230818154558.jpg -------------------------------------------------------------------------------- /images/test.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ZHEQIUSHUI/SAM-ONNX-AX650-CPP/dacdc31a8aafa7628a70fae237ebcd48c454d9a2/images/test.jpg -------------------------------------------------------------------------------- /qtproj/SAMQT/.gitignore: -------------------------------------------------------------------------------- 1 | CMakeLists.txt.user* -------------------------------------------------------------------------------- /qtproj/SAMQT/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | cmake_minimum_required(VERSION 3.5) 2 | 3 | project(SAMQT LANGUAGES CXX) 4 | 5 | set(CMAKE_INCLUDE_CURRENT_DIR ON) 6 | 7 | set(CMAKE_AUTOUIC ON) 8 | set(CMAKE_AUTOMOC ON) 9 | set(CMAKE_AUTORCC ON) 10 | 11 | set(CMAKE_CXX_STANDARD 11) 12 | set(CMAKE_CXX_STANDARD_REQUIRED ON) 13 | 14 | # QtCreator supports the following variables for Android, which are identical to qmake Android variables. 15 | # Check http://doc.qt.io/qt-5/deployment-android.html for more information. 16 | # They need to be set before the find_package(Qt5 ...) call. 17 | 18 | #if(ANDROID) 19 | # set(ANDROID_PACKAGE_SOURCE_DIR "${CMAKE_CURRENT_SOURCE_DIR}/android") 20 | # if (ANDROID_ABI STREQUAL "armeabi-v7a") 21 | # set(ANDROID_EXTRA_LIBS 22 | # ${CMAKE_CURRENT_SOURCE_DIR}/path/to/libcrypto.so 23 | # ${CMAKE_CURRENT_SOURCE_DIR}/path/to/libssl.so) 24 | # endif() 25 | #endif() 26 | 27 | add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/libsam) 28 | 29 | find_package(Qt6 COMPONENTS Widgets) 30 | if(Qt6_FOUND) 31 | set(QTWidget Qt6::Widgets) 32 | else() 33 | find_package(Qt5 COMPONENTS Widgets REQUIRED) 34 | set(QTWidget Qt5::Widgets) 35 | endif() 36 | 37 | 38 | if(ANDROID) 39 | add_library(SAMQT SHARED 40 | main.cpp 41 | mainwindow.cpp 42 | mainwindow.h 43 | mainwindow.ui 44 | ) 45 | else() 46 | add_executable(SAMQT 47 | main.cpp 48 | mainwindow.cpp 49 | mainwindow.h 50 | myqlabel.h 51 | mainwindow.ui 52 | style/DarkStyle.cpp 53 | style/DarkStyle.h 54 | ) 55 | endif() 56 | 57 | target_link_libraries(SAMQT PRIVATE ${QTWidget}) 58 | include_directories(style) 59 | include_directories(${ONNXRUNTIME_DIR}/include) 60 | target_link_directories(SAMQT PRIVATE ${ONNXRUNTIME_DIR}/lib) 61 | 62 | find_package(OpenCV REQUIRED) 63 | include_directories(${OpenCV_INCLUDE_DIRS}) 64 | 65 | target_link_libraries(SAMQT PRIVATE sam) 66 | target_link_libraries(SAMQT PRIVATE ${OpenCV_LIBS}) 67 | target_link_libraries(SAMQT PRIVATE gomp onnxruntime) 68 | 69 | if(BUILD_WITH_AX650) 70 | target_link_directories(SAMQT PRIVATE ${BSP_MSP_DIR}/lib) 71 | target_link_libraries(SAMQT PRIVATE ax_engine ax_interpreter ax_sys ax_ivps) 72 | endif() 73 | -------------------------------------------------------------------------------- /qtproj/SAMQT/libsam: -------------------------------------------------------------------------------- 1 | ../../ -------------------------------------------------------------------------------- /qtproj/SAMQT/main.cpp: -------------------------------------------------------------------------------- 1 | #include "mainwindow.h" 2 | 3 | #include 4 | 5 | #include "style/DarkStyle.h" 6 | #include "libsam/src/cmdline.hpp" 7 | 8 | int main(int argc, char *argv[]) 9 | { 10 | std::string encoder_model_path = "/root/qtproj/SAM-ONNX-AX650-CPP/ax_models/sam-encoder.axmodel"; 11 | std::string decoder_model_path = "/root/qtproj/SAM-ONNX-AX650-CPP/ax_models/sam_vit_b_01ec64_decoder.onnx"; 12 | std::string inpaint_model_path = "/root/qtproj/SAM-ONNX-AX650-CPP/ax_models/big-lama-regular.axmodel"; 13 | 14 | 15 | cmdline::parser cmd; 16 | cmd.add("encoder", 'e', "encoder model(onnx model or axmodel)", true, encoder_model_path); 17 | cmd.add("decoder", 'd', "decoder model(onnx)", true, decoder_model_path); 18 | cmd.add("inpaint", 'i', "inpaint model(onnx)", true, inpaint_model_path); 19 | 20 | cmd.parse_check(argc, argv); 21 | 22 | encoder_model_path = cmd.get("encoder"); 23 | decoder_model_path = cmd.get("decoder"); 24 | inpaint_model_path = cmd.get("inpaint"); 25 | 26 | QApplication a(argc, argv); 27 | QApplication::setStyle(new DarkStyle); 28 | MainWindow w(encoder_model_path,decoder_model_path,inpaint_model_path); 29 | w.show(); 30 | return a.exec(); 31 | } 32 | -------------------------------------------------------------------------------- /qtproj/SAMQT/mainwindow.cpp: -------------------------------------------------------------------------------- 1 | #include "mainwindow.h" 2 | #include "./ui_mainwindow.h" 3 | 4 | #include "QImage" 5 | #include "QFileDialog" 6 | #include "QMimeData" 7 | #include "QMessageBox" 8 | #include "QIntValidator" 9 | 10 | MainWindow::MainWindow(std::string encoder_model_path, std::string decoder_model_path, std::string inpaint_model_path, QWidget *parent) 11 | : QMainWindow(parent), ui(new Ui::MainWindow) 12 | { 13 | ui->setupUi(this); 14 | this->ui->label->InitModel(encoder_model_path, decoder_model_path, inpaint_model_path); 15 | this->setAcceptDrops(true); 16 | this->ui->txt_dilate->setValidator(new QIntValidator(this->ui->txt_dilate)); 17 | // this->ui->label->setAcceptDrops(true); 18 | } 19 | 20 | MainWindow::~MainWindow() 21 | { 22 | delete ui; 23 | } 24 | 25 | void MainWindow::on_btn_read_image_clicked() 26 | { 27 | auto filename = QFileDialog::getOpenFileName(this, "", "", "image(*.png *.jpg *.jpeg *.bmp)"); 28 | if (filename.isEmpty()) 29 | { 30 | return; 31 | } 32 | QImage img(filename); 33 | if (img.bits()) 34 | this->ui->label->SetImage(img); 35 | } 36 | 37 | void MainWindow::on_ckb_realtime_decode_stateChanged(int arg1) 38 | { 39 | this->ui->label->SetRealtimeDecode(this->ui->ckb_realtime_decode->isChecked()); 40 | } 41 | 42 | void MainWindow::on_btn_remove_obj_clicked() 43 | { 44 | this->setEnabled(false); 45 | repaint(); 46 | int dilate_size = 11; 47 | bool ok; 48 | dilate_size = this->ui->txt_dilate->text().toUInt(&ok); 49 | if (!ok) 50 | dilate_size = 11; 51 | if (dilate_size % 2 == 0) 52 | { 53 | dilate_size += 1; 54 | } 55 | if (dilate_size > 111) 56 | dilate_size = 111; 57 | if (dilate_size < 5) 58 | dilate_size = 5; 59 | this->ui->label->ShowRemoveObject(dilate_size, this->ui->progressBar_remove_obj, ui->ch_merge_mask->isChecked()); 60 | this->setEnabled(true); 61 | } 62 | 63 | void MainWindow::on_btn_reset_clicked() 64 | { 65 | this->ui->label->Reset(); 66 | } 67 | 68 | // void MainWindow::dragEnterEvent(QDragEnterEvent *event) 69 | //{ 70 | // if (event->mimeData()->hasUrls()) 71 | // { 72 | // event->acceptProposedAction(); 73 | // } 74 | // else 75 | // { 76 | // event->ignore(); 77 | // } 78 | // } 79 | // void MainWindow::dropEvent(QDropEvent *event) 80 | //{ 81 | // const QMimeData *mimeData = event->mimeData(); 82 | 83 | // if (!mimeData->hasUrls()) 84 | // { 85 | // return; 86 | // } 87 | 88 | // QList urlList = mimeData->urls(); 89 | 90 | // QString filename = urlList.at(0).toLocalFile(); 91 | // if (filename.isEmpty()) 92 | // { 93 | // return; 94 | // } 95 | // printf("open from drop:%s\n", filename.toStdString().c_str()); 96 | // QImage img(filename); 97 | // if (img.bits()) 98 | // this->ui->label->SetImage(img); 99 | //} 100 | 101 | void MainWindow::on_radioButton_point_clicked() 102 | { 103 | this->ui->label->SetBoxPrompt(this->ui->radioButton_box->isChecked()); 104 | } 105 | 106 | void MainWindow::on_radioButton_box_clicked() 107 | { 108 | this->ui->label->SetBoxPrompt(this->ui->radioButton_box->isChecked()); 109 | } 110 | 111 | void MainWindow::on_btn_save_img_clicked() 112 | { 113 | auto cur_image = this->ui->label->getCurrentImage(); 114 | 115 | QString filename = QFileDialog::getSaveFileName(this, 116 | tr("Save Image"), 117 | "", 118 | tr("*.bmp;; *.png;; *.jpg")); // 选择路径 119 | if (filename.isEmpty()) 120 | { 121 | return; 122 | } 123 | else 124 | { 125 | if (!(filename.endsWith(".bmp") || filename.endsWith(".png") || filename.endsWith(".jpg"))) 126 | { 127 | filename += ".png"; 128 | } 129 | 130 | if (!(cur_image.save(filename))) // 保存图像 131 | { 132 | QMessageBox::information(this, 133 | tr("Failed to save the image"), 134 | tr("Failed to save the image!")); 135 | return; 136 | } 137 | } 138 | } 139 | -------------------------------------------------------------------------------- /qtproj/SAMQT/mainwindow.h: -------------------------------------------------------------------------------- 1 | #ifndef MAINWINDOW_H 2 | #define MAINWINDOW_H 3 | 4 | #include 5 | 6 | #include "myqlabel.h" 7 | 8 | QT_BEGIN_NAMESPACE 9 | namespace Ui { class MainWindow; } 10 | QT_END_NAMESPACE 11 | 12 | class MainWindow : public QMainWindow 13 | { 14 | Q_OBJECT 15 | 16 | public: 17 | MainWindow(std::string encoder_model_path, std::string decoder_model_path, std::string inpaint_model_path, QWidget *parent = nullptr); 18 | ~MainWindow(); 19 | 20 | private slots: 21 | void on_btn_read_image_clicked(); 22 | 23 | void on_ckb_realtime_decode_stateChanged(int arg1); 24 | 25 | void on_btn_remove_obj_clicked(); 26 | 27 | void on_btn_reset_clicked(); 28 | 29 | void on_radioButton_point_clicked(); 30 | 31 | void on_radioButton_box_clicked(); 32 | 33 | void on_btn_save_img_clicked(); 34 | 35 | private: 36 | Ui::MainWindow *ui; 37 | }; 38 | #endif // MAINWINDOW_H 39 | -------------------------------------------------------------------------------- /qtproj/SAMQT/style/DarkStyle.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | ############################################################################### 3 | # # 4 | # The MIT License # 5 | # # 6 | # Copyright (C) 2017 by Juergen Skrotzky (JorgenVikingGod@gmail.com) # 7 | # >> https://github.com/Jorgen-VikingGod # 8 | # # 9 | # Sources: https://github.com/Jorgen-VikingGod/Qt-Frameless-Window-DarkStyle # 10 | # # 11 | ############################################################################### 12 | */ 13 | 14 | #include "DarkStyle.h" 15 | 16 | DarkStyle::DarkStyle() : DarkStyle(styleBase()) {} 17 | 18 | DarkStyle::DarkStyle(QStyle *style) : QProxyStyle(style) {} 19 | 20 | QStyle *DarkStyle::styleBase(QStyle *style) const { 21 | static QStyle *base = 22 | !style ? QStyleFactory::create(QStringLiteral("Fusion")) : style; 23 | return base; 24 | } 25 | 26 | QStyle *DarkStyle::baseStyle() const { return styleBase(); } 27 | 28 | void DarkStyle::polish(QPalette &palette) { 29 | // modify palette to dark 30 | palette.setColor(QPalette::Window, QColor(53, 53, 53)); 31 | palette.setColor(QPalette::WindowText, Qt::white); 32 | palette.setColor(QPalette::Disabled, QPalette::WindowText, 33 | QColor(127, 127, 127)); 34 | palette.setColor(QPalette::Base, QColor(42, 42, 42)); 35 | palette.setColor(QPalette::AlternateBase, QColor(66, 66, 66)); 36 | palette.setColor(QPalette::ToolTipBase, Qt::white); 37 | palette.setColor(QPalette::ToolTipText, QColor(53, 53, 53)); 38 | palette.setColor(QPalette::Text, Qt::white); 39 | palette.setColor(QPalette::Disabled, QPalette::Text, QColor(127, 127, 127)); 40 | palette.setColor(QPalette::Dark, QColor(35, 35, 35)); 41 | palette.setColor(QPalette::Shadow, QColor(20, 20, 20)); 42 | palette.setColor(QPalette::Button, QColor(53, 53, 53)); 43 | palette.setColor(QPalette::ButtonText, Qt::white); 44 | palette.setColor(QPalette::Disabled, QPalette::ButtonText, 45 | QColor(127, 127, 127)); 46 | palette.setColor(QPalette::BrightText, Qt::red); 47 | palette.setColor(QPalette::Link, QColor(42, 130, 218)); 48 | palette.setColor(QPalette::Highlight, QColor(42, 130, 218)); 49 | palette.setColor(QPalette::Disabled, QPalette::Highlight, QColor(80, 80, 80)); 50 | palette.setColor(QPalette::HighlightedText, Qt::white); 51 | palette.setColor(QPalette::Disabled, QPalette::HighlightedText, 52 | QColor(127, 127, 127)); 53 | } 54 | 55 | void DarkStyle::polish(QApplication *app) { 56 | if (!app) return; 57 | 58 | // increase font size for better reading, 59 | // setPointSize was reduced from +2 because when applied this way in Qt5, the 60 | // font is larger than intended for some reason 61 | QFont defaultFont = QApplication::font(); 62 | defaultFont.setPointSize(defaultFont.pointSize() + 1); 63 | app->setFont(defaultFont); 64 | 65 | // loadstylesheet 66 | QFile qfDarkstyle(QStringLiteral(":/darkstyle/darkstyle.qss")); 67 | if (qfDarkstyle.open(QIODevice::ReadOnly | QIODevice::Text)) { 68 | // set stylesheet 69 | QString qsStylesheet = QString::fromLatin1(qfDarkstyle.readAll()); 70 | app->setStyleSheet(qsStylesheet); 71 | qfDarkstyle.close(); 72 | } 73 | } -------------------------------------------------------------------------------- /qtproj/SAMQT/style/DarkStyle.h: -------------------------------------------------------------------------------- 1 | /* 2 | ############################################################################### 3 | # # 4 | # The MIT License # 5 | # # 6 | # Copyright (C) 2017 by Juergen Skrotzky (JorgenVikingGod@gmail.com) # 7 | # >> https://github.com/Jorgen-VikingGod # 8 | # # 9 | # Sources: https://github.com/Jorgen-VikingGod/Qt-Frameless-Window-DarkStyle # 10 | # # 11 | ############################################################################### 12 | */ 13 | 14 | #ifndef DARKSTYLE_HPP 15 | #define DARKSTYLE_HPP 16 | 17 | #include 18 | #include 19 | #include 20 | #include 21 | #include 22 | 23 | class DarkStyle : public QProxyStyle { 24 | Q_OBJECT 25 | 26 | public: 27 | DarkStyle(); 28 | explicit DarkStyle(QStyle *style); 29 | 30 | QStyle *baseStyle() const; 31 | 32 | void polish(QPalette &palette) override; 33 | void polish(QApplication *app) override; 34 | 35 | private: 36 | QStyle *styleBase(QStyle *style = Q_NULLPTR) const; 37 | }; 38 | 39 | #endif // DARKSTYLE_HPP -------------------------------------------------------------------------------- /results/inpainted.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ZHEQIUSHUI/SAM-ONNX-AX650-CPP/dacdc31a8aafa7628a70fae237ebcd48c454d9a2/results/inpainted.jpg -------------------------------------------------------------------------------- /results/rect_result_0.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ZHEQIUSHUI/SAM-ONNX-AX650-CPP/dacdc31a8aafa7628a70fae237ebcd48c454d9a2/results/rect_result_0.jpg -------------------------------------------------------------------------------- /results/rect_result_1.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ZHEQIUSHUI/SAM-ONNX-AX650-CPP/dacdc31a8aafa7628a70fae237ebcd48c454d9a2/results/rect_result_1.jpg -------------------------------------------------------------------------------- /results/rect_result_2.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ZHEQIUSHUI/SAM-ONNX-AX650-CPP/dacdc31a8aafa7628a70fae237ebcd48c454d9a2/results/rect_result_2.jpg -------------------------------------------------------------------------------- /results/rect_result_3.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ZHEQIUSHUI/SAM-ONNX-AX650-CPP/dacdc31a8aafa7628a70fae237ebcd48c454d9a2/results/rect_result_3.jpg -------------------------------------------------------------------------------- /results/result_0.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ZHEQIUSHUI/SAM-ONNX-AX650-CPP/dacdc31a8aafa7628a70fae237ebcd48c454d9a2/results/result_0.jpg -------------------------------------------------------------------------------- /results/result_1.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ZHEQIUSHUI/SAM-ONNX-AX650-CPP/dacdc31a8aafa7628a70fae237ebcd48c454d9a2/results/result_1.jpg -------------------------------------------------------------------------------- /results/result_2.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ZHEQIUSHUI/SAM-ONNX-AX650-CPP/dacdc31a8aafa7628a70fae237ebcd48c454d9a2/results/result_2.jpg -------------------------------------------------------------------------------- /results/result_3.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ZHEQIUSHUI/SAM-ONNX-AX650-CPP/dacdc31a8aafa7628a70fae237ebcd48c454d9a2/results/result_3.jpg -------------------------------------------------------------------------------- /src/Runner/BaseRunner.cpp: -------------------------------------------------------------------------------- 1 | #include "BaseRunner.hpp" 2 | #include "OnnxWarpper/OnnxWarpper.hpp" 3 | 4 | std::shared_ptr CreateRunner(RunnerType rt) 5 | { 6 | switch (rt) 7 | { 8 | case RT_OnnxRunner: 9 | return std::make_shared(); 10 | case RT_OpenvinoRunner: 11 | case RT_TensorrtRunner: 12 | default: 13 | return nullptr; 14 | } 15 | return nullptr; 16 | } 17 | -------------------------------------------------------------------------------- /src/Runner/BaseRunner.hpp: -------------------------------------------------------------------------------- 1 | #pragma once 2 | #include "string" 3 | #include "vector" 4 | #include "memory" 5 | 6 | enum RunnerType 7 | { 8 | RT_UNKNOWN, 9 | RT_OnnxRunner, 10 | RT_OpenvinoRunner, 11 | RT_TensorrtRunner, 12 | RT_END, 13 | }; 14 | 15 | struct BaseConfig 16 | { 17 | std::string onnx_model; 18 | std::string output_model; // for trt 19 | int nthread; 20 | }; 21 | 22 | class BaseRunner 23 | { 24 | public: 25 | virtual int load(BaseConfig &config) = 0; 26 | virtual int inference() = 0; 27 | 28 | virtual int getInputCount() = 0; 29 | virtual std::vector getInputShape(int idx) = 0; 30 | virtual std::string getInputName(int idx) = 0; 31 | virtual float *getInputPtr(int idx) = 0; 32 | 33 | virtual int getOutputCount() = 0; 34 | virtual std::vector getOutputShape(int idx) = 0; 35 | virtual std::string getOutputName(int idx) = 0; 36 | virtual float *getOutputPtr(int idx) = 0; 37 | }; 38 | 39 | std::shared_ptr CreateRunner(RunnerType rt); 40 | -------------------------------------------------------------------------------- /src/Runner/LamaInpaint.hpp: -------------------------------------------------------------------------------- 1 | #pragma once 2 | #include "BaseRunner.hpp" 3 | #include "opencv2/opencv.hpp" 4 | 5 | class LamaInpaint 6 | { 7 | protected: 8 | int width, height; 9 | cv::Mat letterbox_img, letterbox_mask; 10 | 11 | float get_input_data_letterbox(cv::Mat mat, cv::Mat &img_new, int letterbox_rows, int letterbox_cols, bool bgr2rgb = true) 12 | { 13 | /* letterbox process to support different letterbox size */ 14 | float scale_letterbox; 15 | int resize_rows; 16 | int resize_cols; 17 | if ((letterbox_rows * 1.0 / mat.rows) < (letterbox_cols * 1.0 / mat.cols)) 18 | { 19 | scale_letterbox = (float)letterbox_rows * 1.0f / (float)mat.rows; 20 | } 21 | else 22 | { 23 | scale_letterbox = (float)letterbox_cols * 1.0f / (float)mat.cols; 24 | } 25 | resize_cols = int(scale_letterbox * (float)mat.cols); 26 | resize_rows = int(scale_letterbox * (float)mat.rows); 27 | 28 | cv::resize(mat, mat, cv::Size(resize_cols, resize_rows)); 29 | 30 | int top = (letterbox_rows - resize_rows) / 2; 31 | int bot = (letterbox_rows - resize_rows + 1) / 2; 32 | int left = (letterbox_cols - resize_cols) / 2; 33 | int right = (letterbox_cols - resize_cols + 1) / 2; 34 | 35 | // Letterbox filling 36 | cv::copyMakeBorder(mat, img_new, 0, top + bot, 0, left + right, cv::BORDER_CONSTANT, cv::Scalar(0, 0, 0)); 37 | if (bgr2rgb) 38 | { 39 | cv::cvtColor(img_new, img_new, cv::COLOR_BGR2RGB); 40 | } 41 | return scale_letterbox; 42 | } 43 | 44 | public: 45 | virtual int Load(std::string model_file) = 0; 46 | virtual cv::Mat Inpaint(cv::Mat image, cv::Mat mask, int dilate_size) = 0; 47 | }; 48 | -------------------------------------------------------------------------------- /src/Runner/LamaInpaintAX650.hpp: -------------------------------------------------------------------------------- 1 | #pragma once 2 | #include "opencv2/opencv.hpp" 3 | #include "LamaInpaint.hpp" 4 | #include "ax_model_runner_ax650.hpp" 5 | 6 | class LamaInpaintAX650 : public LamaInpaint 7 | { 8 | private: 9 | std::shared_ptr model; 10 | 11 | public: 12 | int Load(std::string model_file) override 13 | { 14 | model.reset(new ax_runner_ax650); 15 | model->init(model_file.c_str()); 16 | auto output = model->get_input(0); 17 | width = output.vShape[2]; 18 | height = output.vShape[1]; 19 | return 0; 20 | } 21 | 22 | cv::Mat Inpaint(cv::Mat image, cv::Mat mask, int dilate_size) override 23 | { 24 | cv::dilate(mask, mask, cv::getStructuringElement(0, cv::Size(dilate_size, dilate_size))); 25 | float scale = get_input_data_letterbox(image, letterbox_img, height, width, false); 26 | get_input_data_letterbox(mask, letterbox_mask, height, width, false); 27 | 28 | uchar *img_data = letterbox_mask.data; 29 | 30 | for (size_t i = 0; i < height * width; i++) 31 | { 32 | img_data[i] = img_data[i] > 127 ? 1.0f : 0.0f; 33 | } 34 | 35 | memcpy(model->get_input(0).pVirAddr, letterbox_img.data, width * height * 3); 36 | memcpy(model->get_input(1).pVirAddr, letterbox_mask.data, width * height * 1); 37 | 38 | auto ret = model->inference(); 39 | 40 | float *output = (float *)model->get_output(0).pVirAddr; 41 | 42 | cv::Mat output_image(height, width, CV_8UC3); 43 | 44 | uchar *output_img_data = output_image.data; 45 | 46 | for (size_t i = 0; i < height * width * 3; i++) 47 | { 48 | output_img_data[i] = MAX(0, MIN(255, output[i])); 49 | } 50 | 51 | int output_height = MIN(output_image.rows, image.rows * scale); 52 | int output_width = MIN(output_image.cols, image.cols * scale); 53 | 54 | auto crop = output_image(cv::Rect(0, 0, output_width, output_height)); 55 | 56 | cv::resize(crop, crop, cv::Size(image.cols, image.rows)); 57 | return crop; 58 | } 59 | }; 60 | -------------------------------------------------------------------------------- /src/Runner/LamaInpaintOnnx.hpp: -------------------------------------------------------------------------------- 1 | #pragma once 2 | #include "BaseRunner.hpp" 3 | #include "opencv2/opencv.hpp" 4 | #include "LamaInpaint.hpp" 5 | 6 | class LamaInpaintOnnx : public LamaInpaint 7 | { 8 | protected: 9 | std::shared_ptr model; 10 | 11 | public: 12 | int Load(std::string model_file) override 13 | { 14 | model = CreateRunner(RT_OnnxRunner); 15 | BaseConfig config; 16 | config.nthread = 4; 17 | config.onnx_model = model_file; 18 | model->load(config); 19 | auto output = model->getInputShape(0); 20 | width = output[3]; 21 | height = output[2]; 22 | return 0; 23 | } 24 | 25 | cv::Mat Inpaint(cv::Mat image, cv::Mat mask, int dilate_size) override 26 | { 27 | cv::dilate(mask, mask, cv::getStructuringElement(0, cv::Size(dilate_size, dilate_size))); 28 | float scale = get_input_data_letterbox(image, letterbox_img, height, width, false); 29 | get_input_data_letterbox(mask, letterbox_mask, height, width, false); 30 | 31 | float *inputPtr = (float *)model->getInputPtr(0); 32 | 33 | uchar *img_data = letterbox_img.data; 34 | 35 | int letterbox_cols = width; 36 | int letterbox_rows = height; 37 | for (int c = 0; c < 3; c++) 38 | { 39 | for (int h = 0; h < letterbox_rows; h++) 40 | { 41 | for (int w = 0; w < letterbox_cols; w++) 42 | { 43 | int in_index = h * letterbox_cols * 3 + w * 3 + c; 44 | int out_index = c * letterbox_rows * letterbox_cols + h * letterbox_cols + w; 45 | inputPtr[out_index] = img_data[in_index] * (1 / 255.f); 46 | } 47 | } 48 | } 49 | 50 | inputPtr = (float *)model->getInputPtr(1); 51 | img_data = letterbox_mask.data; 52 | 53 | for (size_t i = 0; i < height * width; i++) 54 | { 55 | inputPtr[i] = img_data[i] > 127 ? 1.0f : 0.0f; 56 | } 57 | 58 | auto ret = model->inference(); 59 | 60 | float *output = model->getOutputPtr(0); 61 | 62 | cv::Mat output_image(height, width, CV_8UC3); 63 | 64 | uchar *output_img_data = output_image.data; 65 | 66 | for (size_t i = 0; i < height * width * 3; i++) 67 | { 68 | output_img_data[i] = MAX(0, MIN(255, output[i])); 69 | } 70 | 71 | int output_height = MIN(output_image.rows, image.rows * scale); 72 | int output_width = MIN(output_image.cols, image.cols * scale); 73 | 74 | auto crop = output_image(cv::Rect(0, 0, output_width, output_height)); 75 | 76 | cv::resize(crop, crop, cv::Size(image.cols, image.rows)); 77 | return crop; 78 | } 79 | }; 80 | -------------------------------------------------------------------------------- /src/Runner/OpenvinoWarpper/OpenvinoWarpper.hpp: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "../BaseRunner.hpp" 4 | 5 | #include "openvino/openvino.hpp" 6 | #include 7 | 8 | class OpenvinoRunner : virtual public BaseRunner 9 | { 10 | protected: 11 | ov::Core core; 12 | // std::shared_ptr model; 13 | 14 | std::vector> inputs; 15 | 16 | std::vector> outputs; 17 | 18 | ov::CompiledModel compiled_model; 19 | ov::InferRequest infer_request; 20 | 21 | public: 22 | OpenvinoRunner(/* args */) {} 23 | ~OpenvinoRunner() {} 24 | 25 | int load(BaseConfig &config) override 26 | { 27 | compiled_model = core.compile_model(config.onnx_model); 28 | inputs = compiled_model.inputs(); 29 | outputs = compiled_model.outputs(); 30 | infer_request = compiled_model.create_infer_request(); 31 | return 0; 32 | } 33 | 34 | int inference() override 35 | { 36 | infer_request.infer(); 37 | return 0; 38 | } 39 | 40 | int getInputCount() override 41 | { 42 | return inputs.size(); 43 | } 44 | 45 | std::vector getInputShape(int idx) override 46 | { 47 | return inputs[idx].get_shape(); 48 | } 49 | 50 | std::string getInputName(int idx) override 51 | { 52 | return inputs[idx].get_any_name(); 53 | } 54 | 55 | float *getInputPtr(int idx) override 56 | { 57 | return infer_request.get_input_tensor(idx).data(); 58 | } 59 | 60 | int getOutputCount() override 61 | { 62 | return outputs.size(); 63 | } 64 | 65 | std::vector getOutputShape(int idx) override 66 | { 67 | return outputs[idx].get_shape(); 68 | } 69 | 70 | std::string getOutputName(int idx) override 71 | { 72 | return outputs[idx].get_any_name(); 73 | } 74 | 75 | float *getOutputPtr(int idx) override 76 | { 77 | return infer_request.get_output_tensor(idx).data(); 78 | } 79 | }; 80 | -------------------------------------------------------------------------------- /src/Runner/SAM.hpp: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "SAMDecoderOnnx.hpp" 4 | #include "SAMEncoderOnnx.hpp" 5 | #include "SAMEncoderAX650.hpp" 6 | 7 | #include "string_utility.hpp" 8 | class SAM 9 | { 10 | private: 11 | SAMDecoderOnnx decoder; 12 | std::shared_ptr encoder; 13 | bool bInit = false; 14 | 15 | public: 16 | SAM() {} 17 | int Load(std::string encoder_model, std::string decoder_model) 18 | { 19 | if (string_utility::ends_with(encoder_model, ".onnx")) 20 | { 21 | encoder.reset(new SAMEncoderOnnx); 22 | } 23 | else if (string_utility::ends_with(encoder_model, ".axmodel")) 24 | { 25 | encoder.reset(new SAMEncoderAX650); 26 | } 27 | else 28 | { 29 | ALOGE("no impl for %s", encoder_model.c_str()); 30 | return -1; 31 | } 32 | encoder->Load(encoder_model); 33 | decoder.Load(decoder_model); 34 | bInit = true; 35 | return 0; 36 | } 37 | 38 | void Encode(cv::Mat src) 39 | { 40 | if (!bInit) 41 | { 42 | return; 43 | } 44 | 45 | float scale; 46 | auto time_start = std::chrono::high_resolution_clock::now(); 47 | encoder->Inference(src, scale); 48 | auto time_end = std::chrono::high_resolution_clock::now(); 49 | std::chrono::duration diff = time_end - time_start; 50 | std::cout << "Encoder Inference Cost time : " << diff.count() << "s" << std::endl; 51 | 52 | decoder.LoadFeature(src.cols, src.rows, encoder->FeaturePtr(), encoder->FeatureSize(), encoder->FeatureShape(), scale); 53 | } 54 | 55 | std::vector Decode(cv::Point pt) 56 | { 57 | if (!bInit) 58 | { 59 | return std::vector(); 60 | } 61 | return decoder.Inference(pt); 62 | } 63 | 64 | std::vector Decode(cv::Rect box) 65 | { 66 | if (!bInit) 67 | { 68 | return std::vector(); 69 | } 70 | return decoder.Inference(box); 71 | } 72 | }; 73 | -------------------------------------------------------------------------------- /src/Runner/SAMEncoder.hpp: -------------------------------------------------------------------------------- 1 | #pragma once 2 | #include "string" 3 | #include "ax_model_runner_ax650.hpp" 4 | #include "opencv2/opencv.hpp" 5 | 6 | class SAMEncoder 7 | { 8 | protected: 9 | int nFeatureSize = 1; 10 | cv::Mat input; 11 | 12 | float get_input_data_letterbox(cv::Mat mat, cv::Mat &img_new, int letterbox_rows, int letterbox_cols, bool bgr2rgb = true) 13 | { 14 | /* letterbox process to support different letterbox size */ 15 | float scale_letterbox; 16 | int resize_rows; 17 | int resize_cols; 18 | if ((letterbox_rows * 1.0 / mat.rows) < (letterbox_cols * 1.0 / mat.cols)) 19 | { 20 | scale_letterbox = (float)letterbox_rows * 1.0f / (float)mat.rows; 21 | } 22 | else 23 | { 24 | scale_letterbox = (float)letterbox_cols * 1.0f / (float)mat.cols; 25 | } 26 | resize_cols = int(scale_letterbox * (float)mat.cols); 27 | resize_rows = int(scale_letterbox * (float)mat.rows); 28 | 29 | cv::resize(mat, mat, cv::Size(resize_cols, resize_rows)); 30 | 31 | int top = (letterbox_rows - resize_rows) / 2; 32 | int bot = (letterbox_rows - resize_rows + 1) / 2; 33 | int left = (letterbox_cols - resize_cols) / 2; 34 | int right = (letterbox_cols - resize_cols + 1) / 2; 35 | 36 | // Letterbox filling 37 | cv::copyMakeBorder(mat, img_new, 0, top + bot, 0, left + right, cv::BORDER_CONSTANT, cv::Scalar(0, 0, 0)); 38 | if (bgr2rgb) 39 | { 40 | cv::cvtColor(img_new, img_new, cv::COLOR_BGR2RGB); 41 | } 42 | return scale_letterbox; 43 | } 44 | 45 | public: 46 | virtual int Load(std::string model_file) = 0; 47 | 48 | virtual int Inference(cv::Mat src, float &scale) = 0; 49 | virtual int InputWidth() = 0; 50 | virtual int InputHeight() = 0; 51 | 52 | virtual float *FeaturePtr() = 0; 53 | virtual int FeatureSize() = 0; 54 | virtual std::vector FeatureShape() = 0; 55 | }; 56 | -------------------------------------------------------------------------------- /src/Runner/SAMEncoderAX650.hpp: -------------------------------------------------------------------------------- 1 | #pragma once 2 | #include "string" 3 | #include "ax_model_runner_ax650.hpp" 4 | #include "opencv2/opencv.hpp" 5 | 6 | #include "SAMEncoder.hpp" 7 | 8 | class SAMEncoderAX650 : public SAMEncoder 9 | { 10 | private: 11 | std::shared_ptr model; 12 | 13 | public: 14 | int Load(std::string model_file) override 15 | { 16 | model.reset(new ax_runner_ax650); 17 | model->init(model_file.c_str()); 18 | auto &output = model->get_output(0); 19 | 20 | nFeatureSize = 1; 21 | for (size_t i = 0; i < output.vShape.size(); i++) 22 | { 23 | nFeatureSize *= output.vShape[i]; 24 | } 25 | return 0; 26 | } 27 | 28 | int Inference(cv::Mat src, float &scale) override 29 | { 30 | scale = get_input_data_letterbox(src, input, InputHeight(), InputWidth(), true); 31 | memcpy(model->get_input(0).pVirAddr, input.data, input.cols * input.rows * 3); 32 | auto ret = model->inference(); 33 | return ret; 34 | } 35 | 36 | int InputWidth() override 37 | { 38 | return model->get_algo_width(); 39 | } 40 | int InputHeight() override 41 | { 42 | return model->get_algo_height(); 43 | } 44 | 45 | float *FeaturePtr() override 46 | { 47 | return (float *)model->get_output(0).pVirAddr; 48 | } 49 | 50 | int FeatureSize() override 51 | { 52 | return nFeatureSize; 53 | } 54 | 55 | std::vector FeatureShape() override 56 | { 57 | return model->get_output(0).vShape; 58 | } 59 | }; 60 | -------------------------------------------------------------------------------- /src/Runner/SAMEncoderOnnx.hpp: -------------------------------------------------------------------------------- 1 | #pragma once 2 | #include "string" 3 | #include "BaseRunner.hpp" 4 | #include "opencv2/opencv.hpp" 5 | 6 | #include "SAMEncoder.hpp" 7 | 8 | class SAMEncoderOnnx : public SAMEncoder 9 | { 10 | private: 11 | std::shared_ptr model; 12 | 13 | public: 14 | int Load(std::string model_file) override 15 | { 16 | model = CreateRunner(RT_OnnxRunner); 17 | BaseConfig config; 18 | config.nthread = 4; 19 | config.onnx_model = model_file; 20 | model->load(config); 21 | auto output = model->getOutputShape(0); 22 | 23 | nFeatureSize = 1; 24 | for (size_t i = 0; i < output.size(); i++) 25 | { 26 | nFeatureSize *= output[i]; 27 | } 28 | return 0; 29 | } 30 | 31 | int Inference(cv::Mat src, float &scale) override 32 | { 33 | scale = get_input_data_letterbox(src, input, InputHeight(), InputWidth(), true); 34 | 35 | float *inputPtr = (float *)model->getInputPtr(0); 36 | 37 | uchar *img_data = input.data; 38 | 39 | static float _mean_val[3] = {123.675, 116.28, 103.53}; 40 | static float _std_val[3] = {1.f / 58.395, 1.f / 57.12, 1.f / 57.375}; 41 | int letterbox_cols = InputWidth(); 42 | int letterbox_rows = InputHeight(); 43 | for (int c = 0; c < 3; c++) 44 | { 45 | for (int h = 0; h < letterbox_rows; h++) 46 | { 47 | for (int w = 0; w < letterbox_cols; w++) 48 | { 49 | int in_index = h * letterbox_cols * 3 + w * 3 + c; 50 | int out_index = c * letterbox_rows * letterbox_cols + h * letterbox_cols + w; 51 | inputPtr[out_index] = (float(img_data[in_index]) - _mean_val[c]) * _std_val[c]; 52 | } 53 | } 54 | } 55 | 56 | auto ret = model->inference(); 57 | 58 | return ret; 59 | } 60 | 61 | int InputWidth() override 62 | { 63 | return model->getInputShape(0)[3]; 64 | } 65 | int InputHeight() override 66 | { 67 | return model->getInputShape(0)[2]; 68 | } 69 | 70 | float *FeaturePtr() override 71 | { 72 | return model->getOutputPtr(0); 73 | } 74 | 75 | int FeatureSize() override 76 | { 77 | return nFeatureSize; 78 | } 79 | 80 | std::vector FeatureShape() override 81 | { 82 | auto shape = model->getOutputShape(0); 83 | std::vector out(shape.size()); 84 | for (size_t i = 0; i < shape.size(); i++) 85 | { 86 | out[i] = shape[i]; 87 | } 88 | return out; 89 | } 90 | }; 91 | -------------------------------------------------------------------------------- /src/Runner/ax_model_runner.hpp: -------------------------------------------------------------------------------- 1 | #pragma once 2 | #include "vector" 3 | #include "string" 4 | 5 | typedef enum _color_space_e 6 | { 7 | axdl_color_space_unknown, 8 | axdl_color_space_nv12, 9 | axdl_color_space_nv21, 10 | axdl_color_space_bgr, 11 | axdl_color_space_rgb, 12 | } ax_color_space_e; 13 | 14 | typedef struct _image_t 15 | { 16 | unsigned long long int pPhy; 17 | void *pVir; 18 | unsigned int nSize; 19 | unsigned int nWidth; 20 | unsigned int nHeight; 21 | ax_color_space_e eDtype; 22 | union 23 | { 24 | int tStride_H, tStride_W, tStride_C; 25 | }; 26 | } ax_image_t; 27 | 28 | typedef struct 29 | { 30 | std::string sName; 31 | unsigned int nIdx; 32 | std::vector vShape; 33 | int nSize; 34 | unsigned long phyAddr; 35 | void *pVirAddr; 36 | } ax_runner_tensor_t; 37 | 38 | class ax_runner_base 39 | { 40 | protected: 41 | std::vector mtensors; 42 | std::vector minput_tensors; 43 | 44 | public: 45 | virtual int init(const char *model_file) = 0; 46 | 47 | virtual void deinit() = 0; 48 | 49 | int get_num_outputs() { return mtensors.size(); }; 50 | 51 | const ax_runner_tensor_t &get_input(int idx) { return minput_tensors[idx]; } 52 | const ax_runner_tensor_t *get_inputs_ptr() { return minput_tensors.data(); } 53 | 54 | const ax_runner_tensor_t &get_output(int idx) { return mtensors[idx]; } 55 | const ax_runner_tensor_t *get_outputs_ptr() { return mtensors.data(); } 56 | 57 | virtual int get_algo_width() = 0; 58 | virtual int get_algo_height() = 0; 59 | virtual ax_color_space_e get_color_space() = 0; 60 | 61 | virtual int inference(ax_image_t *pstFrame) = 0; 62 | virtual int inference() = 0; 63 | 64 | int operator()(ax_image_t *pstFrame) 65 | { 66 | return inference(pstFrame); 67 | } 68 | }; 69 | -------------------------------------------------------------------------------- /src/Runner/ax_model_runner_ax650.hpp: -------------------------------------------------------------------------------- 1 | #pragma once 2 | #include "ax_model_runner.hpp" 3 | 4 | class ax_runner_ax650 : public ax_runner_base 5 | { 6 | protected: 7 | struct ax_joint_runner_ax650_handle_t *m_handle = nullptr; 8 | 9 | public: 10 | int init(const char *model_file) override; 11 | 12 | void deinit() override; 13 | 14 | int get_algo_width() override; 15 | int get_algo_height() override; 16 | ax_color_space_e get_color_space() override; 17 | 18 | int inference(ax_image_t *pstFrame) override; 19 | int inference() override; 20 | }; -------------------------------------------------------------------------------- /src/Runner/sample_log.h: -------------------------------------------------------------------------------- 1 | /********************************************************************************** 2 | * 3 | * Copyright (c) 2019-2022 Beijing AXera Technology Co., Ltd. All Rights Reserved. 4 | * 5 | * This source file is the property of Beijing AXera Technology Co., Ltd. and 6 | * may not be copied or distributed in any isomorphic form without the prior 7 | * written consent of Beijing AXera Technology Co., Ltd. 8 | * 9 | **********************************************************************************/ 10 | #ifndef _SAMPLE_LOG_H_ 11 | #define _SAMPLE_LOG_H_ 12 | 13 | #include 14 | 15 | typedef enum 16 | { 17 | SAMPLE_LOG_MIN = -1, 18 | SAMPLE_LOG_EMERGENCY = 0, 19 | SAMPLE_LOG_ALERT = 1, 20 | SAMPLE_LOG_CRITICAL = 2, 21 | SAMPLE_LOG_ERROR = 3, 22 | SAMPLE_LOG_WARN = 4, 23 | SAMPLE_LOG_NOTICE = 5, 24 | SAMPLE_LOG_INFO = 6, 25 | SAMPLE_LOG_DEBUG = 7, 26 | SAMPLE_LOG_MAX 27 | } SAMPLE_LOG_LEVEL_E; 28 | 29 | static SAMPLE_LOG_LEVEL_E log_level = SAMPLE_LOG_INFO; 30 | 31 | #if 1 32 | #define MACRO_BLACK "\033[1;30;30m" 33 | #define MACRO_RED "\033[1;30;31m" 34 | #define MACRO_GREEN "\033[1;30;32m" 35 | #define MACRO_YELLOW "\033[1;30;33m" 36 | #define MACRO_BLUE "\033[1;30;34m" 37 | #define MACRO_PURPLE "\033[1;30;35m" 38 | #define MACRO_WHITE "\033[1;30;37m" 39 | #define MACRO_END "\033[0m" 40 | #else 41 | #define MACRO_BLACK 42 | #define MACRO_RED 43 | #define MACRO_GREEN 44 | #define MACRO_YELLOW 45 | #define MACRO_BLUE 46 | #define MACRO_PURPLE 47 | #define MACRO_WHITE 48 | #define MACRO_END 49 | #endif 50 | 51 | #define ALOGE(fmt, ...) printf(MACRO_RED "[E][%32s][%4d]: " fmt MACRO_END "\n", __FUNCTION__, __LINE__, ##__VA_ARGS__) 52 | #define ALOGW(fmt, ...) \ 53 | if (log_level >= SAMPLE_LOG_WARN) \ 54 | printf(MACRO_YELLOW "[W][%32s][%4d]: " fmt MACRO_END "\n", __FUNCTION__, __LINE__, ##__VA_ARGS__) 55 | #define ALOGI(fmt, ...) \ 56 | if (log_level >= SAMPLE_LOG_INFO) \ 57 | printf(MACRO_GREEN "[I][%32s][%4d]: " fmt MACRO_END "\n", __FUNCTION__, __LINE__, ##__VA_ARGS__) 58 | #define ALOGD(fmt, ...) \ 59 | if (log_level >= SAMPLE_LOG_DEBUG) \ 60 | printf(MACRO_WHITE "[D][%32s][%4d]: " fmt MACRO_END "\n", __FUNCTION__, __LINE__, ##__VA_ARGS__) 61 | #define ALOGN(fmt, ...) \ 62 | if (log_level >= SAMPLE_LOG_NOTICE) \ 63 | printf(MACRO_PURPLE "[N][%32s][%4d]: " fmt MACRO_END "\n", __FUNCTION__, __LINE__, ##__VA_ARGS__) 64 | 65 | #endif /* _SAMPLE_LOG_H_ */ 66 | -------------------------------------------------------------------------------- /src/main.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | #include "cmdline.hpp" 3 | #include "Runner/SAM.hpp" 4 | 5 | int main(int argc, char *argv[]) 6 | { 7 | std::string image_path = "./test.jpg"; 8 | std::string encoder_model_path = "./onnx_models/mobile_sam_encoder.onnx"; 9 | std::string decoder_model_path = "./onnx_models/mobile_sam_decoder.onnx"; 10 | 11 | cmdline::parser cmd; 12 | cmd.add("encoder", 'e', "encoder model(onnx model or axmodel)", true, encoder_model_path); 13 | cmd.add("decoder", 'd', "decoder model(onnx)", true, decoder_model_path); 14 | cmd.add("image", 'i', "image file(jpg png etc....)", true, image_path); 15 | 16 | cmd.parse_check(argc, argv); 17 | 18 | image_path = cmd.get("image"); 19 | encoder_model_path = cmd.get("encoder"); 20 | decoder_model_path = cmd.get("decoder"); 21 | 22 | cv::Mat src = cv::imread(image_path); 23 | SAM sam; 24 | sam.Load(encoder_model_path, decoder_model_path); 25 | sam.Encode(src); 26 | 27 | cv::Point pointinfo(910, 641); 28 | cv::Rect boxinfo(pointinfo.x - 160, pointinfo.y - 430, 380, 940); 29 | 30 | auto outputs = sam.Decode(pointinfo); 31 | 32 | for (size_t i = 0; i < outputs.size(); i++) 33 | { 34 | printf("%2.2f \n", outputs[i].iou_pred); 35 | cv::cvtColor(outputs[i].mask, outputs[i].mask, cv::COLOR_GRAY2BGR); 36 | cv::circle(outputs[i].mask, pointinfo, 2, cv::Scalar(0, 0, 255), 4); 37 | cv::imwrite("result_" + std::to_string(i) + ".jpg", outputs[i].mask); 38 | } 39 | 40 | outputs = sam.Decode(boxinfo); 41 | 42 | for (size_t i = 0; i < outputs.size(); i++) 43 | { 44 | printf("%2.2f \n", outputs[i].iou_pred); 45 | cv::cvtColor(outputs[i].mask, outputs[i].mask, cv::COLOR_GRAY2BGR); 46 | cv::rectangle(outputs[i].mask, boxinfo, cv::Scalar(0, 0, 255), 4); 47 | cv::imwrite("rect_result_" + std::to_string(i) + ".jpg", outputs[i].mask); 48 | } 49 | 50 | return EXIT_SUCCESS; 51 | } 52 | -------------------------------------------------------------------------------- /src/main_inpaint.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | #include "cmdline.hpp" 3 | #include "Runner/LamaInpaintAX650.hpp" 4 | #include "Runner/LamaInpaintOnnx.hpp" 5 | #include "Runner/string_utility.hpp" 6 | 7 | int main(int argc, char *argv[]) 8 | { 9 | std::string image_path = "./test.jpg"; 10 | std::string mask_path = "./test.png"; 11 | std::string model_path = "/home/arno/workspace/pycode/lama/big-lama-regular/big-lama-regular.onnx"; 12 | 13 | cmdline::parser cmd; 14 | cmd.add("model", 'm', "model(onnx/axmodel)", true, model_path); 15 | cmd.add("image", 'i', "image file(jpg png etc....)", true, image_path); 16 | 17 | cmd.add("mask", 0, "mask file(png etc....)", true, image_path); 18 | 19 | cmd.parse_check(argc, argv); 20 | 21 | image_path = cmd.get("image"); 22 | mask_path = cmd.get("mask"); 23 | model_path = cmd.get("model"); 24 | cv::Mat src = cv::imread(image_path); 25 | cv::Mat mask = cv::imread(mask_path, cv::ImreadModes::IMREAD_GRAYSCALE); 26 | 27 | printf("image %dx%d\n", src.cols, src.rows); 28 | printf("mask %dx%d\n", mask.cols, mask.rows); 29 | 30 | std::shared_ptr mInpaint; 31 | if (string_utility::ends_with(model_path, ".onnx")) 32 | { 33 | mInpaint.reset(new LamaInpaintOnnx); 34 | } 35 | else if (string_utility::ends_with(model_path, ".axmodel")) 36 | { 37 | mInpaint.reset(new LamaInpaintAX650); 38 | } 39 | else 40 | { 41 | fprintf(stderr, "no impl for %s\n", model_path.c_str()); 42 | return -1; 43 | } 44 | 45 | mInpaint->Load(model_path); 46 | auto time_start = std::chrono::high_resolution_clock::now(); 47 | auto inpainted = mInpaint->Inpaint(src, mask, 11); 48 | auto time_end = std::chrono::high_resolution_clock::now(); 49 | std::chrono::duration diff = time_end - time_start; 50 | std::cout << "Inpaint Inference Cost time : " << diff.count() << "s" << std::endl; 51 | cv::imwrite("inpainted.png", inpainted); 52 | cv::imwrite("mask.png", mask); 53 | 54 | return EXIT_SUCCESS; 55 | } 56 | -------------------------------------------------------------------------------- /third_party/libopencv-4.6-aarch64-none/bin/setup_vars_opencv4.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | SCRIPT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null && pwd )" 4 | 5 | [[ ! "${OPENCV_QUIET}" ]] && ( echo "Setting vars for OpenCV 4.6.0" ) 6 | export LD_LIBRARY_PATH="$SCRIPT_DIR/../lib:$LD_LIBRARY_PATH" 7 | 8 | if [[ ! "$OPENCV_SKIP_PYTHON" ]]; then 9 | PYTHONPATH_OPENCV="$SCRIPT_DIR/python_loader_is_not_installed" 10 | [[ ! "${OPENCV_QUIET}" ]] && ( echo "Append PYTHONPATH: ${PYTHONPATH_OPENCV}" ) 11 | export PYTHONPATH="${PYTHONPATH_OPENCV}:$PYTHONPATH" 12 | fi 13 | 14 | # Don't exec in "sourced" mode 15 | if [[ "${BASH_SOURCE[0]}" == "${0}" ]]; then 16 | if [[ $# -ne 0 ]]; then 17 | [[ ! "${OPENCV_QUIET}" && "${OPENCV_VERBOSE}" ]] && ( echo "Executing: $*" ) 18 | exec "$@" 19 | fi 20 | fi 21 | -------------------------------------------------------------------------------- /third_party/libopencv-4.6-aarch64-none/include/opencv4/opencv2/core/async.hpp: -------------------------------------------------------------------------------- 1 | // This file is part of OpenCV project. 2 | // It is subject to the license terms in the LICENSE file found in the top-level directory 3 | // of this distribution and at http://opencv.org/license.html. 4 | 5 | #ifndef OPENCV_CORE_ASYNC_HPP 6 | #define OPENCV_CORE_ASYNC_HPP 7 | 8 | #include 9 | 10 | #ifdef CV_CXX11 11 | //#include 12 | #include 13 | #endif 14 | 15 | namespace cv { 16 | 17 | /** @addtogroup core_async 18 | 19 | @{ 20 | */ 21 | 22 | 23 | /** @brief Returns result of asynchronous operations 24 | 25 | Object has attached asynchronous state. 26 | Assignment operator doesn't clone asynchronous state (it is shared between all instances). 27 | 28 | Result can be fetched via get() method only once. 29 | 30 | */ 31 | class CV_EXPORTS_W AsyncArray 32 | { 33 | public: 34 | ~AsyncArray() CV_NOEXCEPT; 35 | CV_WRAP AsyncArray() CV_NOEXCEPT; 36 | AsyncArray(const AsyncArray& o) CV_NOEXCEPT; 37 | AsyncArray& operator=(const AsyncArray& o) CV_NOEXCEPT; 38 | CV_WRAP void release() CV_NOEXCEPT; 39 | 40 | /** Fetch the result. 41 | @param[out] dst destination array 42 | 43 | Waits for result until container has valid result. 44 | Throws exception if exception was stored as a result. 45 | 46 | Throws exception on invalid container state. 47 | 48 | @note Result or stored exception can be fetched only once. 49 | */ 50 | CV_WRAP void get(OutputArray dst) const; 51 | 52 | /** Retrieving the result with timeout 53 | @param[out] dst destination array 54 | @param[in] timeoutNs timeout in nanoseconds, -1 for infinite wait 55 | 56 | @returns true if result is ready, false if the timeout has expired 57 | 58 | @note Result or stored exception can be fetched only once. 59 | */ 60 | bool get(OutputArray dst, int64 timeoutNs) const; 61 | 62 | CV_WRAP inline 63 | bool get(OutputArray dst, double timeoutNs) const { return get(dst, (int64)timeoutNs); } 64 | 65 | bool wait_for(int64 timeoutNs) const; 66 | 67 | CV_WRAP inline 68 | bool wait_for(double timeoutNs) const { return wait_for((int64)timeoutNs); } 69 | 70 | CV_WRAP bool valid() const CV_NOEXCEPT; 71 | 72 | #ifdef CV_CXX11 73 | inline AsyncArray(AsyncArray&& o) { p = o.p; o.p = NULL; } 74 | inline AsyncArray& operator=(AsyncArray&& o) CV_NOEXCEPT { std::swap(p, o.p); return *this; } 75 | 76 | template 77 | inline bool get(OutputArray dst, const std::chrono::duration<_Rep, _Period>& timeout) 78 | { 79 | return get(dst, (int64)(std::chrono::nanoseconds(timeout).count())); 80 | } 81 | 82 | template 83 | inline bool wait_for(const std::chrono::duration<_Rep, _Period>& timeout) 84 | { 85 | return wait_for((int64)(std::chrono::nanoseconds(timeout).count())); 86 | } 87 | 88 | #if 0 89 | std::future getFutureMat() const; 90 | std::future getFutureUMat() const; 91 | #endif 92 | #endif 93 | 94 | 95 | // PImpl 96 | struct Impl; friend struct Impl; 97 | inline void* _getImpl() const CV_NOEXCEPT { return p; } 98 | protected: 99 | Impl* p; 100 | }; 101 | 102 | 103 | //! @} 104 | } // namespace 105 | #endif // OPENCV_CORE_ASYNC_HPP 106 | -------------------------------------------------------------------------------- /third_party/libopencv-4.6-aarch64-none/include/opencv4/opencv2/core/bufferpool.hpp: -------------------------------------------------------------------------------- 1 | // This file is part of OpenCV project. 2 | // It is subject to the license terms in the LICENSE file found in the top-level directory 3 | // of this distribution and at http://opencv.org/license.html. 4 | // 5 | // Copyright (C) 2014, Advanced Micro Devices, Inc., all rights reserved. 6 | 7 | #ifndef OPENCV_CORE_BUFFER_POOL_HPP 8 | #define OPENCV_CORE_BUFFER_POOL_HPP 9 | 10 | #ifdef _MSC_VER 11 | #pragma warning(push) 12 | #pragma warning(disable: 4265) 13 | #endif 14 | 15 | namespace cv 16 | { 17 | 18 | //! @addtogroup core 19 | //! @{ 20 | 21 | class BufferPoolController 22 | { 23 | protected: 24 | ~BufferPoolController() { } 25 | public: 26 | virtual size_t getReservedSize() const = 0; 27 | virtual size_t getMaxReservedSize() const = 0; 28 | virtual void setMaxReservedSize(size_t size) = 0; 29 | virtual void freeAllReservedBuffers() = 0; 30 | }; 31 | 32 | //! @} 33 | 34 | } 35 | 36 | #ifdef _MSC_VER 37 | #pragma warning(pop) 38 | #endif 39 | 40 | #endif // OPENCV_CORE_BUFFER_POOL_HPP 41 | -------------------------------------------------------------------------------- /third_party/libopencv-4.6-aarch64-none/include/opencv4/opencv2/core/core.hpp: -------------------------------------------------------------------------------- 1 | /*M/////////////////////////////////////////////////////////////////////////////////////// 2 | // 3 | // IMPORTANT: READ BEFORE DOWNLOADING, COPYING, INSTALLING OR USING. 4 | // 5 | // By downloading, copying, installing or using the software you agree to this license. 6 | // If you do not agree to this license, do not download, install, 7 | // copy or use the software. 8 | // 9 | // 10 | // License Agreement 11 | // For Open Source Computer Vision Library 12 | // 13 | // Copyright (C) 2000-2008, Intel Corporation, all rights reserved. 14 | // Copyright (C) 2009, Willow Garage Inc., all rights reserved. 15 | // Copyright (C) 2013, OpenCV Foundation, all rights reserved. 16 | // Third party copyrights are property of their respective owners. 17 | // 18 | // Redistribution and use in source and binary forms, with or without modification, 19 | // are permitted provided that the following conditions are met: 20 | // 21 | // * Redistribution's of source code must retain the above copyright notice, 22 | // this list of conditions and the following disclaimer. 23 | // 24 | // * Redistribution's in binary form must reproduce the above copyright notice, 25 | // this list of conditions and the following disclaimer in the documentation 26 | // and/or other materials provided with the distribution. 27 | // 28 | // * The name of the copyright holders may not be used to endorse or promote products 29 | // derived from this software without specific prior written permission. 30 | // 31 | // This software is provided by the copyright holders and contributors "as is" and 32 | // any express or implied warranties, including, but not limited to, the implied 33 | // warranties of merchantability and fitness for a particular purpose are disclaimed. 34 | // In no event shall the Intel Corporation or contributors be liable for any direct, 35 | // indirect, incidental, special, exemplary, or consequential damages 36 | // (including, but not limited to, procurement of substitute goods or services; 37 | // loss of use, data, or profits; or business interruption) however caused 38 | // and on any theory of liability, whether in contract, strict liability, 39 | // or tort (including negligence or otherwise) arising in any way out of 40 | // the use of this software, even if advised of the possibility of such damage. 41 | // 42 | //M*/ 43 | 44 | #ifdef __OPENCV_BUILD 45 | #error this is a compatibility header which should not be used inside the OpenCV library 46 | #endif 47 | 48 | #include "opencv2/core.hpp" 49 | -------------------------------------------------------------------------------- /third_party/libopencv-4.6-aarch64-none/include/opencv4/opencv2/core/cuda/common.hpp: -------------------------------------------------------------------------------- 1 | /*M/////////////////////////////////////////////////////////////////////////////////////// 2 | // 3 | // IMPORTANT: READ BEFORE DOWNLOADING, COPYING, INSTALLING OR USING. 4 | // 5 | // By downloading, copying, installing or using the software you agree to this license. 6 | // If you do not agree to this license, do not download, install, 7 | // copy or use the software. 8 | // 9 | // 10 | // License Agreement 11 | // For Open Source Computer Vision Library 12 | // 13 | // Copyright (C) 2000-2008, Intel Corporation, all rights reserved. 14 | // Copyright (C) 2009, Willow Garage Inc., all rights reserved. 15 | // Third party copyrights are property of their respective owners. 16 | // 17 | // Redistribution and use in source and binary forms, with or without modification, 18 | // are permitted provided that the following conditions are met: 19 | // 20 | // * Redistribution's of source code must retain the above copyright notice, 21 | // this list of conditions and the following disclaimer. 22 | // 23 | // * Redistribution's in binary form must reproduce the above copyright notice, 24 | // this list of conditions and the following disclaimer in the documentation 25 | // and/or other materials provided with the distribution. 26 | // 27 | // * The name of the copyright holders may not be used to endorse or promote products 28 | // derived from this software without specific prior written permission. 29 | // 30 | // This software is provided by the copyright holders and contributors "as is" and 31 | // any express or implied warranties, including, but not limited to, the implied 32 | // warranties of merchantability and fitness for a particular purpose are disclaimed. 33 | // In no event shall the Intel Corporation or contributors be liable for any direct, 34 | // indirect, incidental, special, exemplary, or consequential damages 35 | // (including, but not limited to, procurement of substitute goods or services; 36 | // loss of use, data, or profits; or business interruption) however caused 37 | // and on any theory of liability, whether in contract, strict liability, 38 | // or tort (including negligence or otherwise) arising in any way out of 39 | // the use of this software, even if advised of the possibility of such damage. 40 | // 41 | //M*/ 42 | 43 | #ifndef OPENCV_CUDA_COMMON_HPP 44 | #define OPENCV_CUDA_COMMON_HPP 45 | 46 | #include 47 | #include "opencv2/core/cuda_types.hpp" 48 | #include "opencv2/core/cvdef.h" 49 | #include "opencv2/core/base.hpp" 50 | 51 | /** @file 52 | * @deprecated Use @ref cudev instead. 53 | */ 54 | 55 | //! @cond IGNORED 56 | 57 | #ifndef CV_PI_F 58 | #ifndef CV_PI 59 | #define CV_PI_F 3.14159265f 60 | #else 61 | #define CV_PI_F ((float)CV_PI) 62 | #endif 63 | #endif 64 | 65 | namespace cv { namespace cuda { 66 | static inline void checkCudaError(cudaError_t err, const char* file, const int line, const char* func) 67 | { 68 | if (cudaSuccess != err) 69 | cv::error(cv::Error::GpuApiCallError, cudaGetErrorString(err), func, file, line); 70 | } 71 | }} 72 | 73 | #ifndef cudaSafeCall 74 | #define cudaSafeCall(expr) cv::cuda::checkCudaError(expr, __FILE__, __LINE__, CV_Func) 75 | #endif 76 | 77 | namespace cv { namespace cuda 78 | { 79 | template static inline bool isAligned(const T* ptr, size_t size) 80 | { 81 | return reinterpret_cast(ptr) % size == 0; 82 | } 83 | 84 | static inline bool isAligned(size_t step, size_t size) 85 | { 86 | return step % size == 0; 87 | } 88 | }} 89 | 90 | namespace cv { namespace cuda 91 | { 92 | namespace device 93 | { 94 | __host__ __device__ __forceinline__ int divUp(int total, int grain) 95 | { 96 | return (total + grain - 1) / grain; 97 | } 98 | 99 | template inline void bindTexture(const textureReference* tex, const PtrStepSz& img) 100 | { 101 | cudaChannelFormatDesc desc = cudaCreateChannelDesc(); 102 | cudaSafeCall( cudaBindTexture2D(0, tex, img.ptr(), &desc, img.cols, img.rows, img.step) ); 103 | } 104 | 105 | template inline void createTextureObjectPitch2D(cudaTextureObject_t* tex, PtrStepSz& img, const cudaTextureDesc& texDesc) 106 | { 107 | cudaResourceDesc resDesc; 108 | memset(&resDesc, 0, sizeof(resDesc)); 109 | resDesc.resType = cudaResourceTypePitch2D; 110 | resDesc.res.pitch2D.devPtr = static_cast(img.ptr()); 111 | resDesc.res.pitch2D.height = img.rows; 112 | resDesc.res.pitch2D.width = img.cols; 113 | resDesc.res.pitch2D.pitchInBytes = img.step; 114 | resDesc.res.pitch2D.desc = cudaCreateChannelDesc(); 115 | 116 | cudaSafeCall( cudaCreateTextureObject(tex, &resDesc, &texDesc, NULL) ); 117 | } 118 | } 119 | }} 120 | 121 | //! @endcond 122 | 123 | #endif // OPENCV_CUDA_COMMON_HPP 124 | -------------------------------------------------------------------------------- /third_party/libopencv-4.6-aarch64-none/include/opencv4/opencv2/core/cuda/datamov_utils.hpp: -------------------------------------------------------------------------------- 1 | /*M/////////////////////////////////////////////////////////////////////////////////////// 2 | // 3 | // IMPORTANT: READ BEFORE DOWNLOADING, COPYING, INSTALLING OR USING. 4 | // 5 | // By downloading, copying, installing or using the software you agree to this license. 6 | // If you do not agree to this license, do not download, install, 7 | // copy or use the software. 8 | // 9 | // 10 | // License Agreement 11 | // For Open Source Computer Vision Library 12 | // 13 | // Copyright (C) 2000-2008, Intel Corporation, all rights reserved. 14 | // Copyright (C) 2009, Willow Garage Inc., all rights reserved. 15 | // Third party copyrights are property of their respective owners. 16 | // 17 | // Redistribution and use in source and binary forms, with or without modification, 18 | // are permitted provided that the following conditions are met: 19 | // 20 | // * Redistribution's of source code must retain the above copyright notice, 21 | // this list of conditions and the following disclaimer. 22 | // 23 | // * Redistribution's in binary form must reproduce the above copyright notice, 24 | // this list of conditions and the following disclaimer in the documentation 25 | // and/or other materials provided with the distribution. 26 | // 27 | // * The name of the copyright holders may not be used to endorse or promote products 28 | // derived from this software without specific prior written permission. 29 | // 30 | // This software is provided by the copyright holders and contributors "as is" and 31 | // any express or implied warranties, including, but not limited to, the implied 32 | // warranties of merchantability and fitness for a particular purpose are disclaimed. 33 | // In no event shall the Intel Corporation or contributors be liable for any direct, 34 | // indirect, incidental, special, exemplary, or consequential damages 35 | // (including, but not limited to, procurement of substitute goods or services; 36 | // loss of use, data, or profits; or business interruption) however caused 37 | // and on any theory of liability, whether in contract, strict liability, 38 | // or tort (including negligence or otherwise) arising in any way out of 39 | // the use of this software, even if advised of the possibility of such damage. 40 | // 41 | //M*/ 42 | 43 | #ifndef OPENCV_CUDA_DATAMOV_UTILS_HPP 44 | #define OPENCV_CUDA_DATAMOV_UTILS_HPP 45 | 46 | #include "common.hpp" 47 | 48 | /** @file 49 | * @deprecated Use @ref cudev instead. 50 | */ 51 | 52 | //! @cond IGNORED 53 | 54 | namespace cv { namespace cuda { namespace device 55 | { 56 | #if defined __CUDA_ARCH__ && __CUDA_ARCH__ >= 200 57 | 58 | // for Fermi memory space is detected automatically 59 | template struct ForceGlob 60 | { 61 | __device__ __forceinline__ static void Load(const T* ptr, int offset, T& val) { val = ptr[offset]; } 62 | }; 63 | 64 | #else // __CUDA_ARCH__ >= 200 65 | 66 | #if defined(_WIN64) || defined(__LP64__) 67 | // 64-bit register modifier for inlined asm 68 | #define OPENCV_CUDA_ASM_PTR "l" 69 | #else 70 | // 32-bit register modifier for inlined asm 71 | #define OPENCV_CUDA_ASM_PTR "r" 72 | #endif 73 | 74 | template struct ForceGlob; 75 | 76 | #define OPENCV_CUDA_DEFINE_FORCE_GLOB(base_type, ptx_type, reg_mod) \ 77 | template <> struct ForceGlob \ 78 | { \ 79 | __device__ __forceinline__ static void Load(const base_type* ptr, int offset, base_type& val) \ 80 | { \ 81 | asm("ld.global."#ptx_type" %0, [%1];" : "="#reg_mod(val) : OPENCV_CUDA_ASM_PTR(ptr + offset)); \ 82 | } \ 83 | }; 84 | 85 | #define OPENCV_CUDA_DEFINE_FORCE_GLOB_B(base_type, ptx_type) \ 86 | template <> struct ForceGlob \ 87 | { \ 88 | __device__ __forceinline__ static void Load(const base_type* ptr, int offset, base_type& val) \ 89 | { \ 90 | asm("ld.global."#ptx_type" %0, [%1];" : "=r"(*reinterpret_cast(&val)) : OPENCV_CUDA_ASM_PTR(ptr + offset)); \ 91 | } \ 92 | }; 93 | 94 | OPENCV_CUDA_DEFINE_FORCE_GLOB_B(uchar, u8) 95 | OPENCV_CUDA_DEFINE_FORCE_GLOB_B(schar, s8) 96 | OPENCV_CUDA_DEFINE_FORCE_GLOB_B(char, b8) 97 | OPENCV_CUDA_DEFINE_FORCE_GLOB (ushort, u16, h) 98 | OPENCV_CUDA_DEFINE_FORCE_GLOB (short, s16, h) 99 | OPENCV_CUDA_DEFINE_FORCE_GLOB (uint, u32, r) 100 | OPENCV_CUDA_DEFINE_FORCE_GLOB (int, s32, r) 101 | OPENCV_CUDA_DEFINE_FORCE_GLOB (float, f32, f) 102 | OPENCV_CUDA_DEFINE_FORCE_GLOB (double, f64, d) 103 | 104 | #undef OPENCV_CUDA_DEFINE_FORCE_GLOB 105 | #undef OPENCV_CUDA_DEFINE_FORCE_GLOB_B 106 | #undef OPENCV_CUDA_ASM_PTR 107 | 108 | #endif // __CUDA_ARCH__ >= 200 109 | }}} // namespace cv { namespace cuda { namespace cudev 110 | 111 | //! @endcond 112 | 113 | #endif // OPENCV_CUDA_DATAMOV_UTILS_HPP 114 | -------------------------------------------------------------------------------- /third_party/libopencv-4.6-aarch64-none/include/opencv4/opencv2/core/cuda/dynamic_smem.hpp: -------------------------------------------------------------------------------- 1 | /*M/////////////////////////////////////////////////////////////////////////////////////// 2 | // 3 | // IMPORTANT: READ BEFORE DOWNLOADING, COPYING, INSTALLING OR USING. 4 | // 5 | // By downloading, copying, installing or using the software you agree to this license. 6 | // If you do not agree to this license, do not download, install, 7 | // copy or use the software. 8 | // 9 | // 10 | // License Agreement 11 | // For Open Source Computer Vision Library 12 | // 13 | // Copyright (C) 2000-2008, Intel Corporation, all rights reserved. 14 | // Copyright (C) 2009, Willow Garage Inc., all rights reserved. 15 | // Third party copyrights are property of their respective owners. 16 | // 17 | // Redistribution and use in source and binary forms, with or without modification, 18 | // are permitted provided that the following conditions are met: 19 | // 20 | // * Redistribution's of source code must retain the above copyright notice, 21 | // this list of conditions and the following disclaimer. 22 | // 23 | // * Redistribution's in binary form must reproduce the above copyright notice, 24 | // this list of conditions and the following disclaimer in the documentation 25 | // and/or other materials provided with the distribution. 26 | // 27 | // * The name of the copyright holders may not be used to endorse or promote products 28 | // derived from this software without specific prior written permission. 29 | // 30 | // This software is provided by the copyright holders and contributors "as is" and 31 | // any express or implied warranties, including, but not limited to, the implied 32 | // warranties of merchantability and fitness for a particular purpose are disclaimed. 33 | // In no event shall the Intel Corporation or contributors be liable for any direct, 34 | // indirect, incidental, special, exemplary, or consequential damages 35 | // (including, but not limited to, procurement of substitute goods or services; 36 | // loss of use, data, or profits; or business interruption) however caused 37 | // and on any theory of liability, whether in contract, strict liability, 38 | // or tort (including negligence or otherwise) arising in any way out of 39 | // the use of this software, even if advised of the possibility of such damage. 40 | // 41 | //M*/ 42 | 43 | #ifndef OPENCV_CUDA_DYNAMIC_SMEM_HPP 44 | #define OPENCV_CUDA_DYNAMIC_SMEM_HPP 45 | 46 | /** @file 47 | * @deprecated Use @ref cudev instead. 48 | */ 49 | 50 | //! @cond IGNORED 51 | 52 | namespace cv { namespace cuda { namespace device 53 | { 54 | template struct DynamicSharedMem 55 | { 56 | __device__ __forceinline__ operator T*() 57 | { 58 | extern __shared__ int __smem[]; 59 | return (T*)__smem; 60 | } 61 | 62 | __device__ __forceinline__ operator const T*() const 63 | { 64 | extern __shared__ int __smem[]; 65 | return (T*)__smem; 66 | } 67 | }; 68 | 69 | // specialize for double to avoid unaligned memory access compile errors 70 | template<> struct DynamicSharedMem 71 | { 72 | __device__ __forceinline__ operator double*() 73 | { 74 | extern __shared__ double __smem_d[]; 75 | return (double*)__smem_d; 76 | } 77 | 78 | __device__ __forceinline__ operator const double*() const 79 | { 80 | extern __shared__ double __smem_d[]; 81 | return (double*)__smem_d; 82 | } 83 | }; 84 | }}} 85 | 86 | //! @endcond 87 | 88 | #endif // OPENCV_CUDA_DYNAMIC_SMEM_HPP 89 | -------------------------------------------------------------------------------- /third_party/libopencv-4.6-aarch64-none/include/opencv4/opencv2/core/cuda/funcattrib.hpp: -------------------------------------------------------------------------------- 1 | /*M/////////////////////////////////////////////////////////////////////////////////////// 2 | // 3 | // IMPORTANT: READ BEFORE DOWNLOADING, COPYING, INSTALLING OR USING. 4 | // 5 | // By downloading, copying, installing or using the software you agree to this license. 6 | // If you do not agree to this license, do not download, install, 7 | // copy or use the software. 8 | // 9 | // 10 | // License Agreement 11 | // For Open Source Computer Vision Library 12 | // 13 | // Copyright (C) 2000-2008, Intel Corporation, all rights reserved. 14 | // Copyright (C) 2009, Willow Garage Inc., all rights reserved. 15 | // Third party copyrights are property of their respective owners. 16 | // 17 | // Redistribution and use in source and binary forms, with or without modification, 18 | // are permitted provided that the following conditions are met: 19 | // 20 | // * Redistribution's of source code must retain the above copyright notice, 21 | // this list of conditions and the following disclaimer. 22 | // 23 | // * Redistribution's in binary form must reproduce the above copyright notice, 24 | // this list of conditions and the following disclaimer in the documentation 25 | // and/or other materials provided with the distribution. 26 | // 27 | // * The name of the copyright holders may not be used to endorse or promote products 28 | // derived from this software without specific prior written permission. 29 | // 30 | // This software is provided by the copyright holders and contributors "as is" and 31 | // any express or implied warranties, including, but not limited to, the implied 32 | // warranties of merchantability and fitness for a particular purpose are disclaimed. 33 | // In no event shall the Intel Corporation or contributors be liable for any direct, 34 | // indirect, incidental, special, exemplary, or consequential damages 35 | // (including, but not limited to, procurement of substitute goods or services; 36 | // loss of use, data, or profits; or business interruption) however caused 37 | // and on any theory of liability, whether in contract, strict liability, 38 | // or tort (including negligence or otherwise) arising in any way out of 39 | // the use of this software, even if advised of the possibility of such damage. 40 | // 41 | //M*/ 42 | 43 | #ifndef OPENCV_CUDA_DEVICE_FUNCATTRIB_HPP 44 | #define OPENCV_CUDA_DEVICE_FUNCATTRIB_HPP 45 | 46 | #include 47 | 48 | /** @file 49 | * @deprecated Use @ref cudev instead. 50 | */ 51 | 52 | //! @cond IGNORED 53 | 54 | namespace cv { namespace cuda { namespace device 55 | { 56 | template 57 | void printFuncAttrib(Func& func) 58 | { 59 | 60 | cudaFuncAttributes attrs; 61 | cudaFuncGetAttributes(&attrs, func); 62 | 63 | printf("=== Function stats ===\n"); 64 | printf("Name: \n"); 65 | printf("sharedSizeBytes = %d\n", attrs.sharedSizeBytes); 66 | printf("constSizeBytes = %d\n", attrs.constSizeBytes); 67 | printf("localSizeBytes = %d\n", attrs.localSizeBytes); 68 | printf("maxThreadsPerBlock = %d\n", attrs.maxThreadsPerBlock); 69 | printf("numRegs = %d\n", attrs.numRegs); 70 | printf("ptxVersion = %d\n", attrs.ptxVersion); 71 | printf("binaryVersion = %d\n", attrs.binaryVersion); 72 | printf("\n"); 73 | fflush(stdout); 74 | } 75 | }}} // namespace cv { namespace cuda { namespace cudev 76 | 77 | //! @endcond 78 | 79 | #endif /* OPENCV_CUDA_DEVICE_FUNCATTRIB_HPP */ 80 | -------------------------------------------------------------------------------- /third_party/libopencv-4.6-aarch64-none/include/opencv4/opencv2/core/cuda/transform.hpp: -------------------------------------------------------------------------------- 1 | /*M/////////////////////////////////////////////////////////////////////////////////////// 2 | // 3 | // IMPORTANT: READ BEFORE DOWNLOADING, COPYING, INSTALLING OR USING. 4 | // 5 | // By downloading, copying, installing or using the software you agree to this license. 6 | // If you do not agree to this license, do not download, install, 7 | // copy or use the software. 8 | // 9 | // 10 | // License Agreement 11 | // For Open Source Computer Vision Library 12 | // 13 | // Copyright (C) 2000-2008, Intel Corporation, all rights reserved. 14 | // Copyright (C) 2009, Willow Garage Inc., all rights reserved. 15 | // Third party copyrights are property of their respective owners. 16 | // 17 | // Redistribution and use in source and binary forms, with or without modification, 18 | // are permitted provided that the following conditions are met: 19 | // 20 | // * Redistribution's of source code must retain the above copyright notice, 21 | // this list of conditions and the following disclaimer. 22 | // 23 | // * Redistribution's in binary form must reproduce the above copyright notice, 24 | // this list of conditions and the following disclaimer in the documentation 25 | // and/or other materials provided with the distribution. 26 | // 27 | // * The name of the copyright holders may not be used to endorse or promote products 28 | // derived from this software without specific prior written permission. 29 | // 30 | // This software is provided by the copyright holders and contributors "as is" and 31 | // any express or implied warranties, including, but not limited to, the implied 32 | // warranties of merchantability and fitness for a particular purpose are disclaimed. 33 | // In no event shall the Intel Corporation or contributors be liable for any direct, 34 | // indirect, incidental, special, exemplary, or consequential damages 35 | // (including, but not limited to, procurement of substitute goods or services; 36 | // loss of use, data, or profits; or business interruption) however caused 37 | // and on any theory of liability, whether in contract, strict liability, 38 | // or tort (including negligence or otherwise) arising in any way out of 39 | // the use of this software, even if advised of the possibility of such damage. 40 | // 41 | //M*/ 42 | 43 | #ifndef OPENCV_CUDA_TRANSFORM_HPP 44 | #define OPENCV_CUDA_TRANSFORM_HPP 45 | 46 | #include "common.hpp" 47 | #include "utility.hpp" 48 | #include "detail/transform_detail.hpp" 49 | 50 | /** @file 51 | * @deprecated Use @ref cudev instead. 52 | */ 53 | 54 | //! @cond IGNORED 55 | 56 | namespace cv { namespace cuda { namespace device 57 | { 58 | template 59 | static inline void transform(PtrStepSz src, PtrStepSz dst, UnOp op, const Mask& mask, cudaStream_t stream) 60 | { 61 | typedef TransformFunctorTraits ft; 62 | transform_detail::TransformDispatcher::cn == 1 && VecTraits::cn == 1 && ft::smart_shift != 1>::call(src, dst, op, mask, stream); 63 | } 64 | 65 | template 66 | static inline void transform(PtrStepSz src1, PtrStepSz src2, PtrStepSz dst, BinOp op, const Mask& mask, cudaStream_t stream) 67 | { 68 | typedef TransformFunctorTraits ft; 69 | transform_detail::TransformDispatcher::cn == 1 && VecTraits::cn == 1 && VecTraits::cn == 1 && ft::smart_shift != 1>::call(src1, src2, dst, op, mask, stream); 70 | } 71 | }}} 72 | 73 | //! @endcond 74 | 75 | #endif // OPENCV_CUDA_TRANSFORM_HPP 76 | -------------------------------------------------------------------------------- /third_party/libopencv-4.6-aarch64-none/include/opencv4/opencv2/core/cuda/type_traits.hpp: -------------------------------------------------------------------------------- 1 | /*M/////////////////////////////////////////////////////////////////////////////////////// 2 | // 3 | // IMPORTANT: READ BEFORE DOWNLOADING, COPYING, INSTALLING OR USING. 4 | // 5 | // By downloading, copying, installing or using the software you agree to this license. 6 | // If you do not agree to this license, do not download, install, 7 | // copy or use the software. 8 | // 9 | // 10 | // License Agreement 11 | // For Open Source Computer Vision Library 12 | // 13 | // Copyright (C) 2000-2008, Intel Corporation, all rights reserved. 14 | // Copyright (C) 2009, Willow Garage Inc., all rights reserved. 15 | // Third party copyrights are property of their respective owners. 16 | // 17 | // Redistribution and use in source and binary forms, with or without modification, 18 | // are permitted provided that the following conditions are met: 19 | // 20 | // * Redistribution's of source code must retain the above copyright notice, 21 | // this list of conditions and the following disclaimer. 22 | // 23 | // * Redistribution's in binary form must reproduce the above copyright notice, 24 | // this list of conditions and the following disclaimer in the documentation 25 | // and/or other materials provided with the distribution. 26 | // 27 | // * The name of the copyright holders may not be used to endorse or promote products 28 | // derived from this software without specific prior written permission. 29 | // 30 | // This software is provided by the copyright holders and contributors "as is" and 31 | // any express or implied warranties, including, but not limited to, the implied 32 | // warranties of merchantability and fitness for a particular purpose are disclaimed. 33 | // In no event shall the Intel Corporation or contributors be liable for any direct, 34 | // indirect, incidental, special, exemplary, or consequential damages 35 | // (including, but not limited to, procurement of substitute goods or services; 36 | // loss of use, data, or profits; or business interruption) however caused 37 | // and on any theory of liability, whether in contract, strict liability, 38 | // or tort (including negligence or otherwise) arising in any way out of 39 | // the use of this software, even if advised of the possibility of such damage. 40 | // 41 | //M*/ 42 | 43 | #ifndef OPENCV_CUDA_TYPE_TRAITS_HPP 44 | #define OPENCV_CUDA_TYPE_TRAITS_HPP 45 | 46 | #include "detail/type_traits_detail.hpp" 47 | 48 | /** @file 49 | * @deprecated Use @ref cudev instead. 50 | */ 51 | 52 | //! @cond IGNORED 53 | 54 | namespace cv { namespace cuda { namespace device 55 | { 56 | template struct IsSimpleParameter 57 | { 58 | enum {value = type_traits_detail::IsIntegral::value || type_traits_detail::IsFloat::value || 59 | type_traits_detail::PointerTraits::type>::value}; 60 | }; 61 | 62 | template struct TypeTraits 63 | { 64 | typedef typename type_traits_detail::UnConst::type NonConstType; 65 | typedef typename type_traits_detail::UnVolatile::type NonVolatileType; 66 | typedef typename type_traits_detail::UnVolatile::type>::type UnqualifiedType; 67 | typedef typename type_traits_detail::PointerTraits::type PointeeType; 68 | typedef typename type_traits_detail::ReferenceTraits::type ReferredType; 69 | 70 | enum { isConst = type_traits_detail::UnConst::value }; 71 | enum { isVolatile = type_traits_detail::UnVolatile::value }; 72 | 73 | enum { isReference = type_traits_detail::ReferenceTraits::value }; 74 | enum { isPointer = type_traits_detail::PointerTraits::type>::value }; 75 | 76 | enum { isUnsignedInt = type_traits_detail::IsUnsignedIntegral::value }; 77 | enum { isSignedInt = type_traits_detail::IsSignedIntergral::value }; 78 | enum { isIntegral = type_traits_detail::IsIntegral::value }; 79 | enum { isFloat = type_traits_detail::IsFloat::value }; 80 | enum { isArith = isIntegral || isFloat }; 81 | enum { isVec = type_traits_detail::IsVec::value }; 82 | 83 | typedef typename type_traits_detail::Select::value, 84 | T, typename type_traits_detail::AddParameterType::type>::type ParameterType; 85 | }; 86 | }}} 87 | 88 | //! @endcond 89 | 90 | #endif // OPENCV_CUDA_TYPE_TRAITS_HPP 91 | -------------------------------------------------------------------------------- /third_party/libopencv-4.6-aarch64-none/include/opencv4/opencv2/core/cuda/warp_reduce.hpp: -------------------------------------------------------------------------------- 1 | /*M/////////////////////////////////////////////////////////////////////////////////////// 2 | // 3 | // IMPORTANT: READ BEFORE DOWNLOADING, COPYING, INSTALLING OR USING. 4 | // 5 | // By downloading, copying, installing or using the software you agree to this license. 6 | // If you do not agree to this license, do not download, install, 7 | // copy or use the software. 8 | // 9 | // 10 | // License Agreement 11 | // For Open Source Computer Vision Library 12 | // 13 | // Copyright (C) 2000-2008, Intel Corporation, all rights reserved. 14 | // Copyright (C) 2009, Willow Garage Inc., all rights reserved. 15 | // Third party copyrights are property of their respective owners. 16 | // 17 | // Redistribution and use in source and binary forms, with or without modification, 18 | // are permitted provided that the following conditions are met: 19 | // 20 | // * Redistribution's of source code must retain the above copyright notice, 21 | // this list of conditions and the following disclaimer. 22 | // 23 | // * Redistribution's in binary form must reproduce the above copyright notice, 24 | // this list of conditions and the following disclaimer in the documentation 25 | // and/or other materials provided with the distribution. 26 | // 27 | // * The name of the copyright holders may not be used to endorse or promote products 28 | // derived from this software without specific prior written permission. 29 | // 30 | // This software is provided by the copyright holders and contributors "as is" and 31 | // any express or implied warranties, including, but not limited to, the implied 32 | // warranties of merchantability and fitness for a particular purpose are disclaimed. 33 | // In no event shall the Intel Corporation or contributors be liable for any direct, 34 | // indirect, incidental, special, exemplary, or consequential damages 35 | // (including, but not limited to, procurement of substitute goods or services; 36 | // loss of use, data, or profits; or business interruption) however caused 37 | // and on any theory of liability, whether in contract, strict liability, 38 | // or tort (including negligence or otherwise) arising in any way out of 39 | // the use of this software, even if advised of the possibility of such damage. 40 | // 41 | //M*/ 42 | 43 | #ifndef OPENCV_CUDA_WARP_REDUCE_HPP__ 44 | #define OPENCV_CUDA_WARP_REDUCE_HPP__ 45 | 46 | /** @file 47 | * @deprecated Use @ref cudev instead. 48 | */ 49 | 50 | //! @cond IGNORED 51 | 52 | namespace cv { namespace cuda { namespace device 53 | { 54 | template 55 | __device__ __forceinline__ T warp_reduce(volatile T *ptr , const unsigned int tid = threadIdx.x) 56 | { 57 | const unsigned int lane = tid & 31; // index of thread in warp (0..31) 58 | 59 | if (lane < 16) 60 | { 61 | T partial = ptr[tid]; 62 | 63 | ptr[tid] = partial = partial + ptr[tid + 16]; 64 | ptr[tid] = partial = partial + ptr[tid + 8]; 65 | ptr[tid] = partial = partial + ptr[tid + 4]; 66 | ptr[tid] = partial = partial + ptr[tid + 2]; 67 | ptr[tid] = partial = partial + ptr[tid + 1]; 68 | } 69 | 70 | return ptr[tid - lane]; 71 | } 72 | }}} // namespace cv { namespace cuda { namespace cudev { 73 | 74 | //! @endcond 75 | 76 | #endif /* OPENCV_CUDA_WARP_REDUCE_HPP__ */ 77 | -------------------------------------------------------------------------------- /third_party/libopencv-4.6-aarch64-none/include/opencv4/opencv2/core/cuda_stream_accessor.hpp: -------------------------------------------------------------------------------- 1 | /*M/////////////////////////////////////////////////////////////////////////////////////// 2 | // 3 | // IMPORTANT: READ BEFORE DOWNLOADING, COPYING, INSTALLING OR USING. 4 | // 5 | // By downloading, copying, installing or using the software you agree to this license. 6 | // If you do not agree to this license, do not download, install, 7 | // copy or use the software. 8 | // 9 | // 10 | // License Agreement 11 | // For Open Source Computer Vision Library 12 | // 13 | // Copyright (C) 2000-2008, Intel Corporation, all rights reserved. 14 | // Copyright (C) 2009, Willow Garage Inc., all rights reserved. 15 | // Third party copyrights are property of their respective owners. 16 | // 17 | // Redistribution and use in source and binary forms, with or without modification, 18 | // are permitted provided that the following conditions are met: 19 | // 20 | // * Redistribution's of source code must retain the above copyright notice, 21 | // this list of conditions and the following disclaimer. 22 | // 23 | // * Redistribution's in binary form must reproduce the above copyright notice, 24 | // this list of conditions and the following disclaimer in the documentation 25 | // and/or other materials provided with the distribution. 26 | // 27 | // * The name of the copyright holders may not be used to endorse or promote products 28 | // derived from this software without specific prior written permission. 29 | // 30 | // This software is provided by the copyright holders and contributors "as is" and 31 | // any express or implied warranties, including, but not limited to, the implied 32 | // warranties of merchantability and fitness for a particular purpose are disclaimed. 33 | // In no event shall the Intel Corporation or contributors be liable for any direct, 34 | // indirect, incidental, special, exemplary, or consequential damages 35 | // (including, but not limited to, procurement of substitute goods or services; 36 | // loss of use, data, or profits; or business interruption) however caused 37 | // and on any theory of liability, whether in contract, strict liability, 38 | // or tort (including negligence or otherwise) arising in any way out of 39 | // the use of this software, even if advised of the possibility of such damage. 40 | // 41 | //M*/ 42 | 43 | #ifndef OPENCV_CORE_CUDA_STREAM_ACCESSOR_HPP 44 | #define OPENCV_CORE_CUDA_STREAM_ACCESSOR_HPP 45 | 46 | #ifndef __cplusplus 47 | # error cuda_stream_accessor.hpp header must be compiled as C++ 48 | #endif 49 | 50 | /** @file cuda_stream_accessor.hpp 51 | * This is only header file that depends on CUDA Runtime API. All other headers are independent. 52 | */ 53 | 54 | #include 55 | #include "opencv2/core/cuda.hpp" 56 | 57 | namespace cv 58 | { 59 | namespace cuda 60 | { 61 | 62 | //! @addtogroup cudacore_struct 63 | //! @{ 64 | 65 | /** @brief Class that enables getting cudaStream_t from cuda::Stream 66 | */ 67 | struct StreamAccessor 68 | { 69 | CV_EXPORTS static cudaStream_t getStream(const Stream& stream); 70 | CV_EXPORTS static Stream wrapStream(cudaStream_t stream); 71 | }; 72 | 73 | /** @brief Class that enables getting cudaEvent_t from cuda::Event 74 | */ 75 | struct EventAccessor 76 | { 77 | CV_EXPORTS static cudaEvent_t getEvent(const Event& event); 78 | CV_EXPORTS static Event wrapEvent(cudaEvent_t event); 79 | }; 80 | 81 | //! @} 82 | 83 | } 84 | } 85 | 86 | #endif /* OPENCV_CORE_CUDA_STREAM_ACCESSOR_HPP */ 87 | -------------------------------------------------------------------------------- /third_party/libopencv-4.6-aarch64-none/include/opencv4/opencv2/core/detail/async_promise.hpp: -------------------------------------------------------------------------------- 1 | // This file is part of OpenCV project. 2 | // It is subject to the license terms in the LICENSE file found in the top-level directory 3 | // of this distribution and at http://opencv.org/license.html. 4 | 5 | #ifndef OPENCV_CORE_ASYNC_PROMISE_HPP 6 | #define OPENCV_CORE_ASYNC_PROMISE_HPP 7 | 8 | #include "../async.hpp" 9 | 10 | #include "exception_ptr.hpp" 11 | 12 | namespace cv { 13 | 14 | /** @addtogroup core_async 15 | @{ 16 | */ 17 | 18 | 19 | /** @brief Provides result of asynchronous operations 20 | 21 | */ 22 | class CV_EXPORTS AsyncPromise 23 | { 24 | public: 25 | ~AsyncPromise() CV_NOEXCEPT; 26 | AsyncPromise() CV_NOEXCEPT; 27 | explicit AsyncPromise(const AsyncPromise& o) CV_NOEXCEPT; 28 | AsyncPromise& operator=(const AsyncPromise& o) CV_NOEXCEPT; 29 | void release() CV_NOEXCEPT; 30 | 31 | /** Returns associated AsyncArray 32 | @note Can be called once 33 | */ 34 | AsyncArray getArrayResult(); 35 | 36 | /** Stores asynchronous result. 37 | @param[in] value result 38 | */ 39 | void setValue(InputArray value); 40 | 41 | // TODO "move" setters 42 | 43 | #if CV__EXCEPTION_PTR 44 | /** Stores exception. 45 | @param[in] exception exception to be raised in AsyncArray 46 | */ 47 | void setException(std::exception_ptr exception); 48 | #endif 49 | 50 | /** Stores exception. 51 | @param[in] exception exception to be raised in AsyncArray 52 | */ 53 | void setException(const cv::Exception& exception); 54 | 55 | #ifdef CV_CXX11 56 | explicit AsyncPromise(AsyncPromise&& o) { p = o.p; o.p = NULL; } 57 | AsyncPromise& operator=(AsyncPromise&& o) CV_NOEXCEPT { std::swap(p, o.p); return *this; } 58 | #endif 59 | 60 | 61 | // PImpl 62 | typedef struct AsyncArray::Impl Impl; friend struct AsyncArray::Impl; 63 | inline void* _getImpl() const CV_NOEXCEPT { return p; } 64 | protected: 65 | Impl* p; 66 | }; 67 | 68 | 69 | //! @} 70 | } // namespace 71 | #endif // OPENCV_CORE_ASYNC_PROMISE_HPP 72 | -------------------------------------------------------------------------------- /third_party/libopencv-4.6-aarch64-none/include/opencv4/opencv2/core/detail/dispatch_helper.impl.hpp: -------------------------------------------------------------------------------- 1 | // This file is part of OpenCV project. 2 | // It is subject to the license terms in the LICENSE file found in the top-level directory 3 | // of this distribution and at http://opencv.org/license.html. 4 | 5 | #ifndef OPENCV_CORE_DETAIL_DISPATCH_HELPER_IMPL_HPP 6 | #define OPENCV_CORE_DETAIL_DISPATCH_HELPER_IMPL_HPP 7 | 8 | //! @cond IGNORED 9 | 10 | namespace cv { 11 | namespace detail { 12 | 13 | template class Functor, typename... Args> 14 | static inline void depthDispatch(const int depth, Args&&... args) 15 | { 16 | switch (depth) 17 | { 18 | case CV_8U: 19 | Functor{}(std::forward(args)...); 20 | break; 21 | case CV_8S: 22 | Functor{}(std::forward(args)...); 23 | break; 24 | case CV_16U: 25 | Functor{}(std::forward(args)...); 26 | break; 27 | case CV_16S: 28 | Functor{}(std::forward(args)...); 29 | break; 30 | case CV_32S: 31 | Functor{}(std::forward(args)...); 32 | break; 33 | case CV_32F: 34 | Functor{}(std::forward(args)...); 35 | break; 36 | case CV_64F: 37 | Functor{}(std::forward(args)...); 38 | break; 39 | case CV_16F: 40 | default: 41 | CV_Error(cv::Error::BadDepth, "Unsupported matrix type."); 42 | }; 43 | } 44 | 45 | }} 46 | 47 | //! @endcond 48 | 49 | #endif //OPENCV_CORE_DETAIL_DISPATCH_HELPER_IMPL_HPP 50 | -------------------------------------------------------------------------------- /third_party/libopencv-4.6-aarch64-none/include/opencv4/opencv2/core/detail/exception_ptr.hpp: -------------------------------------------------------------------------------- 1 | // This file is part of OpenCV project. 2 | // It is subject to the license terms in the LICENSE file found in the top-level directory 3 | // of this distribution and at http://opencv.org/license.html. 4 | 5 | #ifndef OPENCV_CORE_DETAILS_EXCEPTION_PTR_H 6 | #define OPENCV_CORE_DETAILS_EXCEPTION_PTR_H 7 | 8 | #ifndef CV__EXCEPTION_PTR 9 | # if defined(__ANDROID__) && defined(ATOMIC_INT_LOCK_FREE) && ATOMIC_INT_LOCK_FREE < 2 10 | # define CV__EXCEPTION_PTR 0 // Not supported, details: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=58938 11 | # elif defined(CV_CXX11) 12 | # define CV__EXCEPTION_PTR 1 13 | # elif defined(_MSC_VER) 14 | # define CV__EXCEPTION_PTR (_MSC_VER >= 1600) 15 | # elif defined(__clang__) 16 | # define CV__EXCEPTION_PTR 0 // C++11 only (see above) 17 | # elif defined(__GNUC__) && defined(__GXX_EXPERIMENTAL_CXX0X__) 18 | # define CV__EXCEPTION_PTR (__GXX_EXPERIMENTAL_CXX0X__ > 0) 19 | # endif 20 | #endif 21 | #ifndef CV__EXCEPTION_PTR 22 | # define CV__EXCEPTION_PTR 0 23 | #elif CV__EXCEPTION_PTR 24 | # include // std::exception_ptr 25 | #endif 26 | 27 | #endif // OPENCV_CORE_DETAILS_EXCEPTION_PTR_H 28 | -------------------------------------------------------------------------------- /third_party/libopencv-4.6-aarch64-none/include/opencv4/opencv2/core/neon_utils.hpp: -------------------------------------------------------------------------------- 1 | /*M/////////////////////////////////////////////////////////////////////////////////////// 2 | // 3 | // IMPORTANT: READ BEFORE DOWNLOADING, COPYING, INSTALLING OR USING. 4 | // 5 | // By downloading, copying, installing or using the software you agree to this license. 6 | // If you do not agree to this license, do not download, install, 7 | // copy or use the software. 8 | // 9 | // 10 | // License Agreement 11 | // For Open Source Computer Vision Library 12 | // 13 | // Copyright (C) 2015, Itseez Inc., all rights reserved. 14 | // Third party copyrights are property of their respective owners. 15 | // 16 | // Redistribution and use in source and binary forms, with or without modification, 17 | // are permitted provided that the following conditions are met: 18 | // 19 | // * Redistribution's of source code must retain the above copyright notice, 20 | // this list of conditions and the following disclaimer. 21 | // 22 | // * Redistribution's in binary form must reproduce the above copyright notice, 23 | // this list of conditions and the following disclaimer in the documentation 24 | // and/or other materials provided with the distribution. 25 | // 26 | // * The name of the copyright holders may not be used to endorse or promote products 27 | // derived from this software without specific prior written permission. 28 | // 29 | // This software is provided by the copyright holders and contributors "as is" and 30 | // any express or implied warranties, including, but not limited to, the implied 31 | // warranties of merchantability and fitness for a particular purpose are disclaimed. 32 | // In no event shall the Intel Corporation or contributors be liable for any direct, 33 | // indirect, incidental, special, exemplary, or consequential damages 34 | // (including, but not limited to, procurement of substitute goods or services; 35 | // loss of use, data, or profits; or business interruption) however caused 36 | // and on any theory of liability, whether in contract, strict liability, 37 | // or tort (including negligence or otherwise) arising in any way out of 38 | // the use of this software, even if advised of the possibility of such damage. 39 | // 40 | //M*/ 41 | 42 | #ifndef OPENCV_HAL_NEON_UTILS_HPP 43 | #define OPENCV_HAL_NEON_UTILS_HPP 44 | 45 | #include "opencv2/core/cvdef.h" 46 | 47 | //! @addtogroup core_utils_neon 48 | //! @{ 49 | 50 | #if CV_NEON 51 | 52 | inline int32x2_t cv_vrnd_s32_f32(float32x2_t v) 53 | { 54 | static int32x2_t v_sign = vdup_n_s32(1 << 31), 55 | v_05 = vreinterpret_s32_f32(vdup_n_f32(0.5f)); 56 | 57 | int32x2_t v_addition = vorr_s32(v_05, vand_s32(v_sign, vreinterpret_s32_f32(v))); 58 | return vcvt_s32_f32(vadd_f32(v, vreinterpret_f32_s32(v_addition))); 59 | } 60 | 61 | inline int32x4_t cv_vrndq_s32_f32(float32x4_t v) 62 | { 63 | static int32x4_t v_sign = vdupq_n_s32(1 << 31), 64 | v_05 = vreinterpretq_s32_f32(vdupq_n_f32(0.5f)); 65 | 66 | int32x4_t v_addition = vorrq_s32(v_05, vandq_s32(v_sign, vreinterpretq_s32_f32(v))); 67 | return vcvtq_s32_f32(vaddq_f32(v, vreinterpretq_f32_s32(v_addition))); 68 | } 69 | 70 | inline uint32x2_t cv_vrnd_u32_f32(float32x2_t v) 71 | { 72 | static float32x2_t v_05 = vdup_n_f32(0.5f); 73 | return vcvt_u32_f32(vadd_f32(v, v_05)); 74 | } 75 | 76 | inline uint32x4_t cv_vrndq_u32_f32(float32x4_t v) 77 | { 78 | static float32x4_t v_05 = vdupq_n_f32(0.5f); 79 | return vcvtq_u32_f32(vaddq_f32(v, v_05)); 80 | } 81 | 82 | inline float32x4_t cv_vrecpq_f32(float32x4_t val) 83 | { 84 | float32x4_t reciprocal = vrecpeq_f32(val); 85 | reciprocal = vmulq_f32(vrecpsq_f32(val, reciprocal), reciprocal); 86 | reciprocal = vmulq_f32(vrecpsq_f32(val, reciprocal), reciprocal); 87 | return reciprocal; 88 | } 89 | 90 | inline float32x2_t cv_vrecp_f32(float32x2_t val) 91 | { 92 | float32x2_t reciprocal = vrecpe_f32(val); 93 | reciprocal = vmul_f32(vrecps_f32(val, reciprocal), reciprocal); 94 | reciprocal = vmul_f32(vrecps_f32(val, reciprocal), reciprocal); 95 | return reciprocal; 96 | } 97 | 98 | inline float32x4_t cv_vrsqrtq_f32(float32x4_t val) 99 | { 100 | float32x4_t e = vrsqrteq_f32(val); 101 | e = vmulq_f32(vrsqrtsq_f32(vmulq_f32(e, e), val), e); 102 | e = vmulq_f32(vrsqrtsq_f32(vmulq_f32(e, e), val), e); 103 | return e; 104 | } 105 | 106 | inline float32x2_t cv_vrsqrt_f32(float32x2_t val) 107 | { 108 | float32x2_t e = vrsqrte_f32(val); 109 | e = vmul_f32(vrsqrts_f32(vmul_f32(e, e), val), e); 110 | e = vmul_f32(vrsqrts_f32(vmul_f32(e, e), val), e); 111 | return e; 112 | } 113 | 114 | inline float32x4_t cv_vsqrtq_f32(float32x4_t val) 115 | { 116 | return cv_vrecpq_f32(cv_vrsqrtq_f32(val)); 117 | } 118 | 119 | inline float32x2_t cv_vsqrt_f32(float32x2_t val) 120 | { 121 | return cv_vrecp_f32(cv_vrsqrt_f32(val)); 122 | } 123 | 124 | #endif 125 | 126 | //! @} 127 | 128 | #endif // OPENCV_HAL_NEON_UTILS_HPP 129 | -------------------------------------------------------------------------------- /third_party/libopencv-4.6-aarch64-none/include/opencv4/opencv2/core/ocl_genbase.hpp: -------------------------------------------------------------------------------- 1 | /*M/////////////////////////////////////////////////////////////////////////////////////// 2 | // 3 | // IMPORTANT: READ BEFORE DOWNLOADING, COPYING, INSTALLING OR USING. 4 | // 5 | // By downloading, copying, installing or using the software you agree to this license. 6 | // If you do not agree to this license, do not download, install, 7 | // copy or use the software. 8 | // 9 | // 10 | // License Agreement 11 | // For Open Source Computer Vision Library 12 | // 13 | // Copyright (C) 2013, OpenCV Foundation, all rights reserved. 14 | // Third party copyrights are property of their respective owners. 15 | // 16 | // Redistribution and use in source and binary forms, with or without modification, 17 | // are permitted provided that the following conditions are met: 18 | // 19 | // * Redistribution's of source code must retain the above copyright notice, 20 | // this list of conditions and the following disclaimer. 21 | // 22 | // * Redistribution's in binary form must reproduce the above copyright notice, 23 | // this list of conditions and the following disclaimer in the documentation 24 | // and/or other materials provided with the distribution. 25 | // 26 | // * The name of the copyright holders may not be used to endorse or promote products 27 | // derived from this software without specific prior written permission. 28 | // 29 | // This software is provided by the copyright holders and contributors "as is" and 30 | // any express or implied warranties, including, but not limited to, the implied 31 | // warranties of merchantability and fitness for a particular purpose are disclaimed. 32 | // In no event shall the OpenCV Foundation or contributors be liable for any direct, 33 | // indirect, incidental, special, exemplary, or consequential damages 34 | // (including, but not limited to, procurement of substitute goods or services; 35 | // loss of use, data, or profits; or business interruption) however caused 36 | // and on any theory of liability, whether in contract, strict liability, 37 | // or tort (including negligence or otherwise) arising in any way out of 38 | // the use of this software, even if advised of the possibility of such damage. 39 | // 40 | //M*/ 41 | 42 | #ifndef OPENCV_OPENCL_GENBASE_HPP 43 | #define OPENCV_OPENCL_GENBASE_HPP 44 | 45 | //! @cond IGNORED 46 | 47 | namespace cv { 48 | namespace ocl { 49 | 50 | class ProgramSource; 51 | 52 | namespace internal { 53 | 54 | struct CV_EXPORTS ProgramEntry 55 | { 56 | const char* module; 57 | const char* name; 58 | const char* programCode; 59 | const char* programHash; 60 | ProgramSource* pProgramSource; 61 | 62 | operator ProgramSource& () const; 63 | }; 64 | 65 | } } } // namespace 66 | 67 | //! @endcond 68 | 69 | #endif 70 | -------------------------------------------------------------------------------- /third_party/libopencv-4.6-aarch64-none/include/opencv4/opencv2/core/opencl/ocl_defs.hpp: -------------------------------------------------------------------------------- 1 | // This file is part of OpenCV project. 2 | // It is subject to the license terms in the LICENSE file found in the top-level directory 3 | // of this distribution and at http://opencv.org/license.html. 4 | 5 | // Copyright (C) 2014, Advanced Micro Devices, Inc., all rights reserved. 6 | // Third party copyrights are property of their respective owners. 7 | 8 | #ifndef OPENCV_CORE_OPENCL_DEFS_HPP 9 | #define OPENCV_CORE_OPENCL_DEFS_HPP 10 | 11 | #include "opencv2/core/utility.hpp" 12 | #include "cvconfig.h" 13 | 14 | namespace cv { namespace ocl { 15 | #ifdef HAVE_OPENCL 16 | /// Call is similar to useOpenCL() but doesn't try to load OpenCL runtime or create OpenCL context 17 | CV_EXPORTS bool isOpenCLActivated(); 18 | #else 19 | static inline bool isOpenCLActivated() { return false; } 20 | #endif 21 | }} // namespace 22 | 23 | 24 | //#define CV_OPENCL_RUN_ASSERT 25 | 26 | #ifdef HAVE_OPENCL 27 | 28 | #ifdef CV_OPENCL_RUN_VERBOSE 29 | #define CV_OCL_RUN_(condition, func, ...) \ 30 | { \ 31 | if (cv::ocl::isOpenCLActivated() && (condition) && func) \ 32 | { \ 33 | printf("%s: OpenCL implementation is running\n", CV_Func); \ 34 | fflush(stdout); \ 35 | CV_IMPL_ADD(CV_IMPL_OCL); \ 36 | return __VA_ARGS__; \ 37 | } \ 38 | else \ 39 | { \ 40 | printf("%s: Plain implementation is running\n", CV_Func); \ 41 | fflush(stdout); \ 42 | } \ 43 | } 44 | #elif defined CV_OPENCL_RUN_ASSERT 45 | #define CV_OCL_RUN_(condition, func, ...) \ 46 | { \ 47 | if (cv::ocl::isOpenCLActivated() && (condition)) \ 48 | { \ 49 | if(func) \ 50 | { \ 51 | CV_IMPL_ADD(CV_IMPL_OCL); \ 52 | } \ 53 | else \ 54 | { \ 55 | CV_Error(cv::Error::StsAssert, #func); \ 56 | } \ 57 | return __VA_ARGS__; \ 58 | } \ 59 | } 60 | #else 61 | #define CV_OCL_RUN_(condition, func, ...) \ 62 | try \ 63 | { \ 64 | if (cv::ocl::isOpenCLActivated() && (condition) && func) \ 65 | { \ 66 | CV_IMPL_ADD(CV_IMPL_OCL); \ 67 | return __VA_ARGS__; \ 68 | } \ 69 | } \ 70 | catch (const cv::Exception& e) \ 71 | { \ 72 | CV_UNUSED(e); /* TODO: Add some logging here */ \ 73 | } 74 | #endif 75 | 76 | #else 77 | #define CV_OCL_RUN_(condition, func, ...) 78 | #endif 79 | 80 | #define CV_OCL_RUN(condition, func) CV_OCL_RUN_(condition, func) 81 | 82 | #endif // OPENCV_CORE_OPENCL_DEFS_HPP 83 | -------------------------------------------------------------------------------- /third_party/libopencv-4.6-aarch64-none/include/opencv4/opencv2/core/opencl/opencl_svm.hpp: -------------------------------------------------------------------------------- 1 | /* See LICENSE file in the root OpenCV directory */ 2 | 3 | #ifndef OPENCV_CORE_OPENCL_SVM_HPP 4 | #define OPENCV_CORE_OPENCL_SVM_HPP 5 | 6 | // 7 | // Internal usage only (binary compatibility is not guaranteed) 8 | // 9 | #ifndef __OPENCV_BUILD 10 | #error Internal header file 11 | #endif 12 | 13 | #if defined(HAVE_OPENCL) && defined(HAVE_OPENCL_SVM) 14 | #include "runtime/opencl_core.hpp" 15 | #include "runtime/opencl_svm_20.hpp" 16 | #include "runtime/opencl_svm_hsa_extension.hpp" 17 | 18 | namespace cv { namespace ocl { namespace svm { 19 | 20 | struct SVMCapabilities 21 | { 22 | enum Value 23 | { 24 | SVM_COARSE_GRAIN_BUFFER = (1 << 0), 25 | SVM_FINE_GRAIN_BUFFER = (1 << 1), 26 | SVM_FINE_GRAIN_SYSTEM = (1 << 2), 27 | SVM_ATOMICS = (1 << 3), 28 | }; 29 | int value_; 30 | 31 | SVMCapabilities(int capabilities = 0) : value_(capabilities) { } 32 | operator int() const { return value_; } 33 | 34 | inline bool isNoSVMSupport() const { return value_ == 0; } 35 | inline bool isSupportCoarseGrainBuffer() const { return (value_ & SVM_COARSE_GRAIN_BUFFER) != 0; } 36 | inline bool isSupportFineGrainBuffer() const { return (value_ & SVM_FINE_GRAIN_BUFFER) != 0; } 37 | inline bool isSupportFineGrainSystem() const { return (value_ & SVM_FINE_GRAIN_SYSTEM) != 0; } 38 | inline bool isSupportAtomics() const { return (value_ & SVM_ATOMICS) != 0; } 39 | }; 40 | 41 | CV_EXPORTS const SVMCapabilities getSVMCapabilitites(const ocl::Context& context); 42 | 43 | struct SVMFunctions 44 | { 45 | clSVMAllocAMD_fn fn_clSVMAlloc; 46 | clSVMFreeAMD_fn fn_clSVMFree; 47 | clSetKernelArgSVMPointerAMD_fn fn_clSetKernelArgSVMPointer; 48 | //clSetKernelExecInfoAMD_fn fn_clSetKernelExecInfo; 49 | //clEnqueueSVMFreeAMD_fn fn_clEnqueueSVMFree; 50 | clEnqueueSVMMemcpyAMD_fn fn_clEnqueueSVMMemcpy; 51 | clEnqueueSVMMemFillAMD_fn fn_clEnqueueSVMMemFill; 52 | clEnqueueSVMMapAMD_fn fn_clEnqueueSVMMap; 53 | clEnqueueSVMUnmapAMD_fn fn_clEnqueueSVMUnmap; 54 | 55 | inline SVMFunctions() 56 | : fn_clSVMAlloc(NULL), fn_clSVMFree(NULL), 57 | fn_clSetKernelArgSVMPointer(NULL), /*fn_clSetKernelExecInfo(NULL),*/ 58 | /*fn_clEnqueueSVMFree(NULL),*/ fn_clEnqueueSVMMemcpy(NULL), fn_clEnqueueSVMMemFill(NULL), 59 | fn_clEnqueueSVMMap(NULL), fn_clEnqueueSVMUnmap(NULL) 60 | { 61 | // nothing 62 | } 63 | 64 | inline bool isValid() const 65 | { 66 | return fn_clSVMAlloc != NULL && fn_clSVMFree && fn_clSetKernelArgSVMPointer && 67 | /*fn_clSetKernelExecInfo && fn_clEnqueueSVMFree &&*/ fn_clEnqueueSVMMemcpy && 68 | fn_clEnqueueSVMMemFill && fn_clEnqueueSVMMap && fn_clEnqueueSVMUnmap; 69 | } 70 | }; 71 | 72 | // We should guarantee that SVMFunctions lifetime is not less than context's lifetime 73 | CV_EXPORTS const SVMFunctions* getSVMFunctions(const ocl::Context& context); 74 | 75 | CV_EXPORTS bool useSVM(UMatUsageFlags usageFlags); 76 | 77 | }}} //namespace cv::ocl::svm 78 | #endif 79 | 80 | #endif // OPENCV_CORE_OPENCL_SVM_HPP 81 | /* End of file. */ 82 | -------------------------------------------------------------------------------- /third_party/libopencv-4.6-aarch64-none/include/opencv4/opencv2/core/opencl/runtime/autogenerated/opencl_gl.hpp: -------------------------------------------------------------------------------- 1 | // 2 | // AUTOGENERATED, DO NOT EDIT 3 | // 4 | #ifndef OPENCV_CORE_OCL_RUNTIME_OPENCL_GL_HPP 5 | #error "Invalid usage" 6 | #endif 7 | 8 | // generated by parser_cl.py 9 | #define clCreateFromGLBuffer clCreateFromGLBuffer_ 10 | #define clCreateFromGLRenderbuffer clCreateFromGLRenderbuffer_ 11 | #define clCreateFromGLTexture clCreateFromGLTexture_ 12 | #define clCreateFromGLTexture2D clCreateFromGLTexture2D_ 13 | #define clCreateFromGLTexture3D clCreateFromGLTexture3D_ 14 | #define clEnqueueAcquireGLObjects clEnqueueAcquireGLObjects_ 15 | #define clEnqueueReleaseGLObjects clEnqueueReleaseGLObjects_ 16 | #define clGetGLContextInfoKHR clGetGLContextInfoKHR_ 17 | #define clGetGLObjectInfo clGetGLObjectInfo_ 18 | #define clGetGLTextureInfo clGetGLTextureInfo_ 19 | 20 | #if defined __APPLE__ 21 | #include 22 | #else 23 | #include 24 | #endif 25 | 26 | // generated by parser_cl.py 27 | #undef clCreateFromGLBuffer 28 | #define clCreateFromGLBuffer clCreateFromGLBuffer_pfn 29 | #undef clCreateFromGLRenderbuffer 30 | #define clCreateFromGLRenderbuffer clCreateFromGLRenderbuffer_pfn 31 | #undef clCreateFromGLTexture 32 | #define clCreateFromGLTexture clCreateFromGLTexture_pfn 33 | #undef clCreateFromGLTexture2D 34 | #define clCreateFromGLTexture2D clCreateFromGLTexture2D_pfn 35 | #undef clCreateFromGLTexture3D 36 | #define clCreateFromGLTexture3D clCreateFromGLTexture3D_pfn 37 | #undef clEnqueueAcquireGLObjects 38 | #define clEnqueueAcquireGLObjects clEnqueueAcquireGLObjects_pfn 39 | #undef clEnqueueReleaseGLObjects 40 | #define clEnqueueReleaseGLObjects clEnqueueReleaseGLObjects_pfn 41 | #undef clGetGLContextInfoKHR 42 | #define clGetGLContextInfoKHR clGetGLContextInfoKHR_pfn 43 | #undef clGetGLObjectInfo 44 | #define clGetGLObjectInfo clGetGLObjectInfo_pfn 45 | #undef clGetGLTextureInfo 46 | #define clGetGLTextureInfo clGetGLTextureInfo_pfn 47 | 48 | #ifdef cl_khr_gl_sharing 49 | 50 | // generated by parser_cl.py 51 | extern CL_RUNTIME_EXPORT cl_mem (CL_API_CALL*clCreateFromGLBuffer)(cl_context, cl_mem_flags, cl_GLuint, int*); 52 | extern CL_RUNTIME_EXPORT cl_mem (CL_API_CALL*clCreateFromGLRenderbuffer)(cl_context, cl_mem_flags, cl_GLuint, cl_int*); 53 | extern CL_RUNTIME_EXPORT cl_mem (CL_API_CALL*clCreateFromGLTexture)(cl_context, cl_mem_flags, cl_GLenum, cl_GLint, cl_GLuint, cl_int*); 54 | extern CL_RUNTIME_EXPORT cl_mem (CL_API_CALL*clCreateFromGLTexture2D)(cl_context, cl_mem_flags, cl_GLenum, cl_GLint, cl_GLuint, cl_int*); 55 | extern CL_RUNTIME_EXPORT cl_mem (CL_API_CALL*clCreateFromGLTexture3D)(cl_context, cl_mem_flags, cl_GLenum, cl_GLint, cl_GLuint, cl_int*); 56 | extern CL_RUNTIME_EXPORT cl_int (CL_API_CALL*clEnqueueAcquireGLObjects)(cl_command_queue, cl_uint, const cl_mem*, cl_uint, const cl_event*, cl_event*); 57 | extern CL_RUNTIME_EXPORT cl_int (CL_API_CALL*clEnqueueReleaseGLObjects)(cl_command_queue, cl_uint, const cl_mem*, cl_uint, const cl_event*, cl_event*); 58 | extern CL_RUNTIME_EXPORT cl_int (CL_API_CALL*clGetGLContextInfoKHR)(const cl_context_properties*, cl_gl_context_info, size_t, void*, size_t*); 59 | extern CL_RUNTIME_EXPORT cl_int (CL_API_CALL*clGetGLObjectInfo)(cl_mem, cl_gl_object_type*, cl_GLuint*); 60 | extern CL_RUNTIME_EXPORT cl_int (CL_API_CALL*clGetGLTextureInfo)(cl_mem, cl_gl_texture_info, size_t, void*, size_t*); 61 | 62 | #endif // cl_khr_gl_sharing 63 | -------------------------------------------------------------------------------- /third_party/libopencv-4.6-aarch64-none/include/opencv4/opencv2/core/opencl/runtime/autogenerated/opencl_gl_wrappers.hpp: -------------------------------------------------------------------------------- 1 | // 2 | // AUTOGENERATED, DO NOT EDIT 3 | // 4 | #ifndef OPENCV_CORE_OCL_RUNTIME_OPENCL_GL_WRAPPERS_HPP 5 | #error "Invalid usage" 6 | #endif 7 | 8 | #ifdef cl_khr_gl_sharing 9 | 10 | // generated by parser_cl.py 11 | #undef clCreateFromGLBuffer 12 | #define clCreateFromGLBuffer clCreateFromGLBuffer_fn 13 | inline cl_mem clCreateFromGLBuffer(cl_context p0, cl_mem_flags p1, cl_GLuint p2, int* p3) { return clCreateFromGLBuffer_pfn(p0, p1, p2, p3); } 14 | #undef clCreateFromGLRenderbuffer 15 | #define clCreateFromGLRenderbuffer clCreateFromGLRenderbuffer_fn 16 | inline cl_mem clCreateFromGLRenderbuffer(cl_context p0, cl_mem_flags p1, cl_GLuint p2, cl_int* p3) { return clCreateFromGLRenderbuffer_pfn(p0, p1, p2, p3); } 17 | #undef clCreateFromGLTexture 18 | #define clCreateFromGLTexture clCreateFromGLTexture_fn 19 | inline cl_mem clCreateFromGLTexture(cl_context p0, cl_mem_flags p1, cl_GLenum p2, cl_GLint p3, cl_GLuint p4, cl_int* p5) { return clCreateFromGLTexture_pfn(p0, p1, p2, p3, p4, p5); } 20 | #undef clCreateFromGLTexture2D 21 | #define clCreateFromGLTexture2D clCreateFromGLTexture2D_fn 22 | inline cl_mem clCreateFromGLTexture2D(cl_context p0, cl_mem_flags p1, cl_GLenum p2, cl_GLint p3, cl_GLuint p4, cl_int* p5) { return clCreateFromGLTexture2D_pfn(p0, p1, p2, p3, p4, p5); } 23 | #undef clCreateFromGLTexture3D 24 | #define clCreateFromGLTexture3D clCreateFromGLTexture3D_fn 25 | inline cl_mem clCreateFromGLTexture3D(cl_context p0, cl_mem_flags p1, cl_GLenum p2, cl_GLint p3, cl_GLuint p4, cl_int* p5) { return clCreateFromGLTexture3D_pfn(p0, p1, p2, p3, p4, p5); } 26 | #undef clEnqueueAcquireGLObjects 27 | #define clEnqueueAcquireGLObjects clEnqueueAcquireGLObjects_fn 28 | inline cl_int clEnqueueAcquireGLObjects(cl_command_queue p0, cl_uint p1, const cl_mem* p2, cl_uint p3, const cl_event* p4, cl_event* p5) { return clEnqueueAcquireGLObjects_pfn(p0, p1, p2, p3, p4, p5); } 29 | #undef clEnqueueReleaseGLObjects 30 | #define clEnqueueReleaseGLObjects clEnqueueReleaseGLObjects_fn 31 | inline cl_int clEnqueueReleaseGLObjects(cl_command_queue p0, cl_uint p1, const cl_mem* p2, cl_uint p3, const cl_event* p4, cl_event* p5) { return clEnqueueReleaseGLObjects_pfn(p0, p1, p2, p3, p4, p5); } 32 | #undef clGetGLContextInfoKHR 33 | #define clGetGLContextInfoKHR clGetGLContextInfoKHR_fn 34 | inline cl_int clGetGLContextInfoKHR(const cl_context_properties* p0, cl_gl_context_info p1, size_t p2, void* p3, size_t* p4) { return clGetGLContextInfoKHR_pfn(p0, p1, p2, p3, p4); } 35 | #undef clGetGLObjectInfo 36 | #define clGetGLObjectInfo clGetGLObjectInfo_fn 37 | inline cl_int clGetGLObjectInfo(cl_mem p0, cl_gl_object_type* p1, cl_GLuint* p2) { return clGetGLObjectInfo_pfn(p0, p1, p2); } 38 | #undef clGetGLTextureInfo 39 | #define clGetGLTextureInfo clGetGLTextureInfo_fn 40 | inline cl_int clGetGLTextureInfo(cl_mem p0, cl_gl_texture_info p1, size_t p2, void* p3, size_t* p4) { return clGetGLTextureInfo_pfn(p0, p1, p2, p3, p4); } 41 | 42 | #endif // cl_khr_gl_sharing 43 | -------------------------------------------------------------------------------- /third_party/libopencv-4.6-aarch64-none/include/opencv4/opencv2/core/opencl/runtime/opencl_clblas.hpp: -------------------------------------------------------------------------------- 1 | /*M/////////////////////////////////////////////////////////////////////////////////////// 2 | // 3 | // IMPORTANT: READ BEFORE DOWNLOADING, COPYING, INSTALLING OR USING. 4 | // 5 | // By downloading, copying, installing or using the software you agree to this license. 6 | // If you do not agree to this license, do not download, install, 7 | // copy or use the software. 8 | // 9 | // 10 | // License Agreement 11 | // For Open Source Computer Vision Library 12 | // 13 | // Copyright (C) 2010-2013, Advanced Micro Devices, Inc., all rights reserved. 14 | // Third party copyrights are property of their respective owners. 15 | // 16 | // Redistribution and use in source and binary forms, with or without modification, 17 | // are permitted provided that the following conditions are met: 18 | // 19 | // * Redistribution's of source code must retain the above copyright notice, 20 | // this list of conditions and the following disclaimer. 21 | // 22 | // * Redistribution's in binary form must reproduce the above copyright notice, 23 | // this list of conditions and the following disclaimer in the documentation 24 | // and/or other materials provided with the distribution. 25 | // 26 | // * The name of the copyright holders may not be used to endorse or promote products 27 | // derived from this software without specific prior written permission. 28 | // 29 | // This software is provided by the copyright holders and contributors "as is" and 30 | // any express or implied warranties, including, but not limited to, the implied 31 | // warranties of merchantability and fitness for a particular purpose are disclaimed. 32 | // In no event shall the OpenCV Foundation or contributors be liable for any direct, 33 | // indirect, incidental, special, exemplary, or consequential damages 34 | // (including, but not limited to, procurement of substitute goods or services; 35 | // loss of use, data, or profits; or business interruption) however caused 36 | // and on any theory of liability, whether in contract, strict liability, 37 | // or tort (including negligence or otherwise) arising in any way out of 38 | // the use of this software, even if advised of the possibility of such damage. 39 | // 40 | //M*/ 41 | 42 | #ifndef OPENCV_CORE_OCL_RUNTIME_CLAMDBLAS_HPP 43 | #define OPENCV_CORE_OCL_RUNTIME_CLAMDBLAS_HPP 44 | 45 | #ifdef HAVE_CLAMDBLAS 46 | 47 | #include "opencl_core.hpp" 48 | 49 | #include "autogenerated/opencl_clblas.hpp" 50 | 51 | #endif // HAVE_CLAMDBLAS 52 | 53 | #endif // OPENCV_CORE_OCL_RUNTIME_CLAMDBLAS_HPP 54 | -------------------------------------------------------------------------------- /third_party/libopencv-4.6-aarch64-none/include/opencv4/opencv2/core/opencl/runtime/opencl_clfft.hpp: -------------------------------------------------------------------------------- 1 | /*M/////////////////////////////////////////////////////////////////////////////////////// 2 | // 3 | // IMPORTANT: READ BEFORE DOWNLOADING, COPYING, INSTALLING OR USING. 4 | // 5 | // By downloading, copying, installing or using the software you agree to this license. 6 | // If you do not agree to this license, do not download, install, 7 | // copy or use the software. 8 | // 9 | // 10 | // License Agreement 11 | // For Open Source Computer Vision Library 12 | // 13 | // Copyright (C) 2010-2013, Advanced Micro Devices, Inc., all rights reserved. 14 | // Third party copyrights are property of their respective owners. 15 | // 16 | // Redistribution and use in source and binary forms, with or without modification, 17 | // are permitted provided that the following conditions are met: 18 | // 19 | // * Redistribution's of source code must retain the above copyright notice, 20 | // this list of conditions and the following disclaimer. 21 | // 22 | // * Redistribution's in binary form must reproduce the above copyright notice, 23 | // this list of conditions and the following disclaimer in the documentation 24 | // and/or other materials provided with the distribution. 25 | // 26 | // * The name of the copyright holders may not be used to endorse or promote products 27 | // derived from this software without specific prior written permission. 28 | // 29 | // This software is provided by the copyright holders and contributors "as is" and 30 | // any express or implied warranties, including, but not limited to, the implied 31 | // warranties of merchantability and fitness for a particular purpose are disclaimed. 32 | // In no event shall the OpenCV Foundation or contributors be liable for any direct, 33 | // indirect, incidental, special, exemplary, or consequential damages 34 | // (including, but not limited to, procurement of substitute goods or services; 35 | // loss of use, data, or profits; or business interruption) however caused 36 | // and on any theory of liability, whether in contract, strict liability, 37 | // or tort (including negligence or otherwise) arising in any way out of 38 | // the use of this software, even if advised of the possibility of such damage. 39 | // 40 | //M*/ 41 | 42 | #ifndef OPENCV_CORE_OCL_RUNTIME_CLAMDFFT_HPP 43 | #define OPENCV_CORE_OCL_RUNTIME_CLAMDFFT_HPP 44 | 45 | #ifdef HAVE_CLAMDFFT 46 | 47 | #include "opencl_core.hpp" 48 | 49 | #include "autogenerated/opencl_clfft.hpp" 50 | 51 | #endif // HAVE_CLAMDFFT 52 | 53 | #endif // OPENCV_CORE_OCL_RUNTIME_CLAMDFFT_HPP 54 | -------------------------------------------------------------------------------- /third_party/libopencv-4.6-aarch64-none/include/opencv4/opencv2/core/opencl/runtime/opencl_core.hpp: -------------------------------------------------------------------------------- 1 | /*M/////////////////////////////////////////////////////////////////////////////////////// 2 | // 3 | // IMPORTANT: READ BEFORE DOWNLOADING, COPYING, INSTALLING OR USING. 4 | // 5 | // By downloading, copying, installing or using the software you agree to this license. 6 | // If you do not agree to this license, do not download, install, 7 | // copy or use the software. 8 | // 9 | // 10 | // License Agreement 11 | // For Open Source Computer Vision Library 12 | // 13 | // Copyright (C) 2010-2013, Advanced Micro Devices, Inc., all rights reserved. 14 | // Third party copyrights are property of their respective owners. 15 | // 16 | // Redistribution and use in source and binary forms, with or without modification, 17 | // are permitted provided that the following conditions are met: 18 | // 19 | // * Redistribution's of source code must retain the above copyright notice, 20 | // this list of conditions and the following disclaimer. 21 | // 22 | // * Redistribution's in binary form must reproduce the above copyright notice, 23 | // this list of conditions and the following disclaimer in the documentation 24 | // and/or other materials provided with the distribution. 25 | // 26 | // * The name of the copyright holders may not be used to endorse or promote products 27 | // derived from this software without specific prior written permission. 28 | // 29 | // This software is provided by the copyright holders and contributors "as is" and 30 | // any express or implied warranties, including, but not limited to, the implied 31 | // warranties of merchantability and fitness for a particular purpose are disclaimed. 32 | // In no event shall the OpenCV Foundation or contributors be liable for any direct, 33 | // indirect, incidental, special, exemplary, or consequential damages 34 | // (including, but not limited to, procurement of substitute goods or services; 35 | // loss of use, data, or profits; or business interruption) however caused 36 | // and on any theory of liability, whether in contract, strict liability, 37 | // or tort (including negligence or otherwise) arising in any way out of 38 | // the use of this software, even if advised of the possibility of such damage. 39 | // 40 | //M*/ 41 | 42 | #ifndef OPENCV_CORE_OCL_RUNTIME_OPENCL_CORE_HPP 43 | #define OPENCV_CORE_OCL_RUNTIME_OPENCL_CORE_HPP 44 | 45 | #ifdef HAVE_OPENCL 46 | 47 | #ifndef CL_RUNTIME_EXPORT 48 | #if (defined(BUILD_SHARED_LIBS) || defined(OPENCV_CORE_SHARED)) && (defined _WIN32 || defined WINCE) && \ 49 | !(defined(__OPENCV_BUILD) && defined(OPENCV_MODULE_IS_PART_OF_WORLD)) 50 | #define CL_RUNTIME_EXPORT __declspec(dllimport) 51 | #else 52 | #define CL_RUNTIME_EXPORT 53 | #endif 54 | #endif 55 | 56 | #ifdef HAVE_OPENCL_SVM 57 | #define clSVMAlloc clSVMAlloc_ 58 | #define clSVMFree clSVMFree_ 59 | #define clSetKernelArgSVMPointer clSetKernelArgSVMPointer_ 60 | #define clSetKernelExecInfo clSetKernelExecInfo_ 61 | #define clEnqueueSVMFree clEnqueueSVMFree_ 62 | #define clEnqueueSVMMemcpy clEnqueueSVMMemcpy_ 63 | #define clEnqueueSVMMemFill clEnqueueSVMMemFill_ 64 | #define clEnqueueSVMMap clEnqueueSVMMap_ 65 | #define clEnqueueSVMUnmap clEnqueueSVMUnmap_ 66 | #endif 67 | 68 | #include "autogenerated/opencl_core.hpp" 69 | 70 | #ifndef CL_DEVICE_DOUBLE_FP_CONFIG 71 | #define CL_DEVICE_DOUBLE_FP_CONFIG 0x1032 72 | #endif 73 | 74 | #ifndef CL_DEVICE_HALF_FP_CONFIG 75 | #define CL_DEVICE_HALF_FP_CONFIG 0x1033 76 | #endif 77 | 78 | #ifndef CL_VERSION_1_2 79 | #define CV_REQUIRE_OPENCL_1_2_ERROR CV_Error(cv::Error::OpenCLApiCallError, "OpenCV compiled without OpenCL v1.2 support, so we can't use functionality from OpenCL v1.2") 80 | #endif 81 | 82 | #endif // HAVE_OPENCL 83 | 84 | #endif // OPENCV_CORE_OCL_RUNTIME_OPENCL_CORE_HPP 85 | -------------------------------------------------------------------------------- /third_party/libopencv-4.6-aarch64-none/include/opencv4/opencv2/core/opencl/runtime/opencl_core_wrappers.hpp: -------------------------------------------------------------------------------- 1 | /*M/////////////////////////////////////////////////////////////////////////////////////// 2 | // 3 | // IMPORTANT: READ BEFORE DOWNLOADING, COPYING, INSTALLING OR USING. 4 | // 5 | // By downloading, copying, installing or using the software you agree to this license. 6 | // If you do not agree to this license, do not download, install, 7 | // copy or use the software. 8 | // 9 | // 10 | // License Agreement 11 | // For Open Source Computer Vision Library 12 | // 13 | // Copyright (C) 2010-2013, Advanced Micro Devices, Inc., all rights reserved. 14 | // Third party copyrights are property of their respective owners. 15 | // 16 | // Redistribution and use in source and binary forms, with or without modification, 17 | // are permitted provided that the following conditions are met: 18 | // 19 | // * Redistribution's of source code must retain the above copyright notice, 20 | // this list of conditions and the following disclaimer. 21 | // 22 | // * Redistribution's in binary form must reproduce the above copyright notice, 23 | // this list of conditions and the following disclaimer in the documentation 24 | // and/or other materials provided with the distribution. 25 | // 26 | // * The name of the copyright holders may not be used to endorse or promote products 27 | // derived from this software without specific prior written permission. 28 | // 29 | // This software is provided by the copyright holders and contributors "as is" and 30 | // any express or implied warranties, including, but not limited to, the implied 31 | // warranties of merchantability and fitness for a particular purpose are disclaimed. 32 | // In no event shall the OpenCV Foundation or contributors be liable for any direct, 33 | // indirect, incidental, special, exemplary, or consequential damages 34 | // (including, but not limited to, procurement of substitute goods or services; 35 | // loss of use, data, or profits; or business interruption) however caused 36 | // and on any theory of liability, whether in contract, strict liability, 37 | // or tort (including negligence or otherwise) arising in any way out of 38 | // the use of this software, even if advised of the possibility of such damage. 39 | // 40 | //M*/ 41 | 42 | #ifndef OPENCV_CORE_OCL_RUNTIME_OPENCL_WRAPPERS_HPP 43 | #define OPENCV_CORE_OCL_RUNTIME_OPENCL_WRAPPERS_HPP 44 | 45 | #include "autogenerated/opencl_core_wrappers.hpp" 46 | 47 | #endif // OPENCV_CORE_OCL_RUNTIME_OPENCL_WRAPPERS_HPP 48 | -------------------------------------------------------------------------------- /third_party/libopencv-4.6-aarch64-none/include/opencv4/opencv2/core/opencl/runtime/opencl_gl.hpp: -------------------------------------------------------------------------------- 1 | /*M/////////////////////////////////////////////////////////////////////////////////////// 2 | // 3 | // IMPORTANT: READ BEFORE DOWNLOADING, COPYING, INSTALLING OR USING. 4 | // 5 | // By downloading, copying, installing or using the software you agree to this license. 6 | // If you do not agree to this license, do not download, install, 7 | // copy or use the software. 8 | // 9 | // 10 | // License Agreement 11 | // For Open Source Computer Vision Library 12 | // 13 | // Copyright (C) 2010-2013, Advanced Micro Devices, Inc., all rights reserved. 14 | // Third party copyrights are property of their respective owners. 15 | // 16 | // Redistribution and use in source and binary forms, with or without modification, 17 | // are permitted provided that the following conditions are met: 18 | // 19 | // * Redistribution's of source code must retain the above copyright notice, 20 | // this list of conditions and the following disclaimer. 21 | // 22 | // * Redistribution's in binary form must reproduce the above copyright notice, 23 | // this list of conditions and the following disclaimer in the documentation 24 | // and/or other materials provided with the distribution. 25 | // 26 | // * The name of the copyright holders may not be used to endorse or promote products 27 | // derived from this software without specific prior written permission. 28 | // 29 | // This software is provided by the copyright holders and contributors "as is" and 30 | // any express or implied warranties, including, but not limited to, the implied 31 | // warranties of merchantability and fitness for a particular purpose are disclaimed. 32 | // In no event shall the OpenCV Foundation or contributors be liable for any direct, 33 | // indirect, incidental, special, exemplary, or consequential damages 34 | // (including, but not limited to, procurement of substitute goods or services; 35 | // loss of use, data, or profits; or business interruption) however caused 36 | // and on any theory of liability, whether in contract, strict liability, 37 | // or tort (including negligence or otherwise) arising in any way out of 38 | // the use of this software, even if advised of the possibility of such damage. 39 | // 40 | //M*/ 41 | 42 | #ifndef OPENCV_CORE_OCL_RUNTIME_OPENCL_GL_HPP 43 | #define OPENCV_CORE_OCL_RUNTIME_OPENCL_GL_HPP 44 | 45 | #if defined HAVE_OPENCL && defined HAVE_OPENGL 46 | 47 | #include "opencl_core.hpp" 48 | 49 | #include "autogenerated/opencl_gl.hpp" 50 | 51 | #endif // defined HAVE_OPENCL && defined HAVE_OPENGL 52 | 53 | #endif // OPENCV_CORE_OCL_RUNTIME_OPENCL_GL_HPP 54 | -------------------------------------------------------------------------------- /third_party/libopencv-4.6-aarch64-none/include/opencv4/opencv2/core/opencl/runtime/opencl_gl_wrappers.hpp: -------------------------------------------------------------------------------- 1 | /*M/////////////////////////////////////////////////////////////////////////////////////// 2 | // 3 | // IMPORTANT: READ BEFORE DOWNLOADING, COPYING, INSTALLING OR USING. 4 | // 5 | // By downloading, copying, installing or using the software you agree to this license. 6 | // If you do not agree to this license, do not download, install, 7 | // copy or use the software. 8 | // 9 | // 10 | // License Agreement 11 | // For Open Source Computer Vision Library 12 | // 13 | // Copyright (C) 2010-2013, Advanced Micro Devices, Inc., all rights reserved. 14 | // Third party copyrights are property of their respective owners. 15 | // 16 | // Redistribution and use in source and binary forms, with or without modification, 17 | // are permitted provided that the following conditions are met: 18 | // 19 | // * Redistribution's of source code must retain the above copyright notice, 20 | // this list of conditions and the following disclaimer. 21 | // 22 | // * Redistribution's in binary form must reproduce the above copyright notice, 23 | // this list of conditions and the following disclaimer in the documentation 24 | // and/or other materials provided with the distribution. 25 | // 26 | // * The name of the copyright holders may not be used to endorse or promote products 27 | // derived from this software without specific prior written permission. 28 | // 29 | // This software is provided by the copyright holders and contributors "as is" and 30 | // any express or implied warranties, including, but not limited to, the implied 31 | // warranties of merchantability and fitness for a particular purpose are disclaimed. 32 | // In no event shall the OpenCV Foundation or contributors be liable for any direct, 33 | // indirect, incidental, special, exemplary, or consequential damages 34 | // (including, but not limited to, procurement of substitute goods or services; 35 | // loss of use, data, or profits; or business interruption) however caused 36 | // and on any theory of liability, whether in contract, strict liability, 37 | // or tort (including negligence or otherwise) arising in any way out of 38 | // the use of this software, even if advised of the possibility of such damage. 39 | // 40 | //M*/ 41 | 42 | #ifndef OPENCV_CORE_OCL_RUNTIME_OPENCL_GL_WRAPPERS_HPP 43 | #define OPENCV_CORE_OCL_RUNTIME_OPENCL_GL_WRAPPERS_HPP 44 | 45 | #include "autogenerated/opencl_gl_wrappers.hpp" 46 | 47 | #endif // OPENCV_CORE_OCL_RUNTIME_OPENCL_GL_WRAPPERS_HPP 48 | -------------------------------------------------------------------------------- /third_party/libopencv-4.6-aarch64-none/include/opencv4/opencv2/core/opencl/runtime/opencl_svm_20.hpp: -------------------------------------------------------------------------------- 1 | /* See LICENSE file in the root OpenCV directory */ 2 | 3 | #ifndef OPENCV_CORE_OCL_RUNTIME_OPENCL_SVM_2_0_HPP 4 | #define OPENCV_CORE_OCL_RUNTIME_OPENCL_SVM_2_0_HPP 5 | 6 | #if defined(HAVE_OPENCL_SVM) 7 | #include "opencl_core.hpp" 8 | 9 | #include "opencl_svm_definitions.hpp" 10 | 11 | #undef clSVMAlloc 12 | #define clSVMAlloc clSVMAlloc_pfn 13 | #undef clSVMFree 14 | #define clSVMFree clSVMFree_pfn 15 | #undef clSetKernelArgSVMPointer 16 | #define clSetKernelArgSVMPointer clSetKernelArgSVMPointer_pfn 17 | #undef clSetKernelExecInfo 18 | //#define clSetKernelExecInfo clSetKernelExecInfo_pfn 19 | #undef clEnqueueSVMFree 20 | //#define clEnqueueSVMFree clEnqueueSVMFree_pfn 21 | #undef clEnqueueSVMMemcpy 22 | #define clEnqueueSVMMemcpy clEnqueueSVMMemcpy_pfn 23 | #undef clEnqueueSVMMemFill 24 | #define clEnqueueSVMMemFill clEnqueueSVMMemFill_pfn 25 | #undef clEnqueueSVMMap 26 | #define clEnqueueSVMMap clEnqueueSVMMap_pfn 27 | #undef clEnqueueSVMUnmap 28 | #define clEnqueueSVMUnmap clEnqueueSVMUnmap_pfn 29 | 30 | extern CL_RUNTIME_EXPORT void* (CL_API_CALL *clSVMAlloc)(cl_context context, cl_svm_mem_flags flags, size_t size, unsigned int alignment); 31 | extern CL_RUNTIME_EXPORT void (CL_API_CALL *clSVMFree)(cl_context context, void* svm_pointer); 32 | extern CL_RUNTIME_EXPORT cl_int (CL_API_CALL *clSetKernelArgSVMPointer)(cl_kernel kernel, cl_uint arg_index, const void* arg_value); 33 | //extern CL_RUNTIME_EXPORT void* (CL_API_CALL *clSetKernelExecInfo)(cl_kernel kernel, cl_kernel_exec_info param_name, size_t param_value_size, const void* param_value); 34 | //extern CL_RUNTIME_EXPORT cl_int (CL_API_CALL *clEnqueueSVMFree)(cl_command_queue command_queue, cl_uint num_svm_pointers, void* svm_pointers[], 35 | // void (CL_CALLBACK *pfn_free_func)(cl_command_queue queue, cl_uint num_svm_pointers, void* svm_pointers[], void* user_data), void* user_data, 36 | // cl_uint num_events_in_wait_list, const cl_event* event_wait_list, cl_event* event); 37 | extern CL_RUNTIME_EXPORT cl_int (CL_API_CALL *clEnqueueSVMMemcpy)(cl_command_queue command_queue, cl_bool blocking_copy, void* dst_ptr, const void* src_ptr, size_t size, 38 | cl_uint num_events_in_wait_list, const cl_event* event_wait_list, cl_event* event); 39 | extern CL_RUNTIME_EXPORT cl_int (CL_API_CALL *clEnqueueSVMMemFill)(cl_command_queue command_queue, void* svm_ptr, const void* pattern, size_t pattern_size, size_t size, 40 | cl_uint num_events_in_wait_list, const cl_event* event_wait_list, cl_event* event); 41 | extern CL_RUNTIME_EXPORT cl_int (CL_API_CALL *clEnqueueSVMMap)(cl_command_queue command_queue, cl_bool blocking_map, cl_map_flags map_flags, void* svm_ptr, size_t size, 42 | cl_uint num_events_in_wait_list, const cl_event* event_wait_list, cl_event* event); 43 | extern CL_RUNTIME_EXPORT cl_int (CL_API_CALL *clEnqueueSVMUnmap)(cl_command_queue command_queue, void* svm_ptr, 44 | cl_uint num_events_in_wait_list, const cl_event* event_wait_list, cl_event* event); 45 | 46 | #endif // HAVE_OPENCL_SVM 47 | 48 | #endif // OPENCV_CORE_OCL_RUNTIME_OPENCL_SVM_2_0_HPP 49 | -------------------------------------------------------------------------------- /third_party/libopencv-4.6-aarch64-none/include/opencv4/opencv2/core/opencl/runtime/opencl_svm_definitions.hpp: -------------------------------------------------------------------------------- 1 | /* See LICENSE file in the root OpenCV directory */ 2 | 3 | #ifndef OPENCV_CORE_OCL_RUNTIME_OPENCL_SVM_DEFINITIONS_HPP 4 | #define OPENCV_CORE_OCL_RUNTIME_OPENCL_SVM_DEFINITIONS_HPP 5 | 6 | #if defined(HAVE_OPENCL_SVM) 7 | #if defined(CL_VERSION_2_0) 8 | 9 | // OpenCL 2.0 contains SVM definitions 10 | 11 | #else 12 | 13 | typedef cl_bitfield cl_device_svm_capabilities; 14 | typedef cl_bitfield cl_svm_mem_flags; 15 | typedef cl_uint cl_kernel_exec_info; 16 | 17 | // 18 | // TODO Add real values after OpenCL 2.0 release 19 | // 20 | 21 | #ifndef CL_DEVICE_SVM_CAPABILITIES 22 | #define CL_DEVICE_SVM_CAPABILITIES 0x1053 23 | 24 | #define CL_DEVICE_SVM_COARSE_GRAIN_BUFFER (1 << 0) 25 | #define CL_DEVICE_SVM_FINE_GRAIN_BUFFER (1 << 1) 26 | #define CL_DEVICE_SVM_FINE_GRAIN_SYSTEM (1 << 2) 27 | #define CL_DEVICE_SVM_ATOMICS (1 << 3) 28 | #endif 29 | 30 | #ifndef CL_MEM_SVM_FINE_GRAIN_BUFFER 31 | #define CL_MEM_SVM_FINE_GRAIN_BUFFER (1 << 10) 32 | #endif 33 | 34 | #ifndef CL_MEM_SVM_ATOMICS 35 | #define CL_MEM_SVM_ATOMICS (1 << 11) 36 | #endif 37 | 38 | 39 | #endif // CL_VERSION_2_0 40 | #endif // HAVE_OPENCL_SVM 41 | 42 | #endif // OPENCV_CORE_OCL_RUNTIME_OPENCL_SVM_DEFINITIONS_HPP 43 | -------------------------------------------------------------------------------- /third_party/libopencv-4.6-aarch64-none/include/opencv4/opencv2/core/ovx.hpp: -------------------------------------------------------------------------------- 1 | // This file is part of OpenCV project. 2 | // It is subject to the license terms in the LICENSE file found in the top-level directory 3 | // of this distribution and at http://opencv.org/license.html. 4 | 5 | // Copyright (C) 2016, Intel Corporation, all rights reserved. 6 | // Third party copyrights are property of their respective owners. 7 | 8 | // OpenVX related definitions and declarations 9 | 10 | #pragma once 11 | #ifndef OPENCV_OVX_HPP 12 | #define OPENCV_OVX_HPP 13 | 14 | #include "cvdef.h" 15 | 16 | namespace cv 17 | { 18 | /// Check if use of OpenVX is possible 19 | CV_EXPORTS_W bool haveOpenVX(); 20 | 21 | /// Check if use of OpenVX is enabled 22 | CV_EXPORTS_W bool useOpenVX(); 23 | 24 | /// Enable/disable use of OpenVX 25 | CV_EXPORTS_W void setUseOpenVX(bool flag); 26 | } // namespace cv 27 | 28 | #endif // OPENCV_OVX_HPP 29 | -------------------------------------------------------------------------------- /third_party/libopencv-4.6-aarch64-none/include/opencv4/opencv2/core/parallel/backend/parallel_for.openmp.hpp: -------------------------------------------------------------------------------- 1 | // This file is part of OpenCV project. 2 | // It is subject to the license terms in the LICENSE file found in the top-level directory 3 | // of this distribution and at http://opencv.org/license.html. 4 | 5 | #ifndef OPENCV_CORE_PARALLEL_FOR_OPENMP_HPP 6 | #define OPENCV_CORE_PARALLEL_FOR_OPENMP_HPP 7 | 8 | #include "opencv2/core/parallel/parallel_backend.hpp" 9 | 10 | #if !defined(_OPENMP) && !defined(OPENCV_SKIP_OPENMP_PRESENSE_CHECK) 11 | #error "This file must be compiled with enabled OpenMP" 12 | #endif 13 | 14 | #include 15 | 16 | namespace cv { namespace parallel { namespace openmp { 17 | 18 | /** OpenMP parallel_for API implementation 19 | * 20 | * @sa setParallelForBackend 21 | * @ingroup core_parallel_backend 22 | */ 23 | class ParallelForBackend : public ParallelForAPI 24 | { 25 | protected: 26 | int numThreads; 27 | int numThreadsMax; 28 | public: 29 | ParallelForBackend() 30 | { 31 | numThreads = 0; 32 | numThreadsMax = omp_get_max_threads(); 33 | } 34 | 35 | virtual ~ParallelForBackend() {} 36 | 37 | virtual void parallel_for(int tasks, FN_parallel_for_body_cb_t body_callback, void* callback_data) CV_OVERRIDE 38 | { 39 | #pragma omp parallel for schedule(dynamic) num_threads(numThreads > 0 ? numThreads : numThreadsMax) 40 | for (int i = 0; i < tasks; ++i) 41 | body_callback(i, i + 1, callback_data); 42 | } 43 | 44 | virtual int getThreadNum() const CV_OVERRIDE 45 | { 46 | return omp_get_thread_num(); 47 | } 48 | 49 | virtual int getNumThreads() const CV_OVERRIDE 50 | { 51 | return numThreads > 0 52 | ? numThreads 53 | : numThreadsMax; 54 | } 55 | 56 | virtual int setNumThreads(int nThreads) CV_OVERRIDE 57 | { 58 | int oldNumThreads = numThreads; 59 | numThreads = nThreads; 60 | // nothing needed as numThreads is used in #pragma omp parallel for directly 61 | return oldNumThreads; 62 | } 63 | 64 | const char* getName() const CV_OVERRIDE 65 | { 66 | return "openmp"; 67 | } 68 | }; 69 | 70 | }}} // namespace 71 | 72 | #endif // OPENCV_CORE_PARALLEL_FOR_OPENMP_HPP 73 | -------------------------------------------------------------------------------- /third_party/libopencv-4.6-aarch64-none/include/opencv4/opencv2/core/parallel/backend/parallel_for.tbb.hpp: -------------------------------------------------------------------------------- 1 | // This file is part of OpenCV project. 2 | // It is subject to the license terms in the LICENSE file found in the top-level directory 3 | // of this distribution and at http://opencv.org/license.html. 4 | 5 | #ifndef OPENCV_CORE_PARALLEL_FOR_TBB_HPP 6 | #define OPENCV_CORE_PARALLEL_FOR_TBB_HPP 7 | 8 | #include "opencv2/core/parallel/parallel_backend.hpp" 9 | #include 10 | 11 | #ifndef TBB_SUPPRESS_DEPRECATED_MESSAGES // supress warning 12 | #define TBB_SUPPRESS_DEPRECATED_MESSAGES 1 13 | #endif 14 | #include "tbb/tbb.h" 15 | #if !defined(TBB_INTERFACE_VERSION) 16 | #error "Unknows/unsupported TBB version" 17 | #endif 18 | 19 | #if TBB_INTERFACE_VERSION >= 8000 20 | #include "tbb/task_arena.h" 21 | #endif 22 | 23 | namespace cv { namespace parallel { namespace tbb { 24 | 25 | using namespace ::tbb; 26 | 27 | #if TBB_INTERFACE_VERSION >= 8000 28 | static tbb::task_arena& getArena() 29 | { 30 | static tbb::task_arena tbbArena(tbb::task_arena::automatic); 31 | return tbbArena; 32 | } 33 | #else 34 | static tbb::task_scheduler_init& getScheduler() 35 | { 36 | static tbb::task_scheduler_init tbbScheduler(tbb::task_scheduler_init::deferred); 37 | return tbbScheduler; 38 | } 39 | #endif 40 | 41 | /** TBB parallel_for API implementation 42 | * 43 | * @sa setParallelForBackend 44 | * @ingroup core_parallel_backend 45 | */ 46 | class ParallelForBackend : public ParallelForAPI 47 | { 48 | protected: 49 | int numThreads; 50 | int numThreadsMax; 51 | public: 52 | ParallelForBackend() 53 | { 54 | CV_LOG_INFO(NULL, "Initializing TBB parallel backend: TBB_INTERFACE_VERSION=" << TBB_INTERFACE_VERSION); 55 | numThreads = 0; 56 | #if TBB_INTERFACE_VERSION >= 8000 57 | (void)getArena(); 58 | #else 59 | (void)getScheduler(); 60 | #endif 61 | } 62 | 63 | virtual ~ParallelForBackend() {} 64 | 65 | class CallbackProxy 66 | { 67 | const FN_parallel_for_body_cb_t& callback; 68 | void* const callback_data; 69 | const int tasks; 70 | public: 71 | inline CallbackProxy(int tasks_, FN_parallel_for_body_cb_t& callback_, void* callback_data_) 72 | : callback(callback_), callback_data(callback_data_), tasks(tasks_) 73 | { 74 | // nothing 75 | } 76 | 77 | void operator()(const tbb::blocked_range& range) const 78 | { 79 | this->callback(range.begin(), range.end(), callback_data); 80 | } 81 | 82 | void operator()() const 83 | { 84 | tbb::parallel_for(tbb::blocked_range(0, tasks), *this); 85 | } 86 | }; 87 | 88 | virtual void parallel_for(int tasks, FN_parallel_for_body_cb_t body_callback, void* callback_data) CV_OVERRIDE 89 | { 90 | CallbackProxy task(tasks, body_callback, callback_data); 91 | #if TBB_INTERFACE_VERSION >= 8000 92 | getArena().execute(task); 93 | #else 94 | task(); 95 | #endif 96 | } 97 | 98 | virtual int getThreadNum() const CV_OVERRIDE 99 | { 100 | #if TBB_INTERFACE_VERSION >= 9100 101 | return tbb::this_task_arena::current_thread_index(); 102 | #elif TBB_INTERFACE_VERSION >= 8000 103 | return tbb::task_arena::current_thread_index(); 104 | #else 105 | return 0; 106 | #endif 107 | } 108 | 109 | virtual int getNumThreads() const CV_OVERRIDE 110 | { 111 | #if TBB_INTERFACE_VERSION >= 9100 112 | return getArena().max_concurrency(); 113 | #elif TBB_INTERFACE_VERSION >= 8000 114 | return numThreads > 0 115 | ? numThreads 116 | : tbb::task_scheduler_init::default_num_threads(); 117 | #else 118 | return getScheduler().is_active() 119 | ? numThreads 120 | : tbb::task_scheduler_init::default_num_threads(); 121 | #endif 122 | } 123 | 124 | virtual int setNumThreads(int nThreads) CV_OVERRIDE 125 | { 126 | int oldNumThreads = numThreads; 127 | numThreads = nThreads; 128 | 129 | #if TBB_INTERFACE_VERSION >= 8000 130 | auto& tbbArena = getArena(); 131 | if (tbbArena.is_active()) 132 | tbbArena.terminate(); 133 | if (numThreads > 0) 134 | tbbArena.initialize(numThreads); 135 | #else 136 | auto& tbbScheduler = getScheduler(); 137 | if (tbbScheduler.is_active()) 138 | tbbScheduler.terminate(); 139 | if (numThreads > 0) 140 | tbbScheduler.initialize(numThreads); 141 | #endif 142 | return oldNumThreads; 143 | } 144 | 145 | const char* getName() const CV_OVERRIDE 146 | { 147 | return "tbb"; 148 | } 149 | }; 150 | 151 | }}} // namespace 152 | 153 | #endif // OPENCV_CORE_PARALLEL_FOR_TBB_HPP 154 | -------------------------------------------------------------------------------- /third_party/libopencv-4.6-aarch64-none/include/opencv4/opencv2/core/parallel/parallel_backend.hpp: -------------------------------------------------------------------------------- 1 | // This file is part of OpenCV project. 2 | // It is subject to the license terms in the LICENSE file found in the top-level directory 3 | // of this distribution and at http://opencv.org/license.html. 4 | 5 | #ifndef OPENCV_CORE_PARALLEL_BACKEND_HPP 6 | #define OPENCV_CORE_PARALLEL_BACKEND_HPP 7 | 8 | #include "opencv2/core/cvdef.h" 9 | #include 10 | 11 | namespace cv { namespace parallel { 12 | #ifndef CV_API_CALL 13 | #define CV_API_CALL 14 | #endif 15 | 16 | /** @addtogroup core_parallel_backend 17 | * @{ 18 | * API below is provided to resolve problem of CPU resource over-subscription by multiple thread pools from different multi-threading frameworks. 19 | * This is common problem for cases when OpenCV compiled threading framework is different from the Users Applications framework. 20 | * 21 | * Applications can replace OpenCV `parallel_for()` backend with own implementation (to reuse Application's thread pool). 22 | * 23 | * 24 | * ### Backend API usage examples 25 | * 26 | * #### Intel TBB 27 | * 28 | * - include header with simple implementation of TBB backend: 29 | * @snippet parallel_backend/example-tbb.cpp tbb_include 30 | * - execute backend replacement code: 31 | * @snippet parallel_backend/example-tbb.cpp tbb_backend 32 | * - configuration of compiler/linker options is responsibility of Application's scripts 33 | * 34 | * #### OpenMP 35 | * 36 | * - include header with simple implementation of OpenMP backend: 37 | * @snippet parallel_backend/example-openmp.cpp openmp_include 38 | * - execute backend replacement code: 39 | * @snippet parallel_backend/example-openmp.cpp openmp_backend 40 | * - Configuration of compiler/linker options is responsibility of Application's scripts 41 | * 42 | * 43 | * ### Plugins support 44 | * 45 | * Runtime configuration options: 46 | * - change backend priority: `OPENCV_PARALLEL_PRIORITY_=9999` 47 | * - disable backend: `OPENCV_PARALLEL_PRIORITY_=0` 48 | * - specify list of backends with high priority (>100000): `OPENCV_PARALLEL_PRIORITY_LIST=TBB,OPENMP`. Unknown backends are registered as new plugins. 49 | * 50 | */ 51 | 52 | /** Interface for parallel_for backends implementations 53 | * 54 | * @sa setParallelForBackend 55 | */ 56 | class CV_EXPORTS ParallelForAPI 57 | { 58 | public: 59 | virtual ~ParallelForAPI(); 60 | 61 | typedef void (CV_API_CALL *FN_parallel_for_body_cb_t)(int start, int end, void* data); 62 | 63 | virtual void parallel_for(int tasks, FN_parallel_for_body_cb_t body_callback, void* callback_data) = 0; 64 | 65 | virtual int getThreadNum() const = 0; 66 | 67 | virtual int getNumThreads() const = 0; 68 | 69 | virtual int setNumThreads(int nThreads) = 0; 70 | 71 | virtual const char* getName() const = 0; 72 | }; 73 | 74 | /** @brief Replace OpenCV parallel_for backend 75 | * 76 | * Application can replace OpenCV `parallel_for()` backend with own implementation. 77 | * 78 | * @note This call is not thread-safe. Consider calling this function from the `main()` before any other OpenCV processing functions (and without any other created threads). 79 | */ 80 | CV_EXPORTS void setParallelForBackend(const std::shared_ptr& api, bool propagateNumThreads = true); 81 | 82 | /** @brief Change OpenCV parallel_for backend 83 | * 84 | * @note This call is not thread-safe. Consider calling this function from the `main()` before any other OpenCV processing functions (and without any other created threads). 85 | */ 86 | CV_EXPORTS_W bool setParallelForBackend(const std::string& backendName, bool propagateNumThreads = true); 87 | 88 | //! @} 89 | }} // namespace 90 | #endif // OPENCV_CORE_PARALLEL_BACKEND_HPP 91 | -------------------------------------------------------------------------------- /third_party/libopencv-4.6-aarch64-none/include/opencv4/opencv2/core/simd_intrinsics.hpp: -------------------------------------------------------------------------------- 1 | // This file is part of OpenCV project. 2 | // It is subject to the license terms in the LICENSE file found in the top-level directory 3 | // of this distribution and at http://opencv.org/license.html. 4 | 5 | #ifndef OPENCV_CORE_SIMD_INTRINSICS_HPP 6 | #define OPENCV_CORE_SIMD_INTRINSICS_HPP 7 | 8 | /** 9 | Helper header to support SIMD intrinsics (universal intrinsics) in user code. 10 | Intrinsics documentation: https://docs.opencv.org/4.x/df/d91/group__core__hal__intrin.html 11 | 12 | 13 | Checks of target CPU instruction set based on compiler definitions don't work well enough. 14 | More reliable solutions require utilization of configuration systems (like CMake). 15 | 16 | So, probably you need to specify your own configuration. 17 | 18 | You can do that via CMake in this way: 19 | add_definitions(/DOPENCV_SIMD_CONFIG_HEADER=opencv_simd_config_custom.hpp) 20 | or 21 | add_definitions(/DOPENCV_SIMD_CONFIG_INCLUDE_DIR=1) 22 | 23 | Additionally you may need to add include directory to your files: 24 | include_directories("${CMAKE_CURRENT_LIST_DIR}/opencv_config_${MYTARGET}") 25 | 26 | These files can be pre-generated for target configurations of your application 27 | or generated by CMake on the fly (use CMAKE_BINARY_DIR for that). 28 | 29 | Notes: 30 | - H/W capability checks are still responsibility of your application 31 | - runtime dispatching is not covered by this helper header 32 | */ 33 | 34 | #ifdef __OPENCV_BUILD 35 | #error "Use core/hal/intrin.hpp during OpenCV build" 36 | #endif 37 | 38 | #ifdef OPENCV_HAL_INTRIN_HPP 39 | #error "core/simd_intrinsics.hpp must be included before core/hal/intrin.hpp" 40 | #endif 41 | 42 | #include "opencv2/core/cvdef.h" 43 | 44 | #ifdef OPENCV_SIMD_CONFIG_HEADER 45 | #include CVAUX_STR(OPENCV_SIMD_CONFIG_HEADER) 46 | #elif defined(OPENCV_SIMD_CONFIG_INCLUDE_DIR) 47 | #include "opencv_simd_config.hpp" // corresponding directory should be added via -I compiler parameter 48 | #else // custom config headers 49 | 50 | #if (!defined(CV_AVX_512F) || !CV_AVX_512F) && (defined(__AVX512__) || defined(__AVX512F__)) 51 | # include 52 | # undef CV_AVX_512F 53 | # define CV_AVX_512F 1 54 | # ifndef OPENCV_SIMD_DONT_ASSUME_SKX // Skylake-X with AVX-512F/CD/BW/DQ/VL 55 | # undef CV_AVX512_SKX 56 | # define CV_AVX512_SKX 1 57 | # undef CV_AVX_512CD 58 | # define CV_AVX_512CD 1 59 | # undef CV_AVX_512BW 60 | # define CV_AVX_512BW 1 61 | # undef CV_AVX_512DQ 62 | # define CV_AVX_512DQ 1 63 | # undef CV_AVX_512VL 64 | # define CV_AVX_512VL 1 65 | # endif 66 | #endif // AVX512 67 | 68 | // GCC/Clang: -mavx2 69 | // MSVC: /arch:AVX2 70 | #if defined __AVX2__ 71 | # include 72 | # undef CV_AVX2 73 | # define CV_AVX2 1 74 | # if defined __F16C__ 75 | # undef CV_FP16 76 | # define CV_FP16 1 77 | # endif 78 | #endif 79 | 80 | #endif 81 | 82 | // SSE / NEON / VSX is handled by cv_cpu_dispatch.h compatibility block 83 | #include "cv_cpu_dispatch.h" 84 | 85 | #include "hal/intrin.hpp" 86 | 87 | #endif // OPENCV_CORE_SIMD_INTRINSICS_HPP 88 | -------------------------------------------------------------------------------- /third_party/libopencv-4.6-aarch64-none/include/opencv4/opencv2/core/utils/allocator_stats.hpp: -------------------------------------------------------------------------------- 1 | // This file is part of OpenCV project. 2 | // It is subject to the license terms in the LICENSE file found in the top-level directory 3 | // of this distribution and at http://opencv.org/license.html. 4 | 5 | #ifndef OPENCV_CORE_ALLOCATOR_STATS_HPP 6 | #define OPENCV_CORE_ALLOCATOR_STATS_HPP 7 | 8 | #include "../cvdef.h" 9 | 10 | namespace cv { namespace utils { 11 | 12 | class AllocatorStatisticsInterface 13 | { 14 | protected: 15 | AllocatorStatisticsInterface() {} 16 | virtual ~AllocatorStatisticsInterface() {} 17 | public: 18 | virtual uint64_t getCurrentUsage() const = 0; 19 | virtual uint64_t getTotalUsage() const = 0; 20 | virtual uint64_t getNumberOfAllocations() const = 0; 21 | virtual uint64_t getPeakUsage() const = 0; 22 | 23 | /** set peak usage = current usage */ 24 | virtual void resetPeakUsage() = 0; 25 | }; 26 | 27 | }} // namespace 28 | 29 | #endif // OPENCV_CORE_ALLOCATOR_STATS_HPP 30 | -------------------------------------------------------------------------------- /third_party/libopencv-4.6-aarch64-none/include/opencv4/opencv2/core/utils/filesystem.hpp: -------------------------------------------------------------------------------- 1 | // This file is part of OpenCV project. 2 | // It is subject to the license terms in the LICENSE file found in the top-level directory 3 | // of this distribution and at http://opencv.org/license.html. 4 | 5 | #ifndef OPENCV_UTILS_FILESYSTEM_HPP 6 | #define OPENCV_UTILS_FILESYSTEM_HPP 7 | 8 | namespace cv { namespace utils { namespace fs { 9 | 10 | 11 | CV_EXPORTS bool exists(const cv::String& path); 12 | CV_EXPORTS bool isDirectory(const cv::String& path); 13 | 14 | CV_EXPORTS void remove_all(const cv::String& path); 15 | 16 | 17 | CV_EXPORTS cv::String getcwd(); 18 | 19 | /** @brief Converts path p to a canonical absolute path 20 | * Symlinks are processed if there is support for them on running platform. 21 | * 22 | * @param path input path. Target file/directory should exist. 23 | */ 24 | CV_EXPORTS cv::String canonical(const cv::String& path); 25 | 26 | /** Join path components */ 27 | CV_EXPORTS cv::String join(const cv::String& base, const cv::String& path); 28 | 29 | /** Get parent directory */ 30 | CV_EXPORTS cv::String getParent(const cv::String &path); 31 | CV_EXPORTS std::wstring getParent(const std::wstring& path); 32 | 33 | /** 34 | * Generate a list of all files that match the globbing pattern. 35 | * 36 | * Result entries are prefixed by base directory path. 37 | * 38 | * @param directory base directory 39 | * @param pattern filter pattern (based on '*'/'?' symbols). Use empty string to disable filtering and return all results 40 | * @param[out] result result of globing. 41 | * @param recursive scan nested directories too 42 | * @param includeDirectories include directories into results list 43 | */ 44 | CV_EXPORTS void glob(const cv::String& directory, const cv::String& pattern, 45 | CV_OUT std::vector& result, 46 | bool recursive = false, bool includeDirectories = false); 47 | 48 | /** 49 | * Generate a list of all files that match the globbing pattern. 50 | * 51 | * @param directory base directory 52 | * @param pattern filter pattern (based on '*'/'?' symbols). Use empty string to disable filtering and return all results 53 | * @param[out] result globbing result with relative paths from base directory 54 | * @param recursive scan nested directories too 55 | * @param includeDirectories include directories into results list 56 | */ 57 | CV_EXPORTS void glob_relative(const cv::String& directory, const cv::String& pattern, 58 | CV_OUT std::vector& result, 59 | bool recursive = false, bool includeDirectories = false); 60 | 61 | 62 | CV_EXPORTS bool createDirectory(const cv::String& path); 63 | CV_EXPORTS bool createDirectories(const cv::String& path); 64 | 65 | #ifdef __OPENCV_BUILD 66 | // TODO 67 | //CV_EXPORTS cv::String getTempDirectory(); 68 | 69 | /** 70 | * @brief Returns directory to store OpenCV cache files 71 | * Create sub-directory in common OpenCV cache directory if it doesn't exist. 72 | * @param sub_directory_name name of sub-directory. NULL or "" value asks to return root cache directory. 73 | * @param configuration_name optional name of configuration parameter name which overrides default behavior. 74 | * @return Path to cache directory. Returns empty string if cache directories support is not available. Returns "disabled" if cache disabled by user. 75 | */ 76 | CV_EXPORTS cv::String getCacheDirectory(const char* sub_directory_name, const char* configuration_name = NULL); 77 | 78 | #endif 79 | 80 | }}} // namespace 81 | 82 | #endif // OPENCV_UTILS_FILESYSTEM_HPP 83 | -------------------------------------------------------------------------------- /third_party/libopencv-4.6-aarch64-none/include/opencv4/opencv2/core/utils/fp_control_utils.hpp: -------------------------------------------------------------------------------- 1 | // This file is part of OpenCV project. 2 | // It is subject to the license terms in the LICENSE file found in the top-level directory 3 | // of this distribution and at http://opencv.org/license.html. 4 | 5 | #ifndef OPENCV_CORE_FP_CONTROL_UTILS_HPP 6 | #define OPENCV_CORE_FP_CONTROL_UTILS_HPP 7 | 8 | namespace cv { 9 | 10 | namespace details { 11 | 12 | struct FPDenormalsModeState 13 | { 14 | uint32_t reserved[16]; // 64-bytes 15 | }; // FPDenormalsModeState 16 | 17 | CV_EXPORTS void setFPDenormalsIgnoreHint(bool ignore, CV_OUT FPDenormalsModeState& state); 18 | CV_EXPORTS int saveFPDenormalsState(CV_OUT FPDenormalsModeState& state); 19 | CV_EXPORTS bool restoreFPDenormalsState(const FPDenormalsModeState& state); 20 | 21 | class FPDenormalsIgnoreHintScope 22 | { 23 | public: 24 | inline explicit FPDenormalsIgnoreHintScope(bool ignore = true) 25 | { 26 | details::setFPDenormalsIgnoreHint(ignore, saved_state); 27 | } 28 | 29 | inline explicit FPDenormalsIgnoreHintScope(const FPDenormalsModeState& state) 30 | { 31 | details::saveFPDenormalsState(saved_state); 32 | details::restoreFPDenormalsState(state); 33 | } 34 | 35 | inline ~FPDenormalsIgnoreHintScope() 36 | { 37 | details::restoreFPDenormalsState(saved_state); 38 | } 39 | 40 | protected: 41 | FPDenormalsModeState saved_state; 42 | }; // FPDenormalsIgnoreHintScope 43 | 44 | class FPDenormalsIgnoreHintScopeNOOP 45 | { 46 | public: 47 | inline FPDenormalsIgnoreHintScopeNOOP(bool ignore = true) { CV_UNUSED(ignore); } 48 | inline FPDenormalsIgnoreHintScopeNOOP(const FPDenormalsModeState& state) { CV_UNUSED(state); } 49 | inline ~FPDenormalsIgnoreHintScopeNOOP() { } 50 | }; // FPDenormalsIgnoreHintScopeNOOP 51 | 52 | } // namespace details 53 | 54 | 55 | // Should depend on target compilation architecture only 56 | // Note: previously added archs should NOT be removed to preserve ABI compatibility 57 | #if defined(OPENCV_SUPPORTS_FP_DENORMALS_HINT) 58 | // preserve configuration overloading through ports 59 | #elif defined(__i386__) || defined(__x86_64__) || defined(_M_X64) || defined(_X86_) 60 | typedef details::FPDenormalsIgnoreHintScope FPDenormalsIgnoreHintScope; 61 | #define OPENCV_SUPPORTS_FP_DENORMALS_HINT 1 62 | #else 63 | #define OPENCV_SUPPORTS_FP_DENORMALS_HINT 0 64 | typedef details::FPDenormalsIgnoreHintScopeNOOP FPDenormalsIgnoreHintScope; 65 | #endif 66 | 67 | } // namespace cv 68 | 69 | #endif // OPENCV_CORE_FP_CONTROL_UTILS_HPP 70 | -------------------------------------------------------------------------------- /third_party/libopencv-4.6-aarch64-none/include/opencv4/opencv2/core/utils/instrumentation.hpp: -------------------------------------------------------------------------------- 1 | // This file is part of OpenCV project. 2 | // It is subject to the license terms in the LICENSE file found in the top-level directory 3 | // of this distribution and at http://opencv.org/license.html. 4 | 5 | #ifndef OPENCV_UTILS_INSTR_HPP 6 | #define OPENCV_UTILS_INSTR_HPP 7 | 8 | #include 9 | #include 10 | 11 | namespace cv { 12 | 13 | //! @addtogroup core_utils 14 | //! @{ 15 | 16 | #ifdef CV_COLLECT_IMPL_DATA 17 | CV_EXPORTS void setImpl(int flags); // set implementation flags and reset storage arrays 18 | CV_EXPORTS void addImpl(int flag, const char* func = 0); // add implementation and function name to storage arrays 19 | // Get stored implementation flags and functions names arrays 20 | // Each implementation entry correspond to function name entry, so you can find which implementation was executed in which function 21 | CV_EXPORTS int getImpl(std::vector &impl, std::vector &funName); 22 | 23 | CV_EXPORTS bool useCollection(); // return implementation collection state 24 | CV_EXPORTS void setUseCollection(bool flag); // set implementation collection state 25 | 26 | #define CV_IMPL_PLAIN 0x01 // native CPU OpenCV implementation 27 | #define CV_IMPL_OCL 0x02 // OpenCL implementation 28 | #define CV_IMPL_IPP 0x04 // IPP implementation 29 | #define CV_IMPL_MT 0x10 // multithreaded implementation 30 | 31 | #undef CV_IMPL_ADD 32 | #define CV_IMPL_ADD(impl) \ 33 | if(cv::useCollection()) \ 34 | { \ 35 | cv::addImpl(impl, CV_Func); \ 36 | } 37 | #endif 38 | 39 | // Instrumentation external interface 40 | namespace instr 41 | { 42 | 43 | #if !defined OPENCV_ABI_CHECK 44 | 45 | enum TYPE 46 | { 47 | TYPE_GENERAL = 0, // OpenCV API function, e.g. exported function 48 | TYPE_MARKER, // Information marker 49 | TYPE_WRAPPER, // Wrapper function for implementation 50 | TYPE_FUN, // Simple function call 51 | }; 52 | 53 | enum IMPL 54 | { 55 | IMPL_PLAIN = 0, 56 | IMPL_IPP, 57 | IMPL_OPENCL, 58 | }; 59 | 60 | struct NodeDataTls 61 | { 62 | NodeDataTls() 63 | { 64 | m_ticksTotal = 0; 65 | } 66 | uint64 m_ticksTotal; 67 | }; 68 | 69 | class CV_EXPORTS NodeData 70 | { 71 | public: 72 | NodeData(const char* funName = 0, const char* fileName = NULL, int lineNum = 0, void* retAddress = NULL, bool alwaysExpand = false, cv::instr::TYPE instrType = TYPE_GENERAL, cv::instr::IMPL implType = IMPL_PLAIN); 73 | NodeData(NodeData &ref); 74 | ~NodeData(); 75 | NodeData& operator=(const NodeData&); 76 | 77 | cv::String m_funName; 78 | cv::instr::TYPE m_instrType; 79 | cv::instr::IMPL m_implType; 80 | const char* m_fileName; 81 | int m_lineNum; 82 | void* m_retAddress; 83 | bool m_alwaysExpand; 84 | bool m_funError; 85 | 86 | volatile int m_counter; 87 | volatile uint64 m_ticksTotal; 88 | TLSDataAccumulator m_tls; 89 | int m_threads; 90 | 91 | // No synchronization 92 | double getTotalMs() const { return ((double)m_ticksTotal / cv::getTickFrequency()) * 1000; } 93 | double getMeanMs() const { return (((double)m_ticksTotal/m_counter) / cv::getTickFrequency()) * 1000; } 94 | }; 95 | bool operator==(const NodeData& lhs, const NodeData& rhs); 96 | 97 | typedef Node InstrNode; 98 | 99 | CV_EXPORTS InstrNode* getTrace(); 100 | 101 | #endif // !defined OPENCV_ABI_CHECK 102 | 103 | 104 | CV_EXPORTS bool useInstrumentation(); 105 | CV_EXPORTS void setUseInstrumentation(bool flag); 106 | CV_EXPORTS void resetTrace(); 107 | 108 | enum FLAGS 109 | { 110 | FLAGS_NONE = 0, 111 | FLAGS_MAPPING = 0x01, 112 | FLAGS_EXPAND_SAME_NAMES = 0x02, 113 | }; 114 | 115 | CV_EXPORTS void setFlags(FLAGS modeFlags); 116 | static inline void setFlags(int modeFlags) { setFlags((FLAGS)modeFlags); } 117 | CV_EXPORTS FLAGS getFlags(); 118 | 119 | } // namespace instr 120 | 121 | //! @} 122 | 123 | } // namespace 124 | 125 | #endif // OPENCV_UTILS_TLS_HPP 126 | -------------------------------------------------------------------------------- /third_party/libopencv-4.6-aarch64-none/include/opencv4/opencv2/core/utils/logger.defines.hpp: -------------------------------------------------------------------------------- 1 | // This file is part of OpenCV project. 2 | // It is subject to the license terms in the LICENSE file found in the top-level directory 3 | // of this distribution and at http://opencv.org/license.html. 4 | 5 | #ifndef OPENCV_LOGGER_DEFINES_HPP 6 | #define OPENCV_LOGGER_DEFINES_HPP 7 | 8 | //! @addtogroup core_logging 9 | //! @{ 10 | 11 | // Supported logging levels and their semantic 12 | #define CV_LOG_LEVEL_SILENT 0 //!< for using in setLogLevel() call 13 | #define CV_LOG_LEVEL_FATAL 1 //!< Fatal (critical) error (unrecoverable internal error) 14 | #define CV_LOG_LEVEL_ERROR 2 //!< Error message 15 | #define CV_LOG_LEVEL_WARN 3 //!< Warning message 16 | #define CV_LOG_LEVEL_INFO 4 //!< Info message 17 | #define CV_LOG_LEVEL_DEBUG 5 //!< Debug message. Disabled in the "Release" build. 18 | #define CV_LOG_LEVEL_VERBOSE 6 //!< Verbose (trace) messages. Requires verbosity level. Disabled in the "Release" build. 19 | 20 | namespace cv { 21 | namespace utils { 22 | namespace logging { 23 | 24 | //! Supported logging levels and their semantic 25 | enum LogLevel { 26 | LOG_LEVEL_SILENT = 0, //!< for using in setLogVevel() call 27 | LOG_LEVEL_FATAL = 1, //!< Fatal (critical) error (unrecoverable internal error) 28 | LOG_LEVEL_ERROR = 2, //!< Error message 29 | LOG_LEVEL_WARNING = 3, //!< Warning message 30 | LOG_LEVEL_INFO = 4, //!< Info message 31 | LOG_LEVEL_DEBUG = 5, //!< Debug message. Disabled in the "Release" build. 32 | LOG_LEVEL_VERBOSE = 6, //!< Verbose (trace) messages. Requires verbosity level. Disabled in the "Release" build. 33 | #ifndef CV_DOXYGEN 34 | ENUM_LOG_LEVEL_FORCE_INT = INT_MAX 35 | #endif 36 | }; 37 | 38 | }}} // namespace 39 | 40 | //! @} 41 | 42 | #endif // OPENCV_LOGGER_DEFINES_HPP 43 | -------------------------------------------------------------------------------- /third_party/libopencv-4.6-aarch64-none/include/opencv4/opencv2/core/utils/logtag.hpp: -------------------------------------------------------------------------------- 1 | // This file is part of OpenCV project. 2 | // It is subject to the license terms in the LICENSE file found in the top-level directory 3 | // of this distribution and at http://opencv.org/license.html. 4 | 5 | #ifndef OPENCV_CORE_LOGTAG_HPP 6 | #define OPENCV_CORE_LOGTAG_HPP 7 | 8 | #include "opencv2/core/cvstd.hpp" 9 | #include "logger.defines.hpp" 10 | 11 | namespace cv { 12 | namespace utils { 13 | namespace logging { 14 | 15 | struct LogTag 16 | { 17 | const char* name; 18 | LogLevel level; 19 | 20 | inline LogTag(const char* _name, LogLevel _level) 21 | : name(_name) 22 | , level(_level) 23 | {} 24 | }; 25 | 26 | }}} 27 | 28 | #endif 29 | -------------------------------------------------------------------------------- /third_party/libopencv-4.6-aarch64-none/include/opencv4/opencv2/core/va_intel.hpp: -------------------------------------------------------------------------------- 1 | // This file is part of OpenCV project. 2 | // It is subject to the license terms in the LICENSE file found in the top-level directory 3 | // of this distribution and at http://opencv.org/license.html. 4 | 5 | // Copyright (C) 2015, Itseez, Inc., all rights reserved. 6 | // Third party copyrights are property of their respective owners. 7 | 8 | #ifndef OPENCV_CORE_VA_INTEL_HPP 9 | #define OPENCV_CORE_VA_INTEL_HPP 10 | 11 | #ifndef __cplusplus 12 | # error va_intel.hpp header must be compiled as C++ 13 | #endif 14 | 15 | #include "opencv2/core.hpp" 16 | #include "ocl.hpp" 17 | 18 | #if defined(HAVE_VA) 19 | # include "va/va.h" 20 | #else // HAVE_VA 21 | # if !defined(_VA_H_) 22 | typedef void* VADisplay; 23 | typedef unsigned int VASurfaceID; 24 | # endif // !_VA_H_ 25 | #endif // HAVE_VA 26 | 27 | namespace cv { namespace va_intel { 28 | 29 | /** @addtogroup core_va_intel 30 | This section describes Intel VA-API/OpenCL (CL-VA) interoperability. 31 | 32 | To enable basic VA interoperability build OpenCV with libva library integration enabled: `-DWITH_VA=ON` (corresponding dev package should be installed). 33 | 34 | To enable advanced CL-VA interoperability support on Intel HW, enable option: `-DWITH_VA_INTEL=ON` (OpenCL integration should be enabled which is the default setting). Special runtime environment should be set up in order to use this feature: correct combination of [libva](https://github.com/intel/libva), [OpenCL runtime](https://github.com/intel/compute-runtime) and [media driver](https://github.com/intel/media-driver) should be installed. 35 | 36 | Check usage example for details: samples/va_intel/va_intel_interop.cpp 37 | */ 38 | //! @{ 39 | 40 | /////////////////// CL-VA Interoperability Functions /////////////////// 41 | 42 | namespace ocl { 43 | using namespace cv::ocl; 44 | 45 | // TODO static functions in the Context class 46 | /** @brief Creates OpenCL context from VA. 47 | @param display - VADisplay for which CL interop should be established. 48 | @param tryInterop - try to set up for interoperability, if true; set up for use slow copy if false. 49 | @return Returns reference to OpenCL Context 50 | */ 51 | CV_EXPORTS Context& initializeContextFromVA(VADisplay display, bool tryInterop = true); 52 | 53 | } // namespace cv::va_intel::ocl 54 | 55 | /** @brief Converts InputArray to VASurfaceID object. 56 | @param display - VADisplay object. 57 | @param src - source InputArray. 58 | @param surface - destination VASurfaceID object. 59 | @param size - size of image represented by VASurfaceID object. 60 | */ 61 | CV_EXPORTS void convertToVASurface(VADisplay display, InputArray src, VASurfaceID surface, Size size); 62 | 63 | /** @brief Converts VASurfaceID object to OutputArray. 64 | @param display - VADisplay object. 65 | @param surface - source VASurfaceID object. 66 | @param size - size of image represented by VASurfaceID object. 67 | @param dst - destination OutputArray. 68 | */ 69 | CV_EXPORTS void convertFromVASurface(VADisplay display, VASurfaceID surface, Size size, OutputArray dst); 70 | 71 | //! @} 72 | 73 | }} // namespace cv::va_intel 74 | 75 | #endif /* OPENCV_CORE_VA_INTEL_HPP */ 76 | -------------------------------------------------------------------------------- /third_party/libopencv-4.6-aarch64-none/include/opencv4/opencv2/core/version.hpp: -------------------------------------------------------------------------------- 1 | // This file is part of OpenCV project. 2 | // It is subject to the license terms in the LICENSE file found in the top-level directory 3 | // of this distribution and at http://opencv.org/license.html. 4 | 5 | #ifndef OPENCV_VERSION_HPP 6 | #define OPENCV_VERSION_HPP 7 | 8 | #define CV_VERSION_MAJOR 4 9 | #define CV_VERSION_MINOR 6 10 | #define CV_VERSION_REVISION 0 11 | #define CV_VERSION_STATUS "" 12 | 13 | #define CVAUX_STR_EXP(__A) #__A 14 | #define CVAUX_STR(__A) CVAUX_STR_EXP(__A) 15 | 16 | #define CVAUX_STRW_EXP(__A) L ## #__A 17 | #define CVAUX_STRW(__A) CVAUX_STRW_EXP(__A) 18 | 19 | #define CV_VERSION CVAUX_STR(CV_VERSION_MAJOR) "." CVAUX_STR(CV_VERSION_MINOR) "." CVAUX_STR(CV_VERSION_REVISION) CV_VERSION_STATUS 20 | 21 | /* old style version constants*/ 22 | #define CV_MAJOR_VERSION CV_VERSION_MAJOR 23 | #define CV_MINOR_VERSION CV_VERSION_MINOR 24 | #define CV_SUBMINOR_VERSION CV_VERSION_REVISION 25 | 26 | #endif // OPENCV_VERSION_HPP 27 | -------------------------------------------------------------------------------- /third_party/libopencv-4.6-aarch64-none/include/opencv4/opencv2/cvconfig.h: -------------------------------------------------------------------------------- 1 | #ifndef OPENCV_CVCONFIG_H_INCLUDED 2 | #define OPENCV_CVCONFIG_H_INCLUDED 3 | 4 | /* OpenCV compiled as static or dynamic libs */ 5 | /* #undef BUILD_SHARED_LIBS */ 6 | 7 | /* OpenCV intrinsics optimized code */ 8 | #define CV_ENABLE_INTRINSICS 9 | 10 | /* OpenCV additional optimized code */ 11 | /* #undef CV_DISABLE_OPTIMIZATION */ 12 | 13 | /* Compile for 'real' NVIDIA GPU architectures */ 14 | #define CUDA_ARCH_BIN "" 15 | 16 | /* NVIDIA GPU features are used */ 17 | #define CUDA_ARCH_FEATURES "" 18 | 19 | /* Compile for 'virtual' NVIDIA PTX architectures */ 20 | #define CUDA_ARCH_PTX "" 21 | 22 | /* AMD's Basic Linear Algebra Subprograms Library*/ 23 | /* #undef HAVE_CLAMDBLAS */ 24 | 25 | /* AMD's OpenCL Fast Fourier Transform Library*/ 26 | /* #undef HAVE_CLAMDFFT */ 27 | 28 | /* Clp support */ 29 | /* #undef HAVE_CLP */ 30 | 31 | /* NVIDIA CUDA Runtime API*/ 32 | /* #undef HAVE_CUDA */ 33 | 34 | /* NVIDIA CUDA Basic Linear Algebra Subprograms (BLAS) API*/ 35 | /* #undef HAVE_CUBLAS */ 36 | 37 | /* NVIDIA CUDA Deep Neural Network (cuDNN) API*/ 38 | /* #undef HAVE_CUDNN */ 39 | 40 | /* NVIDIA CUDA Fast Fourier Transform (FFT) API*/ 41 | /* #undef HAVE_CUFFT */ 42 | 43 | /* DirectX */ 44 | /* #undef HAVE_DIRECTX */ 45 | /* #undef HAVE_DIRECTX_NV12 */ 46 | /* #undef HAVE_D3D11 */ 47 | /* #undef HAVE_D3D10 */ 48 | /* #undef HAVE_D3D9 */ 49 | 50 | /* Eigen Matrix & Linear Algebra Library */ 51 | /* #undef HAVE_EIGEN */ 52 | 53 | /* Geospatial Data Abstraction Library */ 54 | /* #undef HAVE_GDAL */ 55 | 56 | /* Halide support */ 57 | /* #undef HAVE_HALIDE */ 58 | 59 | /* Vulkan support */ 60 | /* #undef HAVE_VULKAN */ 61 | 62 | /* Define to 1 if you have the header file. */ 63 | /* #undef HAVE_INTTYPES_H */ 64 | 65 | /* Intel Integrated Performance Primitives */ 66 | /* #undef HAVE_IPP */ 67 | /* #undef HAVE_IPP_ICV */ 68 | /* #undef HAVE_IPP_IW */ 69 | /* #undef HAVE_IPP_IW_LL */ 70 | 71 | /* JPEG-2000 codec */ 72 | /* #undef HAVE_OPENJPEG */ 73 | /* #undef HAVE_JASPER */ 74 | 75 | /* IJG JPEG codec */ 76 | /* #undef HAVE_JPEG */ 77 | 78 | /* libpng/png.h needs to be included */ 79 | /* #undef HAVE_LIBPNG_PNG_H */ 80 | 81 | /* GDCM DICOM codec */ 82 | /* #undef HAVE_GDCM */ 83 | 84 | /* NVIDIA Video Decoding API*/ 85 | /* #undef HAVE_NVCUVID */ 86 | /* #undef HAVE_NVCUVID_HEADER */ 87 | /* #undef HAVE_DYNLINK_NVCUVID_HEADER */ 88 | 89 | /* NVIDIA Video Encoding API*/ 90 | /* #undef HAVE_NVCUVENC */ 91 | 92 | /* OpenCL Support */ 93 | /* #undef HAVE_OPENCL */ 94 | /* #undef HAVE_OPENCL_STATIC */ 95 | /* #undef HAVE_OPENCL_SVM */ 96 | 97 | /* NVIDIA OpenCL D3D Extensions support */ 98 | /* #undef HAVE_OPENCL_D3D11_NV */ 99 | 100 | /* OpenEXR codec */ 101 | /* #undef HAVE_OPENEXR */ 102 | 103 | /* OpenGL support*/ 104 | /* #undef HAVE_OPENGL */ 105 | 106 | /* PNG codec */ 107 | /* #undef HAVE_PNG */ 108 | 109 | /* Posix threads (pthreads) */ 110 | #define HAVE_PTHREAD 111 | 112 | /* parallel_for with pthreads */ 113 | /* #undef HAVE_PTHREADS_PF */ 114 | 115 | /* Intel Threading Building Blocks */ 116 | /* #undef HAVE_TBB */ 117 | 118 | /* Ste||ar Group High Performance ParallelX */ 119 | /* #undef HAVE_HPX */ 120 | 121 | /* TIFF codec */ 122 | /* #undef HAVE_TIFF */ 123 | 124 | /* Define if your processor stores words with the most significant byte 125 | first (like Motorola and SPARC, unlike Intel and VAX). */ 126 | /* #undef WORDS_BIGENDIAN */ 127 | 128 | /* VA library (libva) */ 129 | /* #undef HAVE_VA */ 130 | 131 | /* Intel VA-API/OpenCL */ 132 | /* #undef HAVE_VA_INTEL */ 133 | 134 | /* Lapack */ 135 | /* #undef HAVE_LAPACK */ 136 | 137 | /* Library was compiled with functions instrumentation */ 138 | /* #undef ENABLE_INSTRUMENTATION */ 139 | 140 | /* OpenVX */ 141 | /* #undef HAVE_OPENVX */ 142 | 143 | /* OpenCV trace utilities */ 144 | /* #undef OPENCV_TRACE */ 145 | 146 | /* Library QR-code decoding */ 147 | /* #undef HAVE_QUIRC */ 148 | 149 | #endif // OPENCV_CVCONFIG_H_INCLUDED 150 | -------------------------------------------------------------------------------- /third_party/libopencv-4.6-aarch64-none/include/opencv4/opencv2/features2d/features2d.hpp: -------------------------------------------------------------------------------- 1 | /*M/////////////////////////////////////////////////////////////////////////////////////// 2 | // 3 | // IMPORTANT: READ BEFORE DOWNLOADING, COPYING, INSTALLING OR USING. 4 | // 5 | // By downloading, copying, installing or using the software you agree to this license. 6 | // If you do not agree to this license, do not download, install, 7 | // copy or use the software. 8 | // 9 | // 10 | // License Agreement 11 | // For Open Source Computer Vision Library 12 | // 13 | // Copyright (C) 2000-2008, Intel Corporation, all rights reserved. 14 | // Copyright (C) 2009, Willow Garage Inc., all rights reserved. 15 | // Copyright (C) 2013, OpenCV Foundation, all rights reserved. 16 | // Third party copyrights are property of their respective owners. 17 | // 18 | // Redistribution and use in source and binary forms, with or without modification, 19 | // are permitted provided that the following conditions are met: 20 | // 21 | // * Redistribution's of source code must retain the above copyright notice, 22 | // this list of conditions and the following disclaimer. 23 | // 24 | // * Redistribution's in binary form must reproduce the above copyright notice, 25 | // this list of conditions and the following disclaimer in the documentation 26 | // and/or other materials provided with the distribution. 27 | // 28 | // * The name of the copyright holders may not be used to endorse or promote products 29 | // derived from this software without specific prior written permission. 30 | // 31 | // This software is provided by the copyright holders and contributors "as is" and 32 | // any express or implied warranties, including, but not limited to, the implied 33 | // warranties of merchantability and fitness for a particular purpose are disclaimed. 34 | // In no event shall the Intel Corporation or contributors be liable for any direct, 35 | // indirect, incidental, special, exemplary, or consequential damages 36 | // (including, but not limited to, procurement of substitute goods or services; 37 | // loss of use, data, or profits; or business interruption) however caused 38 | // and on any theory of liability, whether in contract, strict liability, 39 | // or tort (including negligence or otherwise) arising in any way out of 40 | // the use of this software, even if advised of the possibility of such damage. 41 | // 42 | //M*/ 43 | 44 | #ifdef __OPENCV_BUILD 45 | #error this is a compatibility header which should not be used inside the OpenCV library 46 | #endif 47 | 48 | #include "opencv2/features2d.hpp" 49 | -------------------------------------------------------------------------------- /third_party/libopencv-4.6-aarch64-none/include/opencv4/opencv2/features2d/hal/interface.h: -------------------------------------------------------------------------------- 1 | #ifndef OPENCV_FEATURE2D_HAL_INTERFACE_H 2 | #define OPENCV_FEATURE2D_HAL_INTERFACE_H 3 | 4 | #include "opencv2/core/cvdef.h" 5 | //! @addtogroup features2d_hal_interface 6 | //! @{ 7 | 8 | //! @name Fast feature detector types 9 | //! @sa cv::FastFeatureDetector 10 | //! @{ 11 | #define CV_HAL_TYPE_5_8 0 12 | #define CV_HAL_TYPE_7_12 1 13 | #define CV_HAL_TYPE_9_16 2 14 | //! @} 15 | 16 | //! @name Key point 17 | //! @sa cv::KeyPoint 18 | //! @{ 19 | struct CV_EXPORTS cvhalKeyPoint 20 | { 21 | float x; 22 | float y; 23 | float size; 24 | float angle; 25 | float response; 26 | int octave; 27 | int class_id; 28 | }; 29 | //! @} 30 | 31 | //! @} 32 | 33 | #endif 34 | -------------------------------------------------------------------------------- /third_party/libopencv-4.6-aarch64-none/include/opencv4/opencv2/highgui.hpp: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (C) 2021 nihui 3 | // 4 | // Licensed under the Apache License, Version 2.0 (the "License"); 5 | // you may not use this file except in compliance with the License. 6 | // You may obtain a copy of the License at 7 | // 8 | // http://www.apache.org/licenses/LICENSE-2.0 9 | // 10 | // Unless required by applicable law or agreed to in writing, software 11 | // distributed under the License is distributed on an "AS IS" BASIS, 12 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | // See the License for the specific language governing permissions and 14 | // limitations under the License. 15 | // 16 | 17 | #include "opencv2/highgui/highgui.hpp" 18 | -------------------------------------------------------------------------------- /third_party/libopencv-4.6-aarch64-none/include/opencv4/opencv2/highgui/highgui.hpp: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (C) 2021 nihui 3 | // 4 | // Licensed under the Apache License, Version 2.0 (the "License"); 5 | // you may not use this file except in compliance with the License. 6 | // You may obtain a copy of the License at 7 | // 8 | // http://www.apache.org/licenses/LICENSE-2.0 9 | // 10 | // Unless required by applicable law or agreed to in writing, software 11 | // distributed under the License is distributed on an "AS IS" BASIS, 12 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | // See the License for the specific language governing permissions and 14 | // limitations under the License. 15 | // 16 | 17 | #ifndef OPENCV_HIGHGUI_HPP 18 | #define OPENCV_HIGHGUI_HPP 19 | 20 | #include "opencv2/core.hpp" 21 | 22 | enum 23 | { 24 | CV_LOAD_IMAGE_UNCHANGED = -1, 25 | CV_LOAD_IMAGE_GRAYSCALE = 0, 26 | CV_LOAD_IMAGE_COLOR = 1, 27 | }; 28 | 29 | enum 30 | { 31 | CV_IMWRITE_JPEG_QUALITY = 1 32 | }; 33 | 34 | namespace cv { 35 | 36 | enum ImreadModes 37 | { 38 | IMREAD_UNCHANGED = -1, 39 | IMREAD_GRAYSCALE = 0, 40 | IMREAD_COLOR = 1 41 | }; 42 | 43 | enum ImwriteFlags 44 | { 45 | IMWRITE_JPEG_QUALITY = 1 46 | }; 47 | 48 | CV_EXPORTS_W Mat imread(const String& filename, int flags = IMREAD_COLOR); 49 | 50 | CV_EXPORTS_W bool imwrite(const String& filename, InputArray img, const std::vector& params = std::vector()); 51 | 52 | CV_EXPORTS_W Mat imdecode(InputArray buf, int flags); 53 | 54 | CV_EXPORTS_W bool imencode(const String& ext, InputArray img, CV_OUT std::vector& buf, const std::vector& params = std::vector()); 55 | 56 | CV_EXPORTS_W void imshow(const String& winname, InputArray mat); 57 | 58 | CV_EXPORTS_W int waitKey(int delay = 0); 59 | 60 | } // namespace cv 61 | 62 | #endif // OPENCV_HIGHGUI_HPP 63 | -------------------------------------------------------------------------------- /third_party/libopencv-4.6-aarch64-none/include/opencv4/opencv2/imgproc/bindings.hpp: -------------------------------------------------------------------------------- 1 | // This file is part of OpenCV project. 2 | // It is subject to the license terms in the LICENSE file found in the top-level directory 3 | // of this distribution and at http://opencv.org/license.html. 4 | 5 | #ifndef OPENCV_IMGPROC_BINDINGS_HPP 6 | #define OPENCV_IMGPROC_BINDINGS_HPP 7 | 8 | // This file contains special overloads for OpenCV bindings 9 | // No need to use these functions in C++ code. 10 | 11 | namespace cv { 12 | 13 | /** @brief Finds lines in a binary image using the standard Hough transform and get accumulator. 14 | * 15 | * @note This function is for bindings use only. Use original function in C++ code 16 | * 17 | * @sa HoughLines 18 | */ 19 | CV_WRAP static inline 20 | void HoughLinesWithAccumulator( 21 | InputArray image, OutputArray lines, 22 | double rho, double theta, int threshold, 23 | double srn = 0, double stn = 0, 24 | double min_theta = 0, double max_theta = CV_PI 25 | ) 26 | { 27 | std::vector lines_acc; 28 | HoughLines(image, lines_acc, rho, theta, threshold, srn, stn, min_theta, max_theta); 29 | Mat(lines_acc).copyTo(lines); 30 | } 31 | 32 | } // namespace 33 | 34 | #endif // OPENCV_IMGPROC_BINDINGS_HPP 35 | -------------------------------------------------------------------------------- /third_party/libopencv-4.6-aarch64-none/include/opencv4/opencv2/imgproc/hal/interface.h: -------------------------------------------------------------------------------- 1 | #ifndef OPENCV_IMGPROC_HAL_INTERFACE_H 2 | #define OPENCV_IMGPROC_HAL_INTERFACE_H 3 | 4 | //! @addtogroup imgproc_hal_interface 5 | //! @{ 6 | 7 | //! @name Interpolation modes 8 | //! @sa cv::InterpolationFlags 9 | //! @{ 10 | #define CV_HAL_INTER_NEAREST 0 11 | #define CV_HAL_INTER_LINEAR 1 12 | #define CV_HAL_INTER_CUBIC 2 13 | #define CV_HAL_INTER_AREA 3 14 | #define CV_HAL_INTER_LANCZOS4 4 15 | //! @} 16 | 17 | //! @name Morphology operations 18 | //! @sa cv::MorphTypes 19 | //! @{ 20 | #define CV_HAL_MORPH_ERODE 0 21 | #define CV_HAL_MORPH_DILATE 1 22 | //! @} 23 | 24 | //! @name Threshold types 25 | //! @sa cv::ThresholdTypes 26 | //! @{ 27 | #define CV_HAL_THRESH_BINARY 0 28 | #define CV_HAL_THRESH_BINARY_INV 1 29 | #define CV_HAL_THRESH_TRUNC 2 30 | #define CV_HAL_THRESH_TOZERO 3 31 | #define CV_HAL_THRESH_TOZERO_INV 4 32 | #define CV_HAL_THRESH_MASK 7 33 | #define CV_HAL_THRESH_OTSU 8 34 | #define CV_HAL_THRESH_TRIANGLE 16 35 | //! @} 36 | 37 | //! @name Adaptive threshold algorithm 38 | //! @sa cv::AdaptiveThresholdTypes 39 | //! @{ 40 | #define CV_HAL_ADAPTIVE_THRESH_MEAN_C 0 41 | #define CV_HAL_ADAPTIVE_THRESH_GAUSSIAN_C 1 42 | //! @} 43 | 44 | //! @} 45 | 46 | #endif 47 | -------------------------------------------------------------------------------- /third_party/libopencv-4.6-aarch64-none/include/opencv4/opencv2/imgproc/imgproc.hpp: -------------------------------------------------------------------------------- 1 | /*M/////////////////////////////////////////////////////////////////////////////////////// 2 | // 3 | // IMPORTANT: READ BEFORE DOWNLOADING, COPYING, INSTALLING OR USING. 4 | // 5 | // By downloading, copying, installing or using the software you agree to this license. 6 | // If you do not agree to this license, do not download, install, 7 | // copy or use the software. 8 | // 9 | // 10 | // License Agreement 11 | // For Open Source Computer Vision Library 12 | // 13 | // Copyright (C) 2000-2008, Intel Corporation, all rights reserved. 14 | // Copyright (C) 2009, Willow Garage Inc., all rights reserved. 15 | // Copyright (C) 2013, OpenCV Foundation, all rights reserved. 16 | // Third party copyrights are property of their respective owners. 17 | // 18 | // Redistribution and use in source and binary forms, with or without modification, 19 | // are permitted provided that the following conditions are met: 20 | // 21 | // * Redistribution's of source code must retain the above copyright notice, 22 | // this list of conditions and the following disclaimer. 23 | // 24 | // * Redistribution's in binary form must reproduce the above copyright notice, 25 | // this list of conditions and the following disclaimer in the documentation 26 | // and/or other materials provided with the distribution. 27 | // 28 | // * The name of the copyright holders may not be used to endorse or promote products 29 | // derived from this software without specific prior written permission. 30 | // 31 | // This software is provided by the copyright holders and contributors "as is" and 32 | // any express or implied warranties, including, but not limited to, the implied 33 | // warranties of merchantability and fitness for a particular purpose are disclaimed. 34 | // In no event shall the Intel Corporation or contributors be liable for any direct, 35 | // indirect, incidental, special, exemplary, or consequential damages 36 | // (including, but not limited to, procurement of substitute goods or services; 37 | // loss of use, data, or profits; or business interruption) however caused 38 | // and on any theory of liability, whether in contract, strict liability, 39 | // or tort (including negligence or otherwise) arising in any way out of 40 | // the use of this software, even if advised of the possibility of such damage. 41 | // 42 | //M*/ 43 | 44 | #ifdef __OPENCV_BUILD 45 | #error this is a compatibility header which should not be used inside the OpenCV library 46 | #endif 47 | 48 | #include "opencv2/imgproc.hpp" 49 | -------------------------------------------------------------------------------- /third_party/libopencv-4.6-aarch64-none/include/opencv4/opencv2/opencv.hpp: -------------------------------------------------------------------------------- 1 | /*M/////////////////////////////////////////////////////////////////////////////////////// 2 | // 3 | // IMPORTANT: READ BEFORE DOWNLOADING, COPYING, INSTALLING OR USING. 4 | // 5 | // By downloading, copying, installing or using the software you agree to this license. 6 | // If you do not agree to this license, do not download, install, 7 | // copy or use the software. 8 | // 9 | // 10 | // License Agreement 11 | // For Open Source Computer Vision Library 12 | // 13 | // Copyright (C) 2000-2008, Intel Corporation, all rights reserved. 14 | // Copyright (C) 2009-2010, Willow Garage Inc., all rights reserved. 15 | // Third party copyrights are property of their respective owners. 16 | // 17 | // Redistribution and use in source and binary forms, with or without modification, 18 | // are permitted provided that the following conditions are met: 19 | // 20 | // * Redistribution's of source code must retain the above copyright notice, 21 | // this list of conditions and the following disclaimer. 22 | // 23 | // * Redistribution's in binary form must reproduce the above copyright notice, 24 | // this list of conditions and the following disclaimer in the documentation 25 | // and/or other materials provided with the distribution. 26 | // 27 | // * The name of the copyright holders may not be used to endorse or promote products 28 | // derived from this software without specific prior written permission. 29 | // 30 | // This software is provided by the copyright holders and contributors "as is" and 31 | // any express or implied warranties, including, but not limited to, the implied 32 | // warranties of merchantability and fitness for a particular purpose are disclaimed. 33 | // In no event shall the Intel Corporation or contributors be liable for any direct, 34 | // indirect, incidental, special, exemplary, or consequential damages 35 | // (including, but not limited to, procurement of substitute goods or services; 36 | // loss of use, data, or profits; or business interruption) however caused 37 | // and on any theory of liability, whether in contract, strict liability, 38 | // or tort (including negligence or otherwise) arising in any way out of 39 | // the use of this software, even if advised of the possibility of such damage. 40 | // 41 | //M*/ 42 | 43 | #ifndef OPENCV_ALL_HPP 44 | #define OPENCV_ALL_HPP 45 | 46 | // File that defines what modules where included during the build of OpenCV 47 | // These are purely the defines of the correct HAVE_OPENCV_modulename values 48 | #include "opencv2/opencv_modules.hpp" 49 | 50 | // Then the list of defines is checked to include the correct headers 51 | // Core library is always included --> without no OpenCV functionality available 52 | #include "opencv2/core.hpp" 53 | 54 | // Then the optional modules are checked 55 | #ifdef HAVE_OPENCV_CALIB3D 56 | #include "opencv2/calib3d.hpp" 57 | #endif 58 | #ifdef HAVE_OPENCV_FEATURES2D 59 | #include "opencv2/features2d.hpp" 60 | #endif 61 | #ifdef HAVE_OPENCV_DNN 62 | #include "opencv2/dnn.hpp" 63 | #endif 64 | #ifdef HAVE_OPENCV_FLANN 65 | #include "opencv2/flann.hpp" 66 | #endif 67 | #ifdef HAVE_OPENCV_HIGHGUI 68 | #include "opencv2/highgui.hpp" 69 | #endif 70 | #ifdef HAVE_OPENCV_IMGCODECS 71 | #include "opencv2/imgcodecs.hpp" 72 | #endif 73 | #ifdef HAVE_OPENCV_IMGPROC 74 | #include "opencv2/imgproc.hpp" 75 | #endif 76 | #ifdef HAVE_OPENCV_ML 77 | #include "opencv2/ml.hpp" 78 | #endif 79 | #ifdef HAVE_OPENCV_OBJDETECT 80 | #include "opencv2/objdetect.hpp" 81 | #endif 82 | #ifdef HAVE_OPENCV_PHOTO 83 | #include "opencv2/photo.hpp" 84 | #endif 85 | #ifdef HAVE_OPENCV_STITCHING 86 | #include "opencv2/stitching.hpp" 87 | #endif 88 | #ifdef HAVE_OPENCV_VIDEO 89 | #include "opencv2/video.hpp" 90 | #endif 91 | #ifdef HAVE_OPENCV_VIDEOIO 92 | #include "opencv2/videoio.hpp" 93 | #endif 94 | 95 | #endif 96 | -------------------------------------------------------------------------------- /third_party/libopencv-4.6-aarch64-none/include/opencv4/opencv2/opencv_modules.hpp: -------------------------------------------------------------------------------- 1 | /* 2 | * ** File generated automatically, do not modify ** 3 | * 4 | * This file defines the list of modules available in current build configuration 5 | * 6 | * 7 | */ 8 | 9 | // This definition means that OpenCV is built with enabled non-free code. 10 | // For example, patented algorithms for non-profit/non-commercial use only. 11 | /* #undef OPENCV_ENABLE_NONFREE */ 12 | 13 | #define HAVE_OPENCV_CORE 14 | #define HAVE_OPENCV_FEATURES2D 15 | #define HAVE_OPENCV_HIGHGUI 16 | #define HAVE_OPENCV_IMGPROC 17 | #define HAVE_OPENCV_PHOTO 18 | #define HAVE_OPENCV_VIDEO 19 | 20 | 21 | -------------------------------------------------------------------------------- /third_party/libopencv-4.6-aarch64-none/include/opencv4/opencv2/photo/legacy/constants_c.h: -------------------------------------------------------------------------------- 1 | // This file is part of OpenCV project. 2 | // It is subject to the license terms in the LICENSE file found in the top-level directory 3 | // of this distribution and at http://opencv.org/license.html. 4 | 5 | #ifndef OPENCV_PHOTO_LEGACY_CONSTANTS_H 6 | #define OPENCV_PHOTO_LEGACY_CONSTANTS_H 7 | 8 | enum InpaintingModes 9 | { 10 | CV_INPAINT_NS =0, 11 | CV_INPAINT_TELEA =1 12 | }; 13 | 14 | #endif // OPENCV_PHOTO_LEGACY_CONSTANTS_H 15 | -------------------------------------------------------------------------------- /third_party/libopencv-4.6-aarch64-none/include/opencv4/opencv2/photo/photo.hpp: -------------------------------------------------------------------------------- 1 | /*M/////////////////////////////////////////////////////////////////////////////////////// 2 | // 3 | // IMPORTANT: READ BEFORE DOWNLOADING, COPYING, INSTALLING OR USING. 4 | // 5 | // By downloading, copying, installing or using the software you agree to this license. 6 | // If you do not agree to this license, do not download, install, 7 | // copy or use the software. 8 | // 9 | // 10 | // License Agreement 11 | // For Open Source Computer Vision Library 12 | // 13 | // Copyright (C) 2000-2008, Intel Corporation, all rights reserved. 14 | // Copyright (C) 2009, Willow Garage Inc., all rights reserved. 15 | // Copyright (C) 2013, OpenCV Foundation, all rights reserved. 16 | // Third party copyrights are property of their respective owners. 17 | // 18 | // Redistribution and use in source and binary forms, with or without modification, 19 | // are permitted provided that the following conditions are met: 20 | // 21 | // * Redistribution's of source code must retain the above copyright notice, 22 | // this list of conditions and the following disclaimer. 23 | // 24 | // * Redistribution's in binary form must reproduce the above copyright notice, 25 | // this list of conditions and the following disclaimer in the documentation 26 | // and/or other materials provided with the distribution. 27 | // 28 | // * The name of the copyright holders may not be used to endorse or promote products 29 | // derived from this software without specific prior written permission. 30 | // 31 | // This software is provided by the copyright holders and contributors "as is" and 32 | // any express or implied warranties, including, but not limited to, the implied 33 | // warranties of merchantability and fitness for a particular purpose are disclaimed. 34 | // In no event shall the Intel Corporation or contributors be liable for any direct, 35 | // indirect, incidental, special, exemplary, or consequential damages 36 | // (including, but not limited to, procurement of substitute goods or services; 37 | // loss of use, data, or profits; or business interruption) however caused 38 | // and on any theory of liability, whether in contract, strict liability, 39 | // or tort (including negligence or otherwise) arising in any way out of 40 | // the use of this software, even if advised of the possibility of such damage. 41 | // 42 | //M*/ 43 | 44 | #ifdef __OPENCV_BUILD 45 | #error this is a compatibility header which should not be used inside the OpenCV library 46 | #endif 47 | 48 | #include "opencv2/photo.hpp" 49 | -------------------------------------------------------------------------------- /third_party/libopencv-4.6-aarch64-none/include/opencv4/opencv2/video.hpp: -------------------------------------------------------------------------------- 1 | /*M/////////////////////////////////////////////////////////////////////////////////////// 2 | // 3 | // IMPORTANT: READ BEFORE DOWNLOADING, COPYING, INSTALLING OR USING. 4 | // 5 | // By downloading, copying, installing or using the software you agree to this license. 6 | // If you do not agree to this license, do not download, install, 7 | // copy or use the software. 8 | // 9 | // 10 | // License Agreement 11 | // For Open Source Computer Vision Library 12 | // 13 | // Copyright (C) 2000-2008, Intel Corporation, all rights reserved. 14 | // Copyright (C) 2009, Willow Garage Inc., all rights reserved. 15 | // Copyright (C) 2013, OpenCV Foundation, all rights reserved. 16 | // Third party copyrights are property of their respective owners. 17 | // 18 | // Redistribution and use in source and binary forms, with or without modification, 19 | // are permitted provided that the following conditions are met: 20 | // 21 | // * Redistribution's of source code must retain the above copyright notice, 22 | // this list of conditions and the following disclaimer. 23 | // 24 | // * Redistribution's in binary form must reproduce the above copyright notice, 25 | // this list of conditions and the following disclaimer in the documentation 26 | // and/or other materials provided with the distribution. 27 | // 28 | // * The name of the copyright holders may not be used to endorse or promote products 29 | // derived from this software without specific prior written permission. 30 | // 31 | // This software is provided by the copyright holders and contributors "as is" and 32 | // any express or implied warranties, including, but not limited to, the implied 33 | // warranties of merchantability and fitness for a particular purpose are disclaimed. 34 | // In no event shall the Intel Corporation or contributors be liable for any direct, 35 | // indirect, incidental, special, exemplary, or consequential damages 36 | // (including, but not limited to, procurement of substitute goods or services; 37 | // loss of use, data, or profits; or business interruption) however caused 38 | // and on any theory of liability, whether in contract, strict liability, 39 | // or tort (including negligence or otherwise) arising in any way out of 40 | // the use of this software, even if advised of the possibility of such damage. 41 | // 42 | //M*/ 43 | 44 | #ifndef OPENCV_VIDEO_HPP 45 | #define OPENCV_VIDEO_HPP 46 | 47 | /** 48 | @defgroup video Video Analysis 49 | @{ 50 | @defgroup video_motion Motion Analysis 51 | @defgroup video_track Object Tracking 52 | @defgroup video_c C API 53 | @} 54 | */ 55 | 56 | #include "opencv2/video/tracking.hpp" 57 | #include "opencv2/video/background_segm.hpp" 58 | 59 | #endif //OPENCV_VIDEO_HPP 60 | -------------------------------------------------------------------------------- /third_party/libopencv-4.6-aarch64-none/include/opencv4/opencv2/video/legacy/constants_c.h: -------------------------------------------------------------------------------- 1 | // This file is part of OpenCV project. 2 | // It is subject to the license terms in the LICENSE file found in the top-level directory 3 | // of this distribution and at http://opencv.org/license.html. 4 | 5 | #ifndef OPENCV_VIDEO_LEGACY_CONSTANTS_H 6 | #define OPENCV_VIDEO_LEGACY_CONSTANTS_H 7 | 8 | enum 9 | { 10 | CV_LKFLOW_PYR_A_READY = 1, 11 | CV_LKFLOW_PYR_B_READY = 2, 12 | CV_LKFLOW_INITIAL_GUESSES = 4, 13 | CV_LKFLOW_GET_MIN_EIGENVALS = 8 14 | }; 15 | 16 | #endif // OPENCV_VIDEO_LEGACY_CONSTANTS_H 17 | -------------------------------------------------------------------------------- /third_party/libopencv-4.6-aarch64-none/include/opencv4/opencv2/video/video.hpp: -------------------------------------------------------------------------------- 1 | /*M/////////////////////////////////////////////////////////////////////////////////////// 2 | // 3 | // IMPORTANT: READ BEFORE DOWNLOADING, COPYING, INSTALLING OR USING. 4 | // 5 | // By downloading, copying, installing or using the software you agree to this license. 6 | // If you do not agree to this license, do not download, install, 7 | // copy or use the software. 8 | // 9 | // 10 | // License Agreement 11 | // For Open Source Computer Vision Library 12 | // 13 | // Copyright (C) 2000-2008, Intel Corporation, all rights reserved. 14 | // Copyright (C) 2009, Willow Garage Inc., all rights reserved. 15 | // Copyright (C) 2013, OpenCV Foundation, all rights reserved. 16 | // Third party copyrights are property of their respective owners. 17 | // 18 | // Redistribution and use in source and binary forms, with or without modification, 19 | // are permitted provided that the following conditions are met: 20 | // 21 | // * Redistribution's of source code must retain the above copyright notice, 22 | // this list of conditions and the following disclaimer. 23 | // 24 | // * Redistribution's in binary form must reproduce the above copyright notice, 25 | // this list of conditions and the following disclaimer in the documentation 26 | // and/or other materials provided with the distribution. 27 | // 28 | // * The name of the copyright holders may not be used to endorse or promote products 29 | // derived from this software without specific prior written permission. 30 | // 31 | // This software is provided by the copyright holders and contributors "as is" and 32 | // any express or implied warranties, including, but not limited to, the implied 33 | // warranties of merchantability and fitness for a particular purpose are disclaimed. 34 | // In no event shall the Intel Corporation or contributors be liable for any direct, 35 | // indirect, incidental, special, exemplary, or consequential damages 36 | // (including, but not limited to, procurement of substitute goods or services; 37 | // loss of use, data, or profits; or business interruption) however caused 38 | // and on any theory of liability, whether in contract, strict liability, 39 | // or tort (including negligence or otherwise) arising in any way out of 40 | // the use of this software, even if advised of the possibility of such damage. 41 | // 42 | //M*/ 43 | 44 | #ifdef __OPENCV_BUILD 45 | #error this is a compatibility header which should not be used inside the OpenCV library 46 | #endif 47 | 48 | #include "opencv2/video.hpp" 49 | -------------------------------------------------------------------------------- /third_party/libopencv-4.6-aarch64-none/lib/cmake/opencv4/OpenCVConfig-version.cmake: -------------------------------------------------------------------------------- 1 | set(OpenCV_VERSION 4.6.0) 2 | set(PACKAGE_VERSION ${OpenCV_VERSION}) 3 | 4 | set(PACKAGE_VERSION_EXACT False) 5 | set(PACKAGE_VERSION_COMPATIBLE False) 6 | 7 | if(PACKAGE_FIND_VERSION VERSION_EQUAL PACKAGE_VERSION) 8 | set(PACKAGE_VERSION_EXACT True) 9 | set(PACKAGE_VERSION_COMPATIBLE True) 10 | endif() 11 | 12 | if(PACKAGE_FIND_VERSION_MAJOR EQUAL 4 13 | AND PACKAGE_FIND_VERSION VERSION_LESS PACKAGE_VERSION) 14 | set(PACKAGE_VERSION_COMPATIBLE True) 15 | endif() 16 | -------------------------------------------------------------------------------- /third_party/libopencv-4.6-aarch64-none/lib/cmake/opencv4/OpenCVModules-release.cmake: -------------------------------------------------------------------------------- 1 | #---------------------------------------------------------------- 2 | # Generated CMake target import file for configuration "Release". 3 | #---------------------------------------------------------------- 4 | 5 | # Commands may need to know the format version. 6 | set(CMAKE_IMPORT_FILE_VERSION 1) 7 | 8 | # Import target "opencv_core" for configuration "Release" 9 | set_property(TARGET opencv_core APPEND PROPERTY IMPORTED_CONFIGURATIONS RELEASE) 10 | set_target_properties(opencv_core PROPERTIES 11 | IMPORTED_LINK_INTERFACE_LANGUAGES_RELEASE "CXX" 12 | IMPORTED_LOCATION_RELEASE "${_IMPORT_PREFIX}/lib/libopencv_core.a" 13 | ) 14 | 15 | list(APPEND _IMPORT_CHECK_TARGETS opencv_core ) 16 | list(APPEND _IMPORT_CHECK_FILES_FOR_opencv_core "${_IMPORT_PREFIX}/lib/libopencv_core.a" ) 17 | 18 | # Import target "opencv_imgproc" for configuration "Release" 19 | set_property(TARGET opencv_imgproc APPEND PROPERTY IMPORTED_CONFIGURATIONS RELEASE) 20 | set_target_properties(opencv_imgproc PROPERTIES 21 | IMPORTED_LINK_INTERFACE_LANGUAGES_RELEASE "CXX" 22 | IMPORTED_LOCATION_RELEASE "${_IMPORT_PREFIX}/lib/libopencv_imgproc.a" 23 | ) 24 | 25 | list(APPEND _IMPORT_CHECK_TARGETS opencv_imgproc ) 26 | list(APPEND _IMPORT_CHECK_FILES_FOR_opencv_imgproc "${_IMPORT_PREFIX}/lib/libopencv_imgproc.a" ) 27 | 28 | # Import target "opencv_photo" for configuration "Release" 29 | set_property(TARGET opencv_photo APPEND PROPERTY IMPORTED_CONFIGURATIONS RELEASE) 30 | set_target_properties(opencv_photo PROPERTIES 31 | IMPORTED_LINK_INTERFACE_LANGUAGES_RELEASE "CXX" 32 | IMPORTED_LOCATION_RELEASE "${_IMPORT_PREFIX}/lib/libopencv_photo.a" 33 | ) 34 | 35 | list(APPEND _IMPORT_CHECK_TARGETS opencv_photo ) 36 | list(APPEND _IMPORT_CHECK_FILES_FOR_opencv_photo "${_IMPORT_PREFIX}/lib/libopencv_photo.a" ) 37 | 38 | # Import target "opencv_video" for configuration "Release" 39 | set_property(TARGET opencv_video APPEND PROPERTY IMPORTED_CONFIGURATIONS RELEASE) 40 | set_target_properties(opencv_video PROPERTIES 41 | IMPORTED_LINK_INTERFACE_LANGUAGES_RELEASE "CXX" 42 | IMPORTED_LOCATION_RELEASE "${_IMPORT_PREFIX}/lib/libopencv_video.a" 43 | ) 44 | 45 | list(APPEND _IMPORT_CHECK_TARGETS opencv_video ) 46 | list(APPEND _IMPORT_CHECK_FILES_FOR_opencv_video "${_IMPORT_PREFIX}/lib/libopencv_video.a" ) 47 | 48 | # Import target "opencv_features2d" for configuration "Release" 49 | set_property(TARGET opencv_features2d APPEND PROPERTY IMPORTED_CONFIGURATIONS RELEASE) 50 | set_target_properties(opencv_features2d PROPERTIES 51 | IMPORTED_LINK_INTERFACE_LANGUAGES_RELEASE "CXX" 52 | IMPORTED_LOCATION_RELEASE "${_IMPORT_PREFIX}/lib/libopencv_features2d.a" 53 | ) 54 | 55 | list(APPEND _IMPORT_CHECK_TARGETS opencv_features2d ) 56 | list(APPEND _IMPORT_CHECK_FILES_FOR_opencv_features2d "${_IMPORT_PREFIX}/lib/libopencv_features2d.a" ) 57 | 58 | # Import target "opencv_highgui" for configuration "Release" 59 | set_property(TARGET opencv_highgui APPEND PROPERTY IMPORTED_CONFIGURATIONS RELEASE) 60 | set_target_properties(opencv_highgui PROPERTIES 61 | IMPORTED_LINK_INTERFACE_LANGUAGES_RELEASE "CXX" 62 | IMPORTED_LOCATION_RELEASE "${_IMPORT_PREFIX}/lib/libopencv_highgui.a" 63 | ) 64 | 65 | list(APPEND _IMPORT_CHECK_TARGETS opencv_highgui ) 66 | list(APPEND _IMPORT_CHECK_FILES_FOR_opencv_highgui "${_IMPORT_PREFIX}/lib/libopencv_highgui.a" ) 67 | 68 | # Commands beyond this point should not need to know the version. 69 | set(CMAKE_IMPORT_FILE_VERSION) 70 | -------------------------------------------------------------------------------- /third_party/onnxruntime-aarch64-none-gnu-1.16.0/include/cpu_provider_factory.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) Microsoft Corporation. All rights reserved. 2 | // Licensed under the MIT License. 3 | 4 | #include "onnxruntime_c_api.h" 5 | 6 | #ifdef __cplusplus 7 | extern "C" { 8 | #endif 9 | 10 | /** 11 | * \param use_arena zero: false. non-zero: true. 12 | */ 13 | ORT_EXPORT 14 | ORT_API_STATUS(OrtSessionOptionsAppendExecutionProvider_CPU, _In_ OrtSessionOptions* options, int use_arena) 15 | ORT_ALL_ARGS_NONNULL; 16 | 17 | #ifdef __cplusplus 18 | } 19 | #endif 20 | -------------------------------------------------------------------------------- /third_party/onnxruntime-aarch64-none-gnu-1.16.0/include/onnxruntime_run_options_config_keys.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) Microsoft Corporation. All rights reserved. 2 | // Licensed under the MIT License. 3 | 4 | #pragma once 5 | 6 | /* 7 | * This file defines RunOptions Config Keys and format of the Config Values. 8 | * 9 | * The Naming Convention for a RunOptions Config Key, 10 | * "[Area][.[SubArea1].[SubArea2]...].[Keyname]" 11 | * Such as "ep.cuda.use_arena" 12 | * The Config Key cannot be empty 13 | * The maximum length of the Config Key is 128 14 | * 15 | * The string format of a RunOptions Config Value is defined individually for each Config. 16 | * The maximum length of the Config Value is 1024 17 | */ 18 | 19 | // Key for enabling shrinkages of user listed device memory arenas. 20 | // Expects a list of semi-colon separated key value pairs separated by colon in the following format: 21 | // "device_0:device_id_0;device_1:device_id_1" 22 | // No white-spaces allowed in the provided list string. 23 | // Currently, the only supported devices are : "cpu", "gpu" (case sensitive). 24 | // If "cpu" is included in the list, DisableCpuMemArena() API must not be called (i.e.) arena for cpu should be enabled. 25 | // Example usage: "cpu:0;gpu:0" (or) "gpu:0" 26 | // By default, the value for this key is empty (i.e.) no memory arenas are shrunk 27 | static const char* const kOrtRunOptionsConfigEnableMemoryArenaShrinkage = "memory.enable_memory_arena_shrinkage"; 28 | 29 | // Set to '1' to not synchronize execution providers with CPU at the end of session run. 30 | // Per default it will be set to '0' 31 | // Taking CUDA EP as an example, it omit triggering cudaStreamSynchronize on the compute stream. 32 | static const char* const kOrtRunOptionsConfigDisableSynchronizeExecutionProviders = "disable_synchronize_execution_providers"; 33 | -------------------------------------------------------------------------------- /third_party/onnxruntime-aarch64-none-gnu-1.16.0/lib/cmake/onnxruntime/onnxruntimeConfig.cmake: -------------------------------------------------------------------------------- 1 | 2 | ####### Expanded from @PACKAGE_INIT@ by configure_package_config_file() ####### 3 | ####### Any changes to this file will be overwritten by the next CMake run #### 4 | ####### The input file was PROJECT_CONFIG_FILE ######## 5 | 6 | get_filename_component(PACKAGE_PREFIX_DIR "${CMAKE_CURRENT_LIST_DIR}/../../../" ABSOLUTE) 7 | 8 | macro(set_and_check _var _file) 9 | set(${_var} "${_file}") 10 | if(NOT EXISTS "${_file}") 11 | message(FATAL_ERROR "File or directory ${_file} referenced by variable ${_var} does not exist !") 12 | endif() 13 | endmacro() 14 | 15 | macro(check_required_components _NAME) 16 | foreach(comp ${${_NAME}_FIND_COMPONENTS}) 17 | if(NOT ${_NAME}_${comp}_FOUND) 18 | if(${_NAME}_FIND_REQUIRED_${comp}) 19 | set(${_NAME}_FOUND FALSE) 20 | endif() 21 | endif() 22 | endforeach() 23 | endmacro() 24 | 25 | #################################################################################### 26 | include("${CMAKE_CURRENT_LIST_DIR}/onnxruntimeTargets.cmake") 27 | -------------------------------------------------------------------------------- /third_party/onnxruntime-aarch64-none-gnu-1.16.0/lib/cmake/onnxruntime/onnxruntimeConfigVersion.cmake: -------------------------------------------------------------------------------- 1 | # This is a basic version file for the Config-mode of find_package(). 2 | # It is used by write_basic_package_version_file() as input file for configure_file() 3 | # to create a version-file which can be installed along a config.cmake file. 4 | # 5 | # The created file sets PACKAGE_VERSION_EXACT if the current version string and 6 | # the requested version string are exactly the same and it sets 7 | # PACKAGE_VERSION_COMPATIBLE if the current version is >= requested version, 8 | # but only if the requested major version is the same as the current one. 9 | # The variable CVF_VERSION must be set before calling configure_file(). 10 | 11 | 12 | set(PACKAGE_VERSION "1.16.0") 13 | 14 | if(PACKAGE_VERSION VERSION_LESS PACKAGE_FIND_VERSION) 15 | set(PACKAGE_VERSION_COMPATIBLE FALSE) 16 | else() 17 | 18 | if("1.16.0" MATCHES "^([0-9]+)\\.") 19 | set(CVF_VERSION_MAJOR "${CMAKE_MATCH_1}") 20 | if(NOT CVF_VERSION_MAJOR VERSION_EQUAL 0) 21 | string(REGEX REPLACE "^0+" "" CVF_VERSION_MAJOR "${CVF_VERSION_MAJOR}") 22 | endif() 23 | else() 24 | set(CVF_VERSION_MAJOR "1.16.0") 25 | endif() 26 | 27 | if(PACKAGE_FIND_VERSION_RANGE) 28 | # both endpoints of the range must have the expected major version 29 | math (EXPR CVF_VERSION_MAJOR_NEXT "${CVF_VERSION_MAJOR} + 1") 30 | if (NOT PACKAGE_FIND_VERSION_MIN_MAJOR STREQUAL CVF_VERSION_MAJOR 31 | OR ((PACKAGE_FIND_VERSION_RANGE_MAX STREQUAL "INCLUDE" AND NOT PACKAGE_FIND_VERSION_MAX_MAJOR STREQUAL CVF_VERSION_MAJOR) 32 | OR (PACKAGE_FIND_VERSION_RANGE_MAX STREQUAL "EXCLUDE" AND NOT PACKAGE_FIND_VERSION_MAX VERSION_LESS_EQUAL CVF_VERSION_MAJOR_NEXT))) 33 | set(PACKAGE_VERSION_COMPATIBLE FALSE) 34 | elseif(PACKAGE_FIND_VERSION_MIN_MAJOR STREQUAL CVF_VERSION_MAJOR 35 | AND ((PACKAGE_FIND_VERSION_RANGE_MAX STREQUAL "INCLUDE" AND PACKAGE_VERSION VERSION_LESS_EQUAL PACKAGE_FIND_VERSION_MAX) 36 | OR (PACKAGE_FIND_VERSION_RANGE_MAX STREQUAL "EXCLUDE" AND PACKAGE_VERSION VERSION_LESS PACKAGE_FIND_VERSION_MAX))) 37 | set(PACKAGE_VERSION_COMPATIBLE TRUE) 38 | else() 39 | set(PACKAGE_VERSION_COMPATIBLE FALSE) 40 | endif() 41 | else() 42 | if(PACKAGE_FIND_VERSION_MAJOR STREQUAL CVF_VERSION_MAJOR) 43 | set(PACKAGE_VERSION_COMPATIBLE TRUE) 44 | else() 45 | set(PACKAGE_VERSION_COMPATIBLE FALSE) 46 | endif() 47 | 48 | if(PACKAGE_FIND_VERSION STREQUAL PACKAGE_VERSION) 49 | set(PACKAGE_VERSION_EXACT TRUE) 50 | endif() 51 | endif() 52 | endif() 53 | 54 | 55 | # if the installed or the using project don't have CMAKE_SIZEOF_VOID_P set, ignore it: 56 | if("${CMAKE_SIZEOF_VOID_P}" STREQUAL "" OR "8" STREQUAL "") 57 | return() 58 | endif() 59 | 60 | # check that the installed version has the same 32/64bit-ness as the one which is currently searching: 61 | if(NOT CMAKE_SIZEOF_VOID_P STREQUAL "8") 62 | math(EXPR installedBits "8 * 8") 63 | set(PACKAGE_VERSION "${PACKAGE_VERSION} (${installedBits}bit)") 64 | set(PACKAGE_VERSION_UNSUITABLE TRUE) 65 | endif() 66 | -------------------------------------------------------------------------------- /third_party/onnxruntime-aarch64-none-gnu-1.16.0/lib/cmake/onnxruntime/onnxruntimeTargets-release.cmake: -------------------------------------------------------------------------------- 1 | #---------------------------------------------------------------- 2 | # Generated CMake target import file for configuration "Release". 3 | #---------------------------------------------------------------- 4 | 5 | # Commands may need to know the format version. 6 | set(CMAKE_IMPORT_FILE_VERSION 1) 7 | 8 | # Import target "onnxruntime::onnxruntime" for configuration "Release" 9 | set_property(TARGET onnxruntime::onnxruntime APPEND PROPERTY IMPORTED_CONFIGURATIONS RELEASE) 10 | set_target_properties(onnxruntime::onnxruntime PROPERTIES 11 | IMPORTED_LOCATION_RELEASE "${_IMPORT_PREFIX}/lib/libonnxruntime.so.1.16.0" 12 | IMPORTED_SONAME_RELEASE "libonnxruntime.so.1.16.0" 13 | ) 14 | 15 | list(APPEND _cmake_import_check_targets onnxruntime::onnxruntime ) 16 | list(APPEND _cmake_import_check_files_for_onnxruntime::onnxruntime "${_IMPORT_PREFIX}/lib/libonnxruntime.so.1.16.0" ) 17 | 18 | # Commands beyond this point should not need to know the version. 19 | set(CMAKE_IMPORT_FILE_VERSION) 20 | -------------------------------------------------------------------------------- /third_party/onnxruntime-aarch64-none-gnu-1.16.0/lib/cmake/onnxruntime/onnxruntimeTargets.cmake: -------------------------------------------------------------------------------- 1 | # Generated by CMake 2 | 3 | if("${CMAKE_MAJOR_VERSION}.${CMAKE_MINOR_VERSION}" LESS 2.8) 4 | message(FATAL_ERROR "CMake >= 2.8.0 required") 5 | endif() 6 | if(CMAKE_VERSION VERSION_LESS "2.8.3") 7 | message(FATAL_ERROR "CMake >= 2.8.3 required") 8 | endif() 9 | cmake_policy(PUSH) 10 | cmake_policy(VERSION 2.8.3...3.24) 11 | #---------------------------------------------------------------- 12 | # Generated CMake target import file. 13 | #---------------------------------------------------------------- 14 | 15 | # Commands may need to know the format version. 16 | set(CMAKE_IMPORT_FILE_VERSION 1) 17 | 18 | # Protect against multiple inclusion, which would fail when already imported targets are added once more. 19 | set(_cmake_targets_defined "") 20 | set(_cmake_targets_not_defined "") 21 | set(_cmake_expected_targets "") 22 | foreach(_cmake_expected_target IN ITEMS onnxruntime::onnxruntime) 23 | list(APPEND _cmake_expected_targets "${_cmake_expected_target}") 24 | if(TARGET "${_cmake_expected_target}") 25 | list(APPEND _cmake_targets_defined "${_cmake_expected_target}") 26 | else() 27 | list(APPEND _cmake_targets_not_defined "${_cmake_expected_target}") 28 | endif() 29 | endforeach() 30 | unset(_cmake_expected_target) 31 | if(_cmake_targets_defined STREQUAL _cmake_expected_targets) 32 | unset(_cmake_targets_defined) 33 | unset(_cmake_targets_not_defined) 34 | unset(_cmake_expected_targets) 35 | unset(CMAKE_IMPORT_FILE_VERSION) 36 | cmake_policy(POP) 37 | return() 38 | endif() 39 | if(NOT _cmake_targets_defined STREQUAL "") 40 | string(REPLACE ";" ", " _cmake_targets_defined_text "${_cmake_targets_defined}") 41 | string(REPLACE ";" ", " _cmake_targets_not_defined_text "${_cmake_targets_not_defined}") 42 | message(FATAL_ERROR "Some (but not all) targets in this export set were already defined.\nTargets Defined: ${_cmake_targets_defined_text}\nTargets not yet defined: ${_cmake_targets_not_defined_text}\n") 43 | endif() 44 | unset(_cmake_targets_defined) 45 | unset(_cmake_targets_not_defined) 46 | unset(_cmake_expected_targets) 47 | 48 | 49 | # Compute the installation prefix relative to this file. 50 | get_filename_component(_IMPORT_PREFIX "${CMAKE_CURRENT_LIST_FILE}" PATH) 51 | get_filename_component(_IMPORT_PREFIX "${_IMPORT_PREFIX}" PATH) 52 | get_filename_component(_IMPORT_PREFIX "${_IMPORT_PREFIX}" PATH) 53 | get_filename_component(_IMPORT_PREFIX "${_IMPORT_PREFIX}" PATH) 54 | if(_IMPORT_PREFIX STREQUAL "/") 55 | set(_IMPORT_PREFIX "") 56 | endif() 57 | 58 | # Create imported target onnxruntime::onnxruntime 59 | add_library(onnxruntime::onnxruntime SHARED IMPORTED) 60 | 61 | set_target_properties(onnxruntime::onnxruntime PROPERTIES 62 | INTERFACE_COMPILE_DEFINITIONS "NSYNC_ATOMIC_CPP11" 63 | INTERFACE_INCLUDE_DIRECTORIES "${_IMPORT_PREFIX}/include/onnxruntime" 64 | ) 65 | 66 | # Load information for each installed configuration. 67 | file(GLOB _cmake_config_files "${CMAKE_CURRENT_LIST_DIR}/onnxruntimeTargets-*.cmake") 68 | foreach(_cmake_config_file IN LISTS _cmake_config_files) 69 | include("${_cmake_config_file}") 70 | endforeach() 71 | unset(_cmake_config_file) 72 | unset(_cmake_config_files) 73 | 74 | # Cleanup temporary variables. 75 | set(_IMPORT_PREFIX) 76 | 77 | # Loop over all imported files and verify that they actually exist 78 | foreach(_cmake_target IN LISTS _cmake_import_check_targets) 79 | foreach(_cmake_file IN LISTS "_cmake_import_check_files_for_${_cmake_target}") 80 | if(NOT EXISTS "${_cmake_file}") 81 | message(FATAL_ERROR "The imported target \"${_cmake_target}\" references the file 82 | \"${_cmake_file}\" 83 | but this file does not exist. Possible reasons include: 84 | * The file was deleted, renamed, or moved to another location. 85 | * An install or uninstall procedure did not complete successfully. 86 | * The installation package was faulty and contained 87 | \"${CMAKE_CURRENT_LIST_FILE}\" 88 | but not all the files it references. 89 | ") 90 | endif() 91 | endforeach() 92 | unset(_cmake_file) 93 | unset("_cmake_import_check_files_for_${_cmake_target}") 94 | endforeach() 95 | unset(_cmake_target) 96 | unset(_cmake_import_check_targets) 97 | 98 | # This file does not depend on other imported targets which have 99 | # been exported from the same project but in a separate export set. 100 | 101 | # Commands beyond this point should not need to know the version. 102 | set(CMAKE_IMPORT_FILE_VERSION) 103 | cmake_policy(POP) 104 | -------------------------------------------------------------------------------- /third_party/onnxruntime-aarch64-none-gnu-1.16.0/lib/libonnxruntime.so.1.16.0: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ZHEQIUSHUI/SAM-ONNX-AX650-CPP/dacdc31a8aafa7628a70fae237ebcd48c454d9a2/third_party/onnxruntime-aarch64-none-gnu-1.16.0/lib/libonnxruntime.so.1.16.0 -------------------------------------------------------------------------------- /third_party/onnxruntime-aarch64-none-gnu-1.16.0/lib/pkgconfig/libonnxruntime.pc: -------------------------------------------------------------------------------- 1 | prefix=/home/arno/workspace/projects/onnxruntime/build/ax650/install 2 | bindir=${prefix}/bin 3 | mandir=${prefix}/ 4 | docdir=${prefix}/ 5 | libdir=${prefix}/lib 6 | includedir=${prefix}/include/onnxruntime 7 | 8 | Name: onnxruntime 9 | Description: ONNX runtime 10 | URL: https://github.com/microsoft/onnxruntime 11 | Version: 1.16.0 12 | Libs: -L${libdir} -lonnxruntime 13 | Cflags: -I${includedir} 14 | -------------------------------------------------------------------------------- /toolchains/aarch64-none-linux-gnu.toolchain.cmake: -------------------------------------------------------------------------------- 1 | # set cross-compiled system type, it's better not use the type which cmake cannot recognized. 2 | SET (CMAKE_SYSTEM_NAME Linux) 3 | SET (CMAKE_SYSTEM_PROCESSOR aarch64) 4 | 5 | # aarch64-linux-gnu-gcc DO NOT need to be installed, so make sure aarch64-linux-gnu-gcc and aarch64-linux-gnu-g++ can be found in $PATH: 6 | SET (CMAKE_C_COMPILER "aarch64-none-linux-gnu-gcc") 7 | SET (CMAKE_CXX_COMPILER "aarch64-none-linux-gnu-g++") 8 | 9 | # set searching rules for cross-compiler 10 | SET (CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER) 11 | SET (CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY) 12 | SET (CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY) 13 | -------------------------------------------------------------------------------- /webui.py: -------------------------------------------------------------------------------- 1 | import gradio as gr 2 | import cv2, time 3 | 4 | 5 | def to_black(image): 6 | path = "%s.png" % (time.strftime('%Y-%m-%d_%H:%M:%S', time.localtime())) 7 | cv2.imwrite( 8 | path, 9 | image) 10 | return "success to save " + path 11 | 12 | 13 | interface = gr.Interface(fn=to_black, inputs="image", outputs='text') 14 | interface.launch(server_name="0.0.0.0", share=True) 15 | --------------------------------------------------------------------------------