2014-06-10 83 views
3

我想在iOS上安裝OpenCV,但不是所有的模塊,只有少數。安裝特定庫OpenCV iOS

我該如何做到這一點?是否有一個參數可以傳遞給build_framework.py腳本,允許我這樣做?

我跟着OpenCV tutorial但它沒有說這個。

回答

4

由於v2.4.6的OpenCV有一個自定義Python腳本緩解工作 (plateforms> IOS> build_framework.py)

你只需要在cmake的行添加標誌,以使自定義編譯。

例如:我只需要的lib imgproc,幷包括所有的頭到存檔,我現在的CMake這ressembles:

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) 

不要忘記補充核心和世界LIB爲他們是強制性的。 執行python腳本> profite。

之後,手動將lib添加到您的項目中,並刪除標題> opencv.hpp中留下的麻煩的導入標題,您應該很好去!

+1

如何在cmake行添加標誌? –