Top > OpenCV > Using OpenCV 2.2 on iOS SDK 4.2

OpenCV/Using OpenCV 2.2 on iOS SDK 4.2

The page describes the method to use OpenCV 2.2 on iOS SDK 4.2.
And, this method use yoshimasa niwa - Using OpenCV on iPhone as a reference.

Getting OpenCV 2.2 source code

Please get "OpenCV-2.2.0.tar.bz2" from Official page.

Getting the build script(maked by niwa)

Please get "" from this page.

Getting the patch file

Please get the following patch file.


This Zip file contains the following patch file.

  • OpenCV-2.2.0.patch --- The patch for OpenCV 2.2
  • niw-iphone_opencv_test-4ab0572.patch --- The patch for build script

Applying the patch

Please extract the following file.

  • OpenCV-2.2.0.tar.bz2

After the extraction, please put the following directory to same hierarchy.

  • OpenCV-2.2.0
  • niw-iphone_opencv_test-4ab0572
  • opencv2.2_for_ios4.2_build_script_20101231

(1)Move to the OpenCV 2.2 directory

% cd OpenCV-2.2.0

(2)Apply the patch to OpenCV 2.2

% patch -p1 < ../opencv2.2_for_ios4.2_build_script_20101231/OpenCV-2.2.0.patch

(3)Move to the build script directory

% cd ../niw-iphone_opencv_test-4ab0572

(4)Apply the patch to the build script

% patch -p1 < ../opencv2.2_for_ios4.2_build_script_20101231/niw-iphone_opencv_test-4ab0572.patch

This will go through the applying the patch.
Please delete "include","lib","share" directory from the following directory.

  • niw-iphone_opencv_test-4ab0572\opencv_simulator
  • niw-iphone_opencv_test-4ab0572\opencv_device


For simulator

(1)Move to the build script directory

% cd ../niw-iphone_opencv_test-4ab0572

(2)Create the build directory(for simulator)

% mkdir build_simulator

(3)Move to the build directory(for simulator)

% cd build_simulator

(4)Do the CMake

% ../ Simulator ../../OpenCV-2.2.0


% make -j 4

(6)Install the library

% make install

For device

(1)Move to the build script directory

% cd ../niw-iphone_opencv_test-4ab0572

(2)Create he build directory(for device)

% mkdir build_device

(3)Move to the build directory(for device)

% cd build_device

(4)Do the CMake

% ../ Device ../../OpenCV-2.2.0


% make -j 4

(6)Install the library

% make install

Sample Program

Please open the niw-iphone_opencv_test-4ab0572\OpenCVTest.xcodeproj using Xcode.

Sample of edge detection

Sample of face detection

Attach file: filesample_app_face_detect_20101231.png 468 download [Information] filesample_app_edge_detect_20101231.png 481 download [Information]

Reload   New Lower page making Edit Freeze Diff Upload Copy Rename   Front page List of pages Search Recent changes Backup Referer   Help   RSS of recent changes
Last-modified: (1276d)