Setting up OpenCV for Xcode + iPhone

** This post will be updated as I progress **
*** This will be updated when I’ve actually got an application to the point where OpenCV is necessary. It currently links and builds fine but I haven’t tested it so I’m loathe to update these instructions until I have. ***

CMake

You need this to compile the newer versions of OpenCV.  Download it here:

http://www.cmake.org/cmake/resources/software.html

Extract and simply run ./configure.  In snow leopard this works and boot straps cmake.  I then simply ran:


Paul-Downss-MacBook-Pro:Programming diziet$ cd cmake-2.8.2/
Paul-Downss-MacBook-Pro:cmake-2.8.2 diziet$ ./configure
Paul-Downss-MacBook-Pro:cmake-2.8.2 diziet$ make && sudo make install

I did this as I don’t mind cmake installing into /usr/local/.

OpenCV

This is the doozy.  I believe that in order for this to work under the iPhone I need it built as a static library with as much as possible turned off  or built as a framework.  I have no idea how to do this and the online docs are out of date with the current cmake based build process.  Here goes…

I bet you’re glad you can’t see all the mistakes. I had to give up on getting the 2.1+ versions of opencv to compile. The CMake process, despite spitting out an XCode project, just would not happily cross compile and threw up countless QTKit/QuickTime framework and other errors involving carbon and all sorts.

So this is stealing some scripts etc. from:

http://niw.at/articles/2009/03/14/using-opencv-on-iphone/en

and adapting it to work with the latest iPhone dev and xcode. I hope using 2.0 opencv means I don’t have to change too much of my old code. In other words, you don’t need the CMake utility mentioned above any more.

This entry was posted in Programming and tagged , , , , . Bookmark the permalink.