若是想要在ios下编译opencv 须要安装Cmake 这里经过homebrew 来安装cmakehtml
ios下打开终端而后先安装 homebrew :(mac 下自带ruby)python
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
下面是官网的编译步骤,照着编译,如今是能够正常成功编译的。
不过须要时间或许有点长。
官网编译:
----------------------------------------------------------
Make symbolic link for Xcode to let OpenCV build scripts find the compiler, header files etc.ios
cd / sudo ln -s /Applications/Xcode.app/Contents/Developer Developer
Build OpenCV framework:git
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.github
================================================xcode
编译完成以后进入opencv目录能够找到 ios 目录ruby
ios目录下会有编译好的opencv 动态库 opencv2.frameworkbash
还有一个 build 目录 在build目录下是针对各个cpu 架构编译的静态库:架构
build-arm64-iphoneosapp
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