在Mac OSX 10.10 上安装opencv
http://blog.csdn.net/wdkirchhoff/article/details/41910553
在Mac OSX上如果想使用OpenCV,可以通过自己手动编译源码的方式,但比较繁琐。
推荐使用Homebrew来进行安装,步骤很简单,如下:
1、brew tap homebrew/science
2、brew install opencv
等待几分钟,即可安装成功。
下面是配置eclipse:
#include <iostream> #include <opencv2/opencv.hpp> #include <opencv2/highgui/highgui.hpp> #include <opencv/cvaux.hpp> #include <fstream> using namespace std; #define BYTE unsigned char int main(int argc, const char * argv[]) { // insert code here... #if 1 //get the image from the directed path IplImage* img = cvLoadImage("/Users/kirchhoff/twd.png", 1); //NSLog(img); //create a window to display the image cvNamedWindow("picture", 1); //show the image in the window cvShowImage("picture", img); //wait for the user to hit a key cvWaitKey(0); //delete the image and window cvReleaseImage(&img); cvDestroyWindow("picture"); #endif //return return 0; }
2. 右击工程名, 选择“Properties”,在属性配置页中选择,点击C/C++ Build, 在下拉选项中选择 Settings. 在右边的选项卡中选择 Tool Settings。
3. 在GCC C++ Compiler选项列表中选择Includes,在Include paths(-l)中添加安装好的opencv的头文件存放目录:/usr/local/Cellar/opencv/2.4.9/include
4. 在MacOS X C++Linker选项列表中选择Library,在Library search path (-L)中添加安装好的opencv Lib文件存放目录:/usr/local/Cellar/opencv/2.4.9/lib
5. 在MacOS X C++Linker选项列表中选择Library, 在Libraries(-l) 中依次点击“+”号,添加需要使用的Lib文件(通常情况下,使用前三个):
opencv_core opencv_imgproc opencv_highgui opencv_ml opencv_video opencv_features2d opencv_calib3d opencv_objdetect opencv_contrib opencv_legacy opencv_flann
6. 重新build all工程,大功告成~~*^_^*
郑重声明:本站内容如果来自互联网及其他传播媒体,其版权均属原媒体及文章作者所有。转载目的在于传递更多信息及用于网络分享,并不代表本站赞同其观点和对其真实性负责,也不构成任何其他建议。