Xcode create a openCV c++ project some settting

Create your own c++ opencv xcode project

  1. fire up xcode and create a new xcode project
  2. select Command Line Tool for the type of project under os x
  3. open your project's build settings
  4. under Architectures, set Architecture to 64-bit intel. also set Valid Architectures to x86_64
  5. under Build Options, set Compiler for C/C++ to Default Compiler
  6. under Search Paths, set Header Search Paths to /usr/local/include
  7. also under Search Paths, set Library Search Paths to /usr/local/lib
  8. 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

  1. go the the Build Phases tab next to Build Settings tab you were in
  2. inside Link Binary With Libraries, click on the + sign and choose Add Other
  3. hit the front slash / on your keyboard and enter /usr/local/lib
  4. hit enter and select the libraries you want to use in your project
  5. make sure you always select libopencv_core.2.4.4.dylib
  6. hit enter and you will see the selected dylibs under your project

write some code

  1. first lets organize the files, right click on your project blueprint icon and select New Group
  2. name the new group opencv or whatever
  3. drag the dylibs and drop them in that group
  4. open main.cpp
  5. copy code from any of the sample tests that came with opencv and paste it here
  6. 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
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值