木曜日, 11月 06, 2008

Mandriva上におけるOpenCVのコンパイル

OpenCVはマニアの間にたいへん人気があります。僕はマニアの人間じゃなくて、一時的に気になっている一人なのです。好きなMandrivaにOpenCVをコンパイルしようとすると、なかなか、./configure;make;make installの単純な手順でいきません。

コンパイルするために、configure.inに以下の箇所を修正する必要があります。
Image I/O ---------------------
libIlmImf:
  1. ImfCRgbaFile.h → OpenEXR/ImfCRgbaFile.h

Video I/O ---------------------
ffmpeg:
  1. libavcodec/avcodec.h → libavcodec/avcodec.h
  2. libswscale/swscale.h  → libswscale/swscale.h

Use unicap:
  • --with-unicap

Wrappers for other languages =========================================
Python(interfaces/swig/python/Makefile.am):
  1. _cv_la_LIBADD = $(top_builddir)/cv/src/libcv.la → _cv_la_LIBADD = $(top_builddir)/cv/src/libcv.la $(top_builddir)/cxcore/src/libcxcore.la
  2. _ml_la_LIBADD = $(top_builddir)/ml/src/libml.la → _ml_la_LIBADD = $(top_builddir)/ml/src/libml.la $(top_builddir)/cxcore/src/libcxcore.la
  3. _highgui_la_LIBADD = $(top_builddir)/otherlibs/highgui/libhighgui.la → _highgui_la_LIBADD = $(top_builddir)/otherlibs/highgui/libhighgui.la $(top_builddir)/cxcore/src/libcxcore.la

Octave:
  • --with-octave



./configure --with-unicap=yes --with-octave=yesで実行すると、以下のようになります。

General configuration ================================================
Compiler: g++
CXXFLAGS:
DEF_CXXFLAGS: -Wall -fno-rtti -pipe -O3 -g -march=i686 -ffast-math -fomit-frame-pointer -msse2
PY_CXXFLAGS: -Wall -pipe -O3 -g -march=i686 -ffast-math -fomit-frame-pointer -msse2
OCT_CXXFLAGS: -fno-strict-aliasing -Wall -Wno-uninitialized -pipe -O3 -g -march=i686 -ffast-math -fomit-frame-pointer -msse2

Install path: /usr/local

HighGUI configuration ================================================

Windowing system --------------
Use Carbon / Mac OS X: no
Use gtk+ 2.x: yes
Use gthread: yes

Image I/O ---------------------
Use ImageIO / Mac OS X: no
Use libjpeg: yes
Use zlib: yes
Use libpng: yes
Use libtiff: yes
Use libjasper: yes
Use libIlmImf: yes

Video I/O ---------------------
Use QuickTime / Mac OS X: no
Use xine: no
Use gstreamer: no
Use ffmpeg: yes
Use dc1394 & raw1394: yes
Use v4l: yes
Use v4l2: yes
Use unicap: yes

Wrappers for other languages =========================================
SWIG
Python yes
Octave yes

Additional build settings ============================================
Build demo apps yes

Now run make ...


Compiling C Samples
export PKG_CONFIG_PATH=/usr/local/lib/pkgconfig
cd /usr/local/share/opencv/samples/c
sh build_all.sh
swigでのpython
lib/python2.5/site-packagesの追加(追加の方法はPythonモジュール設定)

0 件のコメント: