OpenCV Example マージモジュール¶
OpenCVのサンプルコンポーネント(ImageProcessingソース)のマージモジュールを作成する手順を示す。
- ソースビルド
- ファイルコピー
- wxsctrlファイルセット
- マージモジュール作成
1.ソースビルド¶
Jenkinsのジョブで32bit、64bitの各バイナリのビルドを行う。
事前に、OpenRTM-aist C++とOpenCVのビルドジョブを実行しておく必要がある。
32bit用ビルド¶
- 対象ノード:windows7-VC2008, windows7-VC2010, windows7-VC2012, windows7-VC2013
- Jenkinsジョブ 00_C++ : openrtm-cxx-opencv-build-win32
64bit用ビルド¶
- 対象ノード:windows7-VC2010-x64, windows7-VC2012-x64, windows7-VC2013-x64
- Jenkinsジョブ 00_C++ : openrtm-cxx-opencv-build-win64
上記のジョブ設定は、trunkのソースを使っている。r170でリリース用のマージモジュールを作成した。
本来ならば tags/RELEASE_1_1_0 を使うべきだが、これがtrunkのソースから作成したもので
バージョンもr171であり、同一ソースと確認できるため、今回のリリースは問題ない。
****** python numpyモジュールの問題(OpenCV2.4.9で確認) ****** ソースビルド時、numpyをインストールしておく必要がある。 (ImageCalibrationComp.exe用のGUIコンポーネントであるpythonのTkCalibGUIをpy2exeで実行ファイル形式に変換する時に必要) しかし、OpenCV2.4.9のソースビルド時は、numpyをインストールしているとエラーになる。 OpenCVのバージョンによっては解決している問題かもしれない。 同じVM環境を利用しているので、ビルドの前にインストール状況の確認が必要である。
2.ファイルコピー¶
インストーラ作成に使うファイルを、ソースビルドした環境からコピーして集める。
- opencv_rtcs\examples\C++\opencv-rtcs というディレクトリを作成し、ここへ以下をコピーする。
- ImageProcessing\opencv\bin 下の rtc.conf, *.dll, *.exe
- ImageProcessing\opencv\bin\dist 下の lib, python27.dll, TkCalibGUIComp.exe
- 作成したトップの opencv_rtcs ディレクトリを、msiファイルを作成する環境の 0work ディレクトリ下へコピーする。
- ソースビルドしているVM環境(Jenkinsノード)からは自分のPCは見えないので、msi作成スクリプトのバックアップ先である
nas(\\nas-openrtp\Public\OpenRTM-aist-1.1.1-installer\0work)経由でコピーしている。
- 0work下には以下のディレクトリがあるので、該当する場所へコピーする
vc9_x86 vc10_x86 vc10_x86_64 vc11_x86 vc11_x86_64 vc12_x86 vc12_x86_64
例)ファイルをコピー後の状態$ ls vc10_x86 ImageProcessing-win32-vc10 opencv_runtime openrtm_runtime opencv_common OpenCV2.4.9 OpenRTM-aist_vc10_x86 opencv_develop openrtm_develop opencv_rtcs openrtm_examples $ tree vc10_x86/opencv_rtcs -L 4 vc10_x86/opencv_rtcs └── examples └── C++ └── opencv-rtcs ├── Affine.dll ├── AffineComp.exe ├── BackGroundSubtractionSimple.dll ├── BackGroundSubtractionSimpleComp.exe : ├── lib ├── python27.dll ├── rtc.conf : ├── TkCalibGUIComp.exe :
3.wxsctrlファイルセット¶
ショートカット用の wxsctrl ファイルディレクトリは2つ用意されていて、0work ディレクトリ下に置いてある。- opencv_rtcs_wxsctrl_vc9_vc10
- opencv_rtcs_wxsctrl_vc11-later
この2つの違いはカメラコンポーネントに関してで、vc10までは DirectShowCam、vc11以降は MFCamera が含まれている。
これらのカメラコンポーネントは共存しないので、vcのバージョンに合わせて利用するショートカットディレクトリを切り替える。
0work ├─ opencv_rtcs_wxsctrl_vc9_vc10 ├─ opencv_rtcs_wxsctrl_vc11-later ├─ vc9_x86 ├─ vc10_x86 ├─ vc10_x86_64 ├─ vc11_x86 ├─ vc11_x86_64 ├─ vc12_x86 ├─ vc12_x86_64
$ tree opencv_rtcs_wxsctrl_vc9_vc10 -L 4 opencv_rtcs_wxsctrl_vc9_vc10 └── examples └── C++ └── opencv-rtcs ├── AffineComp.exe.wxsctrl ├── BackGroundSubstractionSimpleComp.exe.wxsctrl ├── BinarizationComp.exe.wxsctrl ├── CameraViewerComp.exe.wxsctrl ├── ChromekeyComp.exe.wxsctrl ├── DilationErosionComp.exe.wxsctrl ├── DirectShowCamComp.exe.wxsctrl ←★DirectShowCam ├── EdgeComp.exe.wxsctrl ├── FindoconturComp.exe.wxsctrl ├── FlipComp.exe.wxsctrl ├── HistogramComp.exe.wxsctrl ├── HoughComp.exe.wxsctrl ├── ImageCalibrationComp.exe.wxsctrl ├── ImageSubstractionComp.exe.wxsctrl ├── ObjectTrackingComp.exe.wxsctrl ├── OpenCVCameraComp.exe.wxsctrl ├── PerspectiveComp.exe.wxsctrl ├── RockPaperScissorsComp.exe.wxsctrl ├── RotateComp.exe.wxsctrl ├── rtc.conf.wxsctrl ├── ScaleComp.exe.wxsctrl ├── SepiaComp.exe.wxsctrl ├── SubStractCaptureImageComp.exe.wxsctrl ├── TemplateComp.exe.wxsctrl ├── TkCalibGUIComp.exe.wxsctrl └── TranslateComop.exe.wxsctrl
$ tree opencv_rtcs_wxsctrl_vc11-later -L 4 opencv_rtcs_wxsctrl_vc11-later └── examples └── C++ └── opencv-rtcs ├── AffineComp.exe.wxsctrl ├── BackGroundSubstractionSimpleComp.exe.wxsctrl ├── BinarizationComp.exe.wxsctrl ├── CameraViewerComp.exe.wxsctrl ├── ChromekeyComp.exe.wxsctrl ├── DilationErosionComp.exe.wxsctrl ├── EdgeComp.exe.wxsctrl ├── FindoconturComp.exe.wxsctrl ├── FlipComp.exe.wxsctrl ├── HistogramComp.exe.wxsctrl ├── HoughComp.exe.wxsctrl ├── ImageCalibrationComp.exe.wxsctrl ├── ImageSubstractionComp.exe.wxsctrl ├── MFCameraComp.exe.wxsctrl ←★MFCamera ├── ObjectTrackingComp.exe.wxsctrl ├── OpenCVCameraComp.exe.wxsctrl ├── PerspectiveComp.exe.wxsctrl ├── RockPaperScissorsComp.exe.wxsctrl ├── RotateComp.exe.wxsctrl ├── rtc.conf.wxsctrl ├── ScaleComp.exe.wxsctrl ├── SepiaComp.exe.wxsctrl ├── SubStractCaptureImageComp.exe.wxsctrl ├── TemplateComp.exe.wxsctrl ├── TkCalibGUIComp.exe.wxsctrl └── TranslateComop.exe.wxsctrl
これらのwxsctrlファイルのコピーは現時点でスクリプト化していないので、手動でコピーする。
opencv_rtcs_wxsctrl_vc9_vc10\examples を 0work\vc9_x86\opencv_rtcs\examples へ上書きコピーする、など。
4.マージモジュール作成¶
マージモジュールを作成するスクリプトも、現時点で以下に置いてあるので、自分の環境へコピーして利用している。
\\nas-openrtp\Public\OpenRTM-aist-1.1.1-installer ├── 0work ├── MergeModules ├── Msi ├── omniORB_msm ├── opencv_example_msm ├── opencv_msm ├── openrtm_msm ├── OpenRTM-aist_msi ├── openrtp_msm_eclipse3.8 ├── scripts ├── EPLv1.rtf ├── GPLv2.rtf ├── LGPLv2.1.rtf ├── LicenseAll.rtf ├── OpenCV.rtf └── OpenRTM.rtf
マージモジュールを作成するディレクトリは、opencv_example_msm である。
マージモジュールを一括生成する build_msm_all.bat スクリプトを実行する。
> type build_msm_all.bat call build_msm_x86_vc9.bat call build_msm_x86_vc10.bat call build_msm_x86_vc11.bat call build_msm_x86_vc12.bat call build_msm_x86_64_vc10.bat call build_msm_x86_64_vc11.bat call build_msm_x86_64_vc12.bat > build_msm_all.bat
正常終了すると、MergeModules 下にmsmファイルが生成される
> cd MergeModules > ls opencv_example111_runtime_x86_64_vc10.msm opencv_example111_runtime_x86_64_vc11.msm opencv_example111_runtime_x86_64_vc12.msm opencv_example111_runtime_x86_vc10.msm opencv_example111_runtime_x86_vc11.msm opencv_example111_runtime_x86_vc12.msm opencv_example111_runtime_x86_vc9.msm