http://blog.csdn.net/wdkirchhoff/article/details/41910553
On Mac OSX, if you want to use OPENCV, you can manually compile the source code by yourself, but more cumbersome.
It is recommended to use homebrew to install, the steps are simple, as follows:
1. Brew Tap Homebrew/science
2. Brew Install OpenCV
Wait a few minutes for the installation to succeed.
Here's how to configure eclipse:
1. Follow the normal steps of using Eclipse to build a Mac C + + project that contains a CPP file.
#include <iostream>#include<opencv2/opencv.hpp>#include<opencv2/highgui/highgui.hpp>#include<opencv/cvaux.hpp>#include<fstream>using namespacestd;#defineBYTE unsigned charintMainintargcConst Char*argv[]) { //Insert code here ...#if1//get the image from the directed pathiplimage* img = cvloadimage ("/users/kirchhoff/twd.png",1); //NSLog (IMG); //Create a window to display the imageCvnamedwindow (" Picture",1); //Show the image in the windowCvshowimage (" Picture", IMG); //Wait for the user to hit a keyCvwaitkey (0); //Delete the image and windowCvreleaseimage (&img); Cvdestroywindow (" Picture");#endif //return return 0;}
2. Right-click on the project name, select "Properties", select it in the property configuration page, click c + + Build, and select Settings from the dropdown options. Select Tool Settings in the tab on the right.
3. Select includes in the GCC C + + Compiler Options list to add the installed OpenCV header file directory in the Include Paths (-L):/usr/local/cellar/opencv/2.4.9/include
4. In the MacOS X c++linker option list, select Library and add the installed OpenCV lib file directory in the library search path (-l):/usr/local/cellar/opencv/2.4.9/ Lib
5. Select the library in the MacOS X c++linker option list, and in libraries (-L), click the "+" sign to add the Lib file you want to use (typically, the first three):
Opencv_core opencv_imgproc Opencv_highgui opencv_ml opencv_video opencv_features2d opencv_calib3d opencv_objdetect Opencv_contrib opencv_legacy Opencv_flann
6. Re-build all project, ~~* ^_^ *
Installing OpenCV on Mac OSX 10.10