赞
踩
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)
5、build.gradle中加入对动态链接库的支持
externalNativeBuild {
cmake {
cppFlags "-std=c++11 -fopenmp"
abiFilters "arm64-v8a"// , "arm64-v8a" "armeabi-v7a"
arguments "-DANDROID_STL=c++_shared"
}
6、引用后即可使用
#include <opencv2/core.hpp>
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。