iOS之 opencv3.0.framework
本文章的目的是从源代码包中编译出opencv2.framework供IOS开发使用。
基本上是按照http://docs.opencv.org/3.0-beta/doc/tutorials/introduction/ios_install/ios_install.html的提示进行安装,但是完全按照上述提示安装是会报错的,无法编译成功。
~编译前提:
- CMake 2.8.8 or higher
- Xcode 4.2 or higher
1、第一步: 当然是从网站上下载opencv源代码:
下载方法一、从 http://opencv.org/downloads.html 下载
下载方法二、使用 git clone git://github.com/Itseez/opencv.git 进行下载。
在本次安装过程中,没有使用第一种方法,而是直接采用第二种方法
cd ~/<my_working _directory> git clone https://github.com/Itseez/opencv.git
下载之后得到的是最新版本
2、第二步:为XCode进行符号链接,以备后续查找opencv的头文件等内容:
cd /
sudo ln -s /Applications/Xcode.app/Contents/Developer Developer
第三步:编译OpenCV框架(framework)
cd ~/<my_working_directory>
python opencv/platforms/ios/build_framework.py ios
即可成功编译,最后在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.
失败才是你成功的关键