我正在尝试为iOS编译OpenCV 3.1.0,但我只需要使用并编译所有可用库(imgProc)的子集。我尝试通过将以下内容添加到getCMakeArgs
(https://github.com/Itseez/opencv/blob/master/platforms/ios/build_framework.py#L99)来编辑python构建脚本:
"-D BUILD_SHARED_LIBS=OFF ",
"-D BUILD_opencv_core=ON ",
"-D BUILD_opencv_imgproc=ON ",
"-D BUILD_opencv_world=ON ",
"-D BUILD_opencv_gpu=OFF ",
"-D BUILD_opencv_calib3d=OFF ",
"-D BUILD_opencv_contrib=OFF ",
"-D BUILD_opencv_features2D=OFF ",
"-D BUILD_opencv_flann=OFF ",
"-D BUILD_opencv_highgui=OFF ",
"-D BUILD_opencv_legacy=OFF ",
"-D BUILD_opencv_ml=OFF ",
"-D BUILD_opencv_nonfree=OFF ",
"-D BUILD_opencv_objdetect=OFF ",
"-D BUILD_opencv_photo=OFF ",
"-D BUILD_opencv_stitching=OFF ",
"-D BUILD_opencv_video=OFF ",
"-D BUILD_opencv_videostab=OFF ",
"-DCMAKE_BUILD_TYPE=Release ",
"-DCMAKE_TOOLCHAIN_FILE=%s/platforms/ios/cmake/Toolchains/Toolchain-%s_Xcode.cmake " ,
"-DCMAKE_INSTALL_PREFIX=install”
但它总是编译整个事情,包括我不需要的所有库,使二进制文件的大小非常大(所有支持的体系结构都是150MB)。
有没有人对我应该寻找的东西有任何指示?
谢谢!
答案 0 :(得分:1)
您需要使用此表示法
"-DBUILD_opencv_core=ON ",
代替
"-D BUILD_opencv_core=ON ",
答案 1 :(得分:0)
要更新此问题,现在build_framework.py
中有一个参数python OpenCV/platforms/ios/build_framework.py \
--without gpu \
--without calib3d \
--without contrib \
--without features2D \
--without flann \
--without highgui \
--without legacy \
--without ml \
--without nonfree \
--without objdetect \
--without photo \
--without stitching \
--without video \
--without videostab \
output-path
可以从构建中排除模块。
问题中的列表将转换为:
python
一点点补充:我在我的路径中偶然发现which python
是Python 3.这导致了错误:不能在类字节对象上使用字符串模式"。 find({ } , {fields: { nameid : 0 }})
有助于澄清这一点。