我想在iOS上安装OpenCV,但不是所有模块,只是少数。
我怎样才能做到这一点?是否有一个参数我可以传递给build_framework.py脚本,允许我这样做?
我关注了OpenCV tutorial,但对此没有任何说明。
答案 0 :(得分:4)
从v2.4.6开始,OpenCV有一个自定义的python脚本来简化工作 (plateforms> ios> build_framework.py)
您只需在cmake行添加标志即可进行自定义编译。
例如:我只需要lib imgproc并将所有标题包含在存档中,我的cmake现在重新解析这个:
cmakeargs = ("-GXcode " +
"-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") % (srcroot, target)
不要忘记添加核心和世界库,因为它们是强制性的。 执行python脚本> profite。
之后,手动将lib添加到项目中,并删除标题中留下的讨厌的导入标题> opencv.hpp,你应该好好去!