OpenVC环境搭建

来源:互联网 发布:阿里数据竞赛 编辑:程序博客网 时间:2024/06/03 18:35
cmakelists.txt配置#要显示执行构建过程中详细的信息(比如为了得到更详细的出错信息),可以在CMakeList.txt内加入:set(CMAKE_VERBOSE_MAKEFILE on)#定义变量ocvlibs使后面的命令可以使用定位具体的库文件set(ocvlibs "/Users/xuyan/Desktop/android/OpenCV-android-sdk/sdk/native/libs")#调用头文件的具体路径include_directories(/Users/xuyan/Desktop/android/OpenCV-android-sdk/sdk/native/jni/include)add_library(libopencv_java3 SHARED IMPORTED )set_target_properties(libopencv_java3 PROPERTIES                      IMPORTED_LOCATION "${ocvlibs}/${ANDROID_ABI}/libopencv_java3.so")add_library( # Sets the name of the library.             native-lib             # Sets the library as a shared library.             SHARED             # Provides a relative path to your source file(s).             src/main/cpp/native-lib.cpp )find_library( # Sets the name of the path variable.              log-lib              # Specifies the name of the NDK library that              # you want CMake to locate.              log )target_link_libraries( # Specifies the target library.                       native-lib libopencv_java3 android log                       # Links the target library to the log library                       # included in the NDK.                       ${log-lib} )
native-lib.cpp 中配置#include <jni.h>#include <opencv2/core/core.hpp>#include <android/log.h>using namespace std;using namespace cv;

学习完OpenCV,我会每天陆续贴出自己的学习笔记,和大家共同进步,有什么不对地方,还请各位撸友多多指教。

原创粉丝点击