如果想要在ios下編譯opencv 需要安裝Cmake 這里通過homebrew 來安裝cmake
ios下打開終端然后先安裝 homebrew :(mac 下自帶ruby)
ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
然后安裝Cmake:
brew install cmake
裝好cmake之后就可以使用git 下載opencv 源碼了具體操作如下:
git clone https://github.com/Itseez/opencv.git
下面是官網的編譯步驟,照着編譯,現在是可以正常成功編譯的。
不過需要時間或許有點長。
官網編譯:
----------------------------------------------------------
Building OpenCV from Source, using CMake and Command Line
-
Make symbolic link for Xcode to let OpenCV build scripts find the compiler, header files etc.
cd / sudo ln -s /Applications/Xcode.app/Contents/Developer Developer
-
Build OpenCV framework:
cd ~/<my_working_directory> python opencv/platforms/ios/build_framework.py ios
If everything’s fine, a few minutes later you will get ~/<my_working_directory>/ios/opencv2.framework. You can add this framework to your Xcode projects.
================================================
編譯完成之后進入opencv目錄可以找到 ios 目錄
ios目錄下會有編譯好的opencv 動態庫 opencv2.framework
還有一個 build 目錄 在build目錄下是針對各個cpu 架構編譯的靜態庫:
build-arm64-iphoneos
build-armv7-iphoneos
build-armv7s-iphoneos
build-i386-iphonesimulator
build-x86_64-iphonesimulator
---------------------------------------
我是直接編譯的arm64目錄下的靜態庫 進入arm64目錄
可以用xcode 打開OpenCV.xcodeproj 直接使用xcode編譯opencv針對arm64的靜態庫
編譯成功之后可以在該目錄下 install 目錄中找到 相應的靜態庫 和頭文件
lib和include 是直接就可以導入xcode工程中直接使用的。
貌似opencv的編譯使用也不是太復雜。
--------------------------------------------------------------------------
參考:http://www.cnblogs.com/tonyspotlight/p/4568305.html