Archive

Posts Tagged ‘Xcode’

Opencv Test on Xcode

April 19, 2012 1 comment

I pre-installed opencv (2.3.1) for python binding, but haven’t tried it out in Xcode. Here’s what I found that works on my Mac. I am using Xcode4.3, Mac Lion 10.7.3.

Just to clarify, I almost followed this link, which turns out working well for the example code.

– Make a new project and choose “Command Line Tool”, choose C++ as the type for the project. Xcode will automatically generate a main.cpp for you.

– Go to project setting, select all, among which search the “Header search path”, and add “/opt/local/include”

– Create a folder for your ‘framework’ on the left panel,  let’s say, name it as “opencv-Frameworks”, and right click it use “Add files to..”. You will going to add three files which are located at </opt/local/lib>. They are: libopencv_ml.2.3.1.dylib, libopencv_highgui.2.3.1.dylib, libopencv_core.2.3.1.dylib

– You don’t have to copy those items, but just an option 🙂

– Now, copy the demo code in the above link to your main.cpp, click build+run, you should see a pop up window like this:

– You can find a completed working project here.

Categories: MacOS, OpenCV Tags: ,