当前位置:   article > 正文

Android 调用OpenCV动态库

Android 调用OpenCV动态库

1、下载OpenCVMobile的文件,链接地址

2、OpenCV-android-sdk/sdk/native/libs/arm64-v8a/libopencv_java4.so拷贝处理放到libs里面

3、 OpenCV-android-sdk/sdk/native/jni/include 放到include文件夹下

4、Cmake修改

set(lib_DIR ${CMAKE_SOURCE_DIR}/libs)
add_library(libopencv_java SHARED IMPORTED)
set_target_properties(libopencv_java PROPERTIES IMPORTED_LOCATION ${lib_DIR}/${ANDROID_ABI}/libopencv_java4.so)

target_link_libraries(
        Demo
        libopencv_java
        android
        z
        ${log-lib}
        ${android-lib}
        jnigraphics)



  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11
  • 12
  • 13
  • 14
  • 15

5、build.gradle中加入对动态链接库的支持

    externalNativeBuild {
        cmake {
            cppFlags "-std=c++11 -fopenmp"
            abiFilters "arm64-v8a"// , "arm64-v8a" "armeabi-v7a"
            arguments "-DANDROID_STL=c++_shared"
        }
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6

6、引用后即可使用

#include <opencv2/core.hpp>

  • 1
  • 2
声明:本文内容由网友自发贡献,不代表【wpsshop博客】立场,版权归原作者所有,本站不承担相应法律责任。如您发现有侵权的内容,请联系我们。转载请注明出处:https://www.wpsshop.cn/w/羊村懒王/article/detail/643650
推荐阅读
相关标签
  

闽ICP备14008679号