1: Install Homebrew and CMake
ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
Brew Install Cmake2: Installs Opencvbrew tap homebrew/sciencebrew install OPENCV3. Using Xcode for OPENCV project development
1.Open Xcode, chooseNew -> New Project -> Command Line Tool
2.Name it and select for C++
type
3.Click on your project from the left menu. Click the
build settings
tab from the top. Filter all. Scroll to
Search Paths
. Under
header search paths
, for debug and release,set the path to
/usr/local/include
. Under
library search paths
, set the Pathto
$(PROJECT_DIR)
. Finally, check if
C++ standard library
Is
libc++(Xcode默认的就是这个
)
Or not,if not, change it to This!ps: some versions of Xcode and OPENCV need to be libstdc++, please test which one is right for you. 4.Click on your project from the left menu.
File->New->New Group
, Name the group
OpenCV Frameworks
. 5.Select the folder (group) you just labeled,
OpenCV Frameworks
In the left menu. Go to
File -> add Files
, Type SHIFT + command +g, which to manually go to a folder. Go to
/usr/local/lib
6.Select both of these files,
libopencv_core.dylib
,
libopencv_highgui.dylib
, and click
Add
. (You could need to add the library files from the This folder to run other code.) 7.You must include this line of code in the beginning of your main.cpp file:
#include <opencv2/opencv.hpp>
can modify the main.cpp, the code is as follows, the result is to display a specified picture
#include <opencv2/opencv.hpp> usingnamespace cv; intMain(intargc,Char
** argv){ Matimage; Image
= Imread("/users/hujiawei/pictures/others/other_naicha/naicha.jpg",1 namedwindow ( " Display Image " window_autosize imshow ( " Display Image " image waitkey ( 0 return0; }
Mac OpenCV (2.4.9) configuration Xcode (4.6.1)