- 追加された行はこの色です。
- 削除された行はこの色です。
#multilang(ja){{
*OpenCV/Using OpenCV 2.2 on iOS SDK 4.2
このページは[[yoshimasa niwa - iPhoneでOpenCVを使う方法:http://niw.at/articles/2009/03/14/using-opencv-on-iphone/ja]]で紹介されている&br;OpenCV 2.1用のビルドスクリプトをOpenCV 2.2で使うための方法を記載しています.
**OpenCV 2.2取得
[[公式サイト:http://sourceforge.net/projects/opencvlibrary/files/opencv-unix/2.2/]]からOpenCV-2.2.0.tar.bz2をダウンロードします.
**ビルドスクリプト取得
[[このページ:https://github.com/niw/iphone_opencv_test/commit/4ab0572d48a07f2401a15ca4c894c169983ae0fd]]の「Downloads」ボタンを押して,&br;
niw-iphone_opencv_test-4ab0572.zipをダウンロードします.
**パッチファイル取得
下記のパッチファイルをダウンロードします.&br;
|Filename|Size|Date|Type|Download|
|BGCOLOR(white):opencv2.2_for_ios4.2_build_script_20101231.zip|BGCOLOR(white):5.07kb|BGCOLOR(white):20101231|BGCOLOR(white):Zip|BGCOLOR(white):[[http://www.atinfinity.info/img/download.gif:http://www.atinfinity.info/opencv/patch/opencv2.2_for_ios4.2_build_script_20101231.zip]]|
このzipに格納されているファイルの内容は以下の通りです.
-OpenCV-2.2.0.patch --- OpenCV 2.2に適用するパッチ
-niw-iphone_opencv_test-4ab0572.patch --- ビルドスクリプトに適用するパッチ
**パッチの適用
下記の3ファイルを展開します.
-OpenCV-2.2.0.tar.bz2
-niw-iphone_opencv_test-4ab0572.zip
-opencv2.2_for_ios4.2_build_script_20101231.zip
展開後,下記のフォルダを同一階層に配置します.
-OpenCV-2.2.0
-niw-iphone_opencv_test-4ab0572
-opencv2.2_for_ios4.2_build_script_20101231
(1)OpenCV 2.2のディレクトリに移動
% cd OpenCV-2.2.0
(2)OpenCV 2.2にパッチを適用
% patch -p1 < ../opencv2.2_for_ios4.2_build_script_20101231/OpenCV-2.2.0.patch
(3)ビルドスクリプトのディレクトリに移動
% cd ../niw-iphone_opencv_test-4ab0572
(4)ビルドスクリプトにパッチを適用
% patch -p1 < ../opencv2.2_for_ios4.2_build_script_20101231/niw-iphone_opencv_test-4ab0572.patch
ここまででパッチの適用が完了です.&br;
そして,niw-iphone_opencv_test-4ab0572にある
-opencv_simulator
-opencv_device
ディレクトリ中にあるinclude,lib,shareディレクトリを削除しておきます.&br;
(※OpenCV 2.1用のライブラリとヘッダが格納されているため)
**ビルド
***シミュレータ
(1)ビルドスクリプトのディレクトリに移動
% cd ../niw-iphone_opencv_test-4ab0572
(2)ビルド用ディレクトリ(シミュレータ用)作成
% mkdir build_simulator
(3)ビルド用ディレクトリ(シミュレータ用)に移動
% cd build_simulator
(4)CMake実行
% ../opencv_cmake.sh Simulator ../../OpenCV-2.2.0
(5)ビルド
% make -j 4
(6)インストール
% make install
***デバイス [#z6fc8ce8]
(1)ビルドスクリプトのディレクトリに移動
% cd ../niw-iphone_opencv_test-4ab0572
(2)ビルド用ディレクトリ(デバイス用)作成
% mkdir build_device
(3)ビルド用ディレクトリ(デバイス用)に移動
% cd build_device
(4)CMake実行
% ../opencv_cmake.sh Device ../../OpenCV-2.2.0
(5)ビルド
% make -j 4
(6)インストール
% make install
**サンプルプログラム [#tc28e35c]
niw-iphone_opencv_test-4ab0572\OpenCVTest.xcodeprojを&br;
Xcodeで開き,ビルドしてください.
|CENTER:&ref(sample_app_edge_detect_20101231.png);|
|CENTER:エッジ検出のデモ|
&br;
|CENTER:&ref(sample_app_face_detect_20101231.png);|
|CENTER:顔検出のデモ|
}}
#multilang(en){{
*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.&br;
And, this method use [[yoshimasa niwa - Using OpenCV on iPhone:http://niw.at/articles/2009/03/14/using-opencv-on-iphone/en]] as a reference.
**Getting OpenCV 2.2 source code
Please get "OpenCV-2.2.0.tar.bz2" from [[Official page:http://sourceforge.net/projects/opencvlibrary/files/opencv-unix/2.2/]].
**Getting the build script(maked by niwa)
Please get "niw-iphone_opencv_test-4ab0572.zip" from [[this page:https://github.com/niw/iphone_opencv_test/commit/4ab0572d48a07f2401a15ca4c894c169983ae0fd]].
**Getting the patch file
Please get the following patch file.&br;
|Filename|Size|Date|Type|Download|
|BGCOLOR(white):opencv2.2_for_ios4.2_build_script_20101231.zip|BGCOLOR(white):5.07kb|BGCOLOR(white):20101231|BGCOLOR(white):Zip|BGCOLOR(white):[[http://www.atinfinity.info/img/download.gif:http://www.atinfinity.info/opencv/patch/opencv2.2_for_ios4.2_build_script_20101231.zip]]|
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
-niw-iphone_opencv_test-4ab0572.zip
-opencv2.2_for_ios4.2_build_script_20101231.zip
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.&br;
Please delete "include","lib","share" directory from the following directory.&br;
-niw-iphone_opencv_test-4ab0572\opencv_simulator
-niw-iphone_opencv_test-4ab0572\opencv_device
**Build
***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
% ../opencv_cmake.sh Simulator ../../OpenCV-2.2.0
(5)Build
% 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
% ../opencv_cmake.sh Device ../../OpenCV-2.2.0
(5)Build
% make -j 4
(6)Install the library
% make install
**Sample Program
Please open the niw-iphone_opencv_test-4ab0572\OpenCVTest.xcodeproj using Xcode.
|CENTER:&ref(sample_app_edge_detect_20101231.png);|
|CENTER:Sample of edge detection|
&br;
|CENTER:&ref(sample_app_face_detect_20101231.png);|
|CENTER:Sample of face detection|
}}