(1) Install Homebrew: (Requires ruby)
Note: Because snow leopard has come with Ruby since then, all of them can not install Ruby on their own.
Take a look at Homebrew's official website: http://mxcl.github.com/homebrew/Enter, you can see the installation method, you just enter in the terminal (terminal):
ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
Note: Do not add sudo in front otherwise there will be error, but nothing, and then enter the correct one.
(2) Update homebrew, enter in Terminal: brew update and then enter, you can
(Brew SelfUpdate No, Official document first update the formulae and Homebrew itself:brew update)
Some operations: HTTPS://GITHUB.COM/HOMEBREW/HOMEBREW/BLOB/MASTER/SHARE/DOC/HOMEBREW/FAQ.MD
(3) Install CMake, enter in Terminal: Brew Install CMake and then enter, you can
(4) Install OPENCV, enter in Terminal: Brew Install OPENCV and then enter, you can
(5) Waiting for its installation to complete (very long time, the CPU runs at full speed when compiling), so OPENCV has been installed on the MacBook
Following: Wang Hao-lin: http://www.zhihu.com/question/20116487/answer/19970531 Source: Know
After installing the OpenCV, the/usr/local/include should be able to see Opencv2 folder, under the/usr/local/lib can see a lot of libopencv****.dylib, which indicates that the installation has been successful. (6) Manually drag the OpenCV dynamic library into the project:
Create a newgroup under your project in Xcode (method: Right-click your project (upper left, blue one) and then tap "New Group")
Then, open your Finder (the one on the bottom of your Mac that looks like a face) and then you hold down SHIFT Command G at the same time, and then you'll pop up a dialog box where you type "/usr/local" and enter, It goes to the local folder, and then you follow the following search: Cellar-->opencv-->2.4.3-->lib you are now in the Lib folder, you will see a lot of "dylib" end of the file, these are "dynamic library", Then you find the following three dynamic libraries: Libopencv_core.2.4.3.dylib libopencv_highgui.2.4.3.dylib Libopencv_ml.2.4.3.dylib
Select them (press and hold the command to create multiple selections) and drag them directly to the NewGroup folder you just built in Xcode, and then Xcode will pop up a dialog box, note, do not tick "Copy items into destination group." s folder (if needed) ", then click" Finish "
(7) Add Lib file lookup support: Click the project name file, go to the "Build Settings" tab, and enter "/usr/local/lib/**" in the "Library Search Paths" field.
(8) Add header file: Click on the project name file, enter the "Build Settings" tab and enter "/usr/local/include" in the "header Search Paths" field:
(You can't see the header Search paths, the basic and all option in the bottom left of build settings Kari all to see)
(9) Then add #include <opencv2/opencv.hpp> within the. cpp file. Reference Link: http://blog.csdn.net/china_lzn/article/details/8363660http://blog.csdn.net/star_liux/article/details/ 8975862http://www.zhihu.com/question/20116487http://tieba.baidu.com/p/3492521942
Configure the OpenCV steps on your Mac