美文网首页
opencv编译

opencv编译

作者: 差不多303 | 来源:发表于2019-03-20 15:52 被阅读0次

安卓:

ndk需要16.x.x
先cd到opencv-3.4.2_mobile目录下

mkdir build;cd build

cmake -DCMAKE_BUILD_WITH_INSTALL_RPATH=OFF -DCMAKE_TOOLCHAIN_FILE=../platforms/android/android.toolchain.cmake -DANDROID_NDK=/Users/intelligent/Library/Android/sdk/ndk-bundle -DCMAKE_BUILD_TYPE=Release -DANDROID_ABI="armeabi-v7a with NEON" -DANDROID_NATIVE_API_LEVEL=android-21 -DWITH_CUDA=OFF -DWITH_MATLAB=OFF -DBUILD_ANDROID_EXAMPLES=OFF -DBUILD_DOCS=OFF -DBUILD_PERF_TESTS=OFF -DBUILD_TESTS=OFF -D BUILD_SHARED_LIBS=OFF -DBUILD_FAT_JAVA_LIB=ON -DWITH_TBB=ON -DBUILD_TBB=ON -DANDROID_FORCE_ARM_BUILD=ON -DBUILD_ANDROID_PROJECTS=OFF -DCMAKE_INSTALL_PREFIX=/Users/intelligent/Documents/ab/AlgorithmFramework/opencv-3.4.2_cut_ios/install_android ..

make install -j8

如果需要编译出.so动态库

cmake -DCMAKE_BUILD_WITH_INSTALL_RPATH=OFF -DCMAKE_TOOLCHAIN_FILE=../platforms/android/android.toolchain.cmake -DANDROID_NDK=/Users/intelligent/Library/Android/sdk/ndk-bundle -DCMAKE_BUILD_TYPE=Release -DANDROID_ABI="armeabi-v7a with NEON" -DANDROID_NATIVE_API_LEVEL=android-21 -DWITH_CUDA=OFF -DWITH_MATLAB=OFF -DBUILD_ANDROID_EXAMPLES=OFF -DBUILD_DOCS=OFF -DBUILD_PERF_TESTS=OFF -DBUILD_TESTS=OFF -D BUILD_SHARED_LIBS=ON -DBUILD_FAT_JAVA_LIB=OFF -DWITH_TBB=ON -DBUILD_TBB=ON -DANDROID_FORCE_ARM_BUILD=ON -DBUILD_ANDROID_PROJECTS=OFF ..

iOS

1、安装Xcode
2、安装CMake
因为公司的opencv为3.2.0,所以CMake只能为3.13.x版本
3、执行

cd /
sudo ln -s /Applications/Xcode.app/Contents/Developer Developer

4、执行

python platforms/ios/build_framework.py --opencv . --dynamic platforms/ios/  --disable-bitcode

5、framework位置

参考:https://docs.opencv.org/3.2.0/d5/da3/tutorial_ios_install.html

Mac

1、打开CMake工具 image.png

2、填Where is the source code:,然后加上build文件夹填写,Where to build the binaries:
3、点击Confuigure
4、点击Generate
5、cd到上面“Where to build the binaries”目录下,运行 make

参考:https://www.youtube.com/watch?v=nuGdNITm5Mw

相关文章

网友评论

      本文标题:opencv编译

      本文链接:https://www.haomeiwen.com/subject/zinryqtx.html