OpenCV3.1
2015年12月21日にOpenCV3.1がリリースされたので導入してみた
変更点
-
Google Summer of Code 2015で追加されたものが多数
- “Omnidirectional Cameras Calibration and Stereo 3D Reconstruction” – opencv_contrib/ccalib module (Baisheng Lai, Bo Li)
- “Structure From Motion” – opencv_contrib/sfm module (Edgar Riba, Vincent Rabaud)
- “Improved Deformable Part-based Models” – opencv_contrib/dpm module (Jiaolong Xu, Bence Magyar)
- “Real-time Multi-object Tracking using Kernelized Correlation Filter” – opencv_contrib/tracking module (Laksono Kurnianggoro, Fernando J. Iglesias Garcia)
- “Improved and expanded Scene Text Detection” – opencv_contrib/text module (Lluis Gomez, Vadim Pisarevsky)
- “Stereo correspondence improvements” – opencv_contrib/stereo module (Mircea Paul Muresan, Sergei Nosov)
- “Structured-Light System Calibration” – opencv_contrib/structured_light (Roberta Ravanelli, Delia Passalacqua, Stefano Fabri, Claudia Rapuano)
- “Chessboard+ArUco for camera calibration” – opencv_contrib/aruco (Sergio Garrido, Prasanna, Gary Bradski)
- “Implementation of universal interface for deep neural network frameworks” – opencv_contrib/dnn module (Vitaliy Lyudvichenko, Anatoly Baksheev)
- “Recent advances in edge-aware filtering, improved SGBM stereo algorithm” – opencv/calib3d and opencv_contrib/ximgproc (Alexander Bokov, Maksim Shabunin)
- “Improved ICF detector, waldboost implementation” – opencv_contrib/xobjdetect (Vlad Shakhuro, Alexander Bovyrin)
- “Multi-target TLD tracking” – opencv_contrib/tracking module (Vladimir Tyan, Antonella Cascitelli)
- “3D pose estimation using CNNs” – opencv_contrib/cnn_3dobj (Yida Wang, Manuele Tamburrano, Stefano Fabri)
-
その他
- HDF5 フォーマットサポート
- オプティカルフローの改善
- filtering, segmentation and feature detectionなどの新しい画像処理アルゴリズム
- Superpixel segmentation
-
IPP 9.0.1に基づくIPPICV
-
opencv_contrib modulesがopencv2.framework for iOSに含まれる
-
Windows 10 and OSX 10.11 (Visual Studio 2015 and XCode 7.1.1)に対応
-
Interoperability between T-API and OpenCL, OpenGL, DirectX and Video Acceleration API on Linux, as well as Android 5 camera.
-
HAL (Hardware Acceleration Layer) module の移動
システム環境
- Windows 8.1
- Visual Studio 2013
- CMake 3.2
インストール手順
- opencv-3.1.0.exeをダウンロード、実行する。C:/の下に解凍し、opencvからopencv310に名前を変更する
- モジュール(opencv_contrib-master.zip)のダウンロードと解凍。Cの直下に置いた。
中のmodulesフォルダをC:\opencv310\sources\modulesにコピペする - CMakeを起動する。Where is the source code: C:/opencv310/sources、Where to build the binaries: C:/opencv310/buildを指定。
- OPENCVのOPENCV_EXTRA_MODULES_PATHにC:/opencv_contrib-master/modulesを指定。
- Configure(コンパイラはVisual Studio 2013)する。Generateすると、buildフォルダの中にOpenCV.slnが生成される。
- Visual Studio 2013でOpenCV.slnを開き、debugとreleaseのそれぞれビルドすればbinとlibが生成される。bin\Debugとbin\Releaseの中身をbin\に移した。同様に、lib\Debugとlib\Releaseの中身をlib\に移した。
- C:\opencv310\build\include\opencv2に
modules->モジュール名->include->opencv2の中身をコピーする(※1) - build\includeにopencv_lib.hppを作成(※2)
- システム環境パスの設定と再起動(※3)
- プログラム作成(インクルード、リンカの設定を忘れずに※4)
※1 モジュール
aruco
aruco.hpp
bgsegm.hpp
ccalib
ccalib.hpp
cnn_3dobj.hpp
cnn_3dobj_config.hpp
contrib_world.hpp
cudaarithm.hpp
cudabgsegm.hpp
cudacodec.hpp
cudafeatures2d.hpp
cudafilters.hpp
cudaimgproc.hpp
cudalegacy
cudalegacy.hpp
cudaobjdetect.hpp
cudaoptflow.hpp
cudastereo.hpp
cudawarping.hpp
cudev
cudev.hpp
cvv
cvv.hpp
datasets
dnn
dnn.hpp
dpm.hpp
face
face.hpp
fuzzy
fuzzy.hpp
hdf
hdf.hpp
line_descriptor
line_descriptor.hpp
matlab
optflow
optflow.hpp
plot.hpp
reg
rgbd
rgbd.hpp
saliency
saliency.hpp
sfm
sfm.hpp
stereo
stereo.hpp
structured_light
structured_light.hpp
surface_matching
surface_matching.hpp
text
text.hpp
tracking
tracking.hpp
ts
ts.hpp
viz
viz.hpp
xfeatures2d
xfeatures2d.hpp
xobjdetect.hpp
xphoto
xphoto.hpp
## ※2 opencv_lib.hpp
// バージョン取得
#define CV_VERSION_STR CVAUX_STR(CV_MAJOR_VERSION) CVAUX_STR(CV_MINOR_VERSION) CVAUX_STR(CV_SUBMINOR_VERSION)
// ビルドモード
#ifdef _DEBUG
#define CV_EXT_STR "d.lib"
#else
#define CV_EXT_STR ".lib"
#endif
#pragma comment(lib, "opencv_aruco" CV_VERSION_STR CV_EXT_STR)
#pragma comment(lib, "opencv_bgsegm" CV_VERSION_STR CV_EXT_STR)
#pragma comment(lib, "opencv_bioinspired" CV_VERSION_STR CV_EXT_STR)
#pragma comment(lib, "opencv_calib3d" CV_VERSION_STR CV_EXT_STR)
#pragma comment(lib, "opencv_ccalib" CV_VERSION_STR CV_EXT_STR)
#pragma comment(lib, "opencv_core" CV_VERSION_STR CV_EXT_STR)
#pragma comment(lib, "opencv_datasets" CV_VERSION_STR CV_EXT_STR)
#pragma comment(lib, "opencv_dnn" CV_VERSION_STR CV_EXT_STR)
#pragma comment(lib, "opencv_dpm" CV_VERSION_STR CV_EXT_STR)
#pragma comment(lib, "opencv_face" CV_VERSION_STR CV_EXT_STR)
#pragma comment(lib, "opencv_features2d" CV_VERSION_STR CV_EXT_STR)
#pragma comment(lib, "opencv_flann" CV_VERSION_STR CV_EXT_STR)
#pragma comment(lib, "opencv_fuzzy" CV_VERSION_STR CV_EXT_STR)
#pragma comment(lib, "opencv_highgui" CV_VERSION_STR CV_EXT_STR)
#pragma comment(lib, "opencv_imgcodecs" CV_VERSION_STR CV_EXT_STR)
#pragma comment(lib, "opencv_imgproc" CV_VERSION_STR CV_EXT_STR)
#pragma comment(lib, "opencv_line_descriptor" CV_VERSION_STR CV_EXT_STR)
#pragma comment(lib, "opencv_ml" CV_VERSION_STR CV_EXT_STR)
#pragma comment(lib, "opencv_objdetect" CV_VERSION_STR CV_EXT_STR)
#pragma comment(lib, "opencv_optflow" CV_VERSION_STR CV_EXT_STR)
#pragma comment(lib, "opencv_photo" CV_VERSION_STR CV_EXT_STR)
#pragma comment(lib, "opencv_plot" CV_VERSION_STR CV_EXT_STR)
#pragma comment(lib, "opencv_reg" CV_VERSION_STR CV_EXT_STR)
#pragma comment(lib, "opencv_rgbd" CV_VERSION_STR CV_EXT_STR)
#pragma comment(lib, "opencv_saliency" CV_VERSION_STR CV_EXT_STR)
#pragma comment(lib, "opencv_shape" CV_VERSION_STR CV_EXT_STR)
#pragma comment(lib, "opencv_stereo" CV_VERSION_STR CV_EXT_STR)
#pragma comment(lib, "opencv_stitching" CV_VERSION_STR CV_EXT_STR)
#pragma comment(lib, "opencv_structured_light" CV_VERSION_STR CV_EXT_STR)
#pragma comment(lib, "opencv_superres" CV_VERSION_STR CV_EXT_STR)
#pragma comment(lib, "opencv_surface_matching" CV_VERSION_STR CV_EXT_STR)
#pragma comment(lib, "opencv_text" CV_VERSION_STR CV_EXT_STR)
#pragma comment(lib, "opencv_tracking" CV_VERSION_STR CV_EXT_STR)
//#pragma comment(lib, "opencv_ts" CV_VERSION_STR CV_EXT_STR)
#pragma comment(lib, "opencv_video" CV_VERSION_STR CV_EXT_STR)
#pragma comment(lib, "opencv_videoio" CV_VERSION_STR CV_EXT_STR)
#pragma comment(lib, "opencv_videostab" CV_VERSION_STR CV_EXT_STR)
#pragma comment(lib, "opencv_viz" CV_VERSION_STR CV_EXT_STR)
#pragma comment(lib, "opencv_xfeatures2d" CV_VERSION_STR CV_EXT_STR)
#pragma comment(lib, "opencv_ximgproc" CV_VERSION_STR CV_EXT_STR)
#pragma comment(lib, "opencv_xobjdetect" CV_VERSION_STR CV_EXT_STR)
#pragma comment(lib, "opencv_xphoto" CV_VERSION_STR CV_EXT_STR)
## ※3 システム環境変数の設定
| 変数 | 値 |
|:-----|:---|
| Path | %OPENCV_DIR%\build\bin;|
| OPENCV_DIR | C:/opencv310/ |
| OPENCV_VER | 310 |
## ※4 プロパティ
- C/C++->Additional Include Directories
$(OPENCV_DIR)\build\include;
- Linker->General->Additional Library Directories
$(OPENCV_DIR)\build\lib;