我试图通过Cmake将Opencv包含在我的原生C代码中.我在网上做了一些研究并从网上下载了FindOpenCV.cmake文件并将其添加到我的android项目的app目录中.这也是CMakeLists.txt所在的位置.我使用本教程将OpenCV作为模块导入到我的Android Studio项目中:https://www.learn2crack.com/2016/03/setup-opencv-sdk-android-studio.html,当我运行时:
if(!OpenCVLoader.initDebug()){
System.out.println("Opencv not loaded");
} else {
System.out.println("Opencv loaded");
}
Run Code Online (Sandbox Code Playgroud)
我知道Opencv已经加载了.
但是,因为我正在尝试将OpenCV添加到我的本机代码而不是Java代码中,所以我认为我不能使用它.这是我现在拥有的CMakeLists:
# Sets the minimum version of CMake required to build your native library.
# This ensures that a certain set of CMake features is available to
# your build.
cmake_minimum_required(VERSION 3.4.1)
set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} FindOpenCV.cmake)
# Specifies a library name, specifies whether the library is STATIC or
# SHARED, and provides relative paths to the source code. You can
# define multiple libraries …Run Code Online (Sandbox Code Playgroud)