ios – Opencv自定义编译

前端之家收集整理的这篇文章主要介绍了ios – Opencv自定义编译前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。
我正在尝试减少ios的opencv2.framework大小.我的项目只使用core,imgproc和highgui模块.如何只使用那些模块进行编译?还是有减少尺寸的替代方案?

谢谢.

解决方法

我现在用版本3.1遇到了这个问题,而nebuto的答案很接近,但截至目前还不完整.通过更新build_framework.py文件,以下内容能够生成所需的结果.
def getCMakeArgs(self,arch,target):
    args = [
        "cmake","-GXcode","-DBUILD_SHARED_LIBS=OFF","-DBUILD_opencv_core=ON","-DBUILD_opencv_imgcodecs=OFF","-DBUILD_opencv_imgproc=ON","-DBUILD_opencv_world=OFF","-DBUILD_opencv_gpu=OFF","-DBUILD_opencv_calib3d=OFF","-DBUILD_opencv_contrib=OFF","-DBUILD_opencv_features2D=OFF","-DBUILD_opencv_flann=OFF","-DBUILD_opencv_highgui=ON","-DBUILD_opencv_legacy=OFF","-DBUILD_opencv_ml=OFF","-DBUILD_opencv_nonfree=OFF","-DBUILD_opencv_objdetect=OFF","-DBUILD_opencv_photo=OFF","-DBUILD_opencv_stitching=OFF","-DBUILD_opencv_video=OFF","-DBUILD_opencv_videoio=OFF","-DBUILD_opencv_videostab=OFF","-DAPPLE_FRAMEWORK=ON","-DCMAKE_INSTALL_PREFIX=install","-DCMAKE_BUILD_TYPE=Release",]
    return args

此更新还包括两个似乎在2.4.6中不存在的新模块.

为了节省一些额外费用,您可以删除位于文件底部的模拟器版本的i386设置.如果您的应用程序是iOS 9及更高版本,并且您希望省略32位设备,您也可以取出armv7选项.

b = Builder(args.opencv,args.contrib,[
        ("armv7","iPhoneOS"),("armv7s",("arm64",#("i386","iPhoneSimulator"),("x86_64",])
b.build(args.out)

猜你在找的iOS相关文章