我正在使用opencv4.0.1代码,并通过以下步骤构建sdk:
cd opencv-master
mkdir build
cd build
export ANDROID_SDK=~/Library/Android/sdk
export ANDROID_NDK=~/Library/Android/sdk/ndk-bundle
export PATH=/usr/local/opt/ccache/libexec:$PATH
../opencv-master/platforms/android/build_sdk.py
构建成功,我将OpenCV-android-sdk / sdk / native / libs复制到android studio。
但是当我从Android Studio编译本机代码时,
Ptr<Stitcher> stitcher = Stitcher::create();
听起来像上面的代码行编译错误:
error: undefined reference to 'cv::Stitcher::create(cv::Stitcher::Mode)'
sdk库libopencv_java4.so中可能缺少Stitcher模块
如何配置make文件以包含此模块?
答案 0 :(得分:0)
仅构建本机库
export WORK_DIR=`pwd`
export ANDROID_SDK=$HOME/Library/Android/sdk
export ANDROID_NDK=$ANDROID_SDK/ndk-bundle
export OPENCV_ROOT= $WORK_DIR/../
cmake $OPENCV_ROOT -DCMAKE_TOOLCHAIN_FILE=$ANDROID_NDK/build/cmake/android.toolchain.cmake -DANDROID_NATIVE_API_LEVEL=android-23 -DBUILD_JAVA=OFF -DBUILD_ANDROID_EXAMPLES=OFF -DBUILD_ANDROID_PROJECTS=OFF -DANDROID_STL=c++_shared -DBUILD_SHARED_LIBS=ON -DCMAKE_INSTALL_PREFIX:PATH=$WORK_DIR/out -DANDROID_ABI=arm64-v8a
make
make install