Android Studio使用OpenCV以及JNI

1、下载OpenCVSDK,
2、导入OpenCV Moudle,同时配置一下gradle,主要是版本要相同
3、导入include头文件以及so文件,gradle中的jinLibs设置,要不说找到两个so文件

 sourceSets {
       main { jniLibs.srcDirs = ['libs']}
   }
#动态方式加载
#include_directories(${CMAKE_SOURCE_DIR}/include)
include_directories(/root/app/src/main/cpp/include)

add_library( lib_opencv SHARED IMPORTED )
set_target_properties(lib_opencv PROPERTIES IMPORTED_LOCATION /root/app/src/main/jniLibs/${ANDROID_ABI}/libopencv_java4.so)

target_link_libraries( # Specifies the target library.
        opencv_demo_0401
        lib_opencv
        # Links the target library to the log library
        # included in the NDK.
        ${log-lib})

具体参考文档 Android Studio中使用jni进行opencv开发的环境配置方法

你可能感兴趣的:(opencv,TensorRT,liunx,python)