Create your own c++ opencv xcode project
- fire up xcode and create a new xcode project
- select Command Line Tool for the type of project under os x
- open your project's build settings
- under Architectures, set Architecture to 64-bit intel. also set Valid Architectures to x86_64
- under Build Options, set Compiler for C/C++ to Default Compiler
- under Search Paths, set Header Search Paths to /usr/local/include
- also under Search Paths, set Library Search Paths to /usr/local/lib
- under Apple LLVM compiler 4.2 - Language set C++ Standard Library to libstd++ (For OpenCV 2.4.6, Xcode 5, LLVM 5.0, and 10.8.5, set both language dialect and std library to "Compiler Default" instead of "libstd++")
Add the compiled opencv libraries to your project
- go the the Build Phases tab next to Build Settings tab you were in
- inside Link Binary With Libraries, click on the + sign and choose Add Other
- hit the front slash / on your keyboard and enter /usr/local/lib
- hit enter and select the libraries you want to use in your project
- make sure you always select libopencv_core.2.4.4.dylib
- hit enter and you will see the selected dylibs under your project
write some code
- first lets organize the files, right click on your project blueprint icon and select New Group
- name the new group opencv or whatever
- drag the dylibs and drop them in that group
- open main.cpp
- copy code from any of the sample tests that came with opencv and paste it here
- make sure all the required dylibs are added, for example, if you copied the opencv_test_stitching.cpp code into main.cpp, you will need to add the following libraries in the previous stepslibopencv_core.2.4.4.dyliblibopencv_highgui.2.4.4.dyliblibopencv_stitching.2.4.4.dylib