gonzojive

Archive for November, 2010|Monthly archive page

Cross-compiling OpenCV for iPhone

In Uncategorized on November 24, 2010 at 9:33 pm

If you are here just to cross-compile OpenCV, follow these simple instructions.  The older post is a little more detailed, error-prone, pedantic, and maybe out of date.

If you want to cross-compile OpenCV from source code, you can do by next steps.

  1. Building OpenCV 2.1 requiers CMake. You can easily install it by using MacPorts, or follow the installation instructions at the CMake website.
    % sudo port install cmake
    
  2. Clone this project from github, then move into the project directory
    % git clone git://github.com/gonzojive/iphone_opencv_test.git
    % cd iphone_opencv_test
    
  3. Download the source code for OpenCV from Sourceforge. Save OpenCV-2.1.0.tar.bz2 into the project root.
  4. Use the provided Makefile:
    % make
    

This will extract the downloaded archive, apply a patch to the OpenCV code, generate appropriate cmakefile suport using the opencv_cmake.sh script, and finally make the static libraries for simulator and device.  The libraries will be in the opencv_{device,simulator} directories, and may be linked in XCode etc.

Advertisements