UJP - 技術情報1

I hope this helps.

不正IP報告数

Okan Sensor
 
メイン
ログイン
ブログ カテゴリ一覧

OpenCV1.0.0をMacOS X 10.4にインストールする

OpenCV1.0.0をMacOS X 10.4にインストールする


0.改訂履歴

  • 2007.10.24 新規作成

1.はじめに

 このドキュメントでは,OpenCV1.0.0をMacOS X 10.4.10にインストールして,サンプルプログラム(facedetect,image)を稼働させるまでの手順を指定する. facedetect使用時には,iSight(カメラ)を利用し他動的顔認識処理も体験してみる.

 OpenCVでは,利用する機能により,次のようなパッケージが必要となる.

  • pkgconfig
  • libjpeg
  • giflib
  • libpng
  • libtiff
  • libjasper
  • gtk2
  • glib2-dev
  • atk
  • jasper
  • ffmpeg

 これらのパッケージを,MacPortsを使ってインストールした上で,利用する. このために,MacPortsが利用できる環境にしておく必要が在るが,MacOSなので,映像系ライブラリについてはQuickTime系がカバーしているモノが多いようで,実際には不要なものも含まれている様である.

 という事で,前提としてMacPortsがインストールされている必要が在る.

2.前提となるパッケージをインストールする

  • まずは,pkgconfigをインストールする.
macbook3:/Users/ujpadmin root# port install pkgconfig
--->  Fetching pkgconfig
--->  Attempting to fetch pkg-config-0.22.tar.gz from http://mirror.opensysadmin.co
m/pkg-config/
--->  Verifying checksum(s) for pkgconfig
--->  Extracting pkgconfig
--->  Configuring pkgconfig
--->  Building pkgconfig with target all
--->  Staging pkgconfig into destroot
--->  Installing pkgconfig 0.22_0
--->  Activating pkgconfig 0.22_0
--->  Cleaning pkgconfig
macbook3:/Users/ujpadmin root# 
  • 画像系(JPEG,GIF,PNG,TIFF)ライブラリをインストールする
macbook3:/Users/ujpadmin root# port install jpeg libpng tiff
--->  Fetching jpeg
--->  Attempting to fetch jpegsrc.v6b.tar.gz from http://www.ijg.org/files
--->  Attempting to fetch droppatch.tar.gz from http://sylvana.net/jpegcrop/
--->  Verifying checksum(s) for jpeg
--->  Extracting jpeg
--->  Applying patches to jpeg
--->  Configuring jpeg
--->  Building jpeg with target all
--->  Staging jpeg into destroot
--->  Installing jpeg 6b_2
--->  Activating jpeg 6b_2
--->  Cleaning jpeg
--->  Fetching zlib
--->  Attempting to fetch zlib-1.2.3.tar.bz2 from http://www.zlib.net/
--->  Verifying checksum(s) for zlib
--->  Extracting zlib
--->  Applying patches to zlib
--->  Configuring zlib
--->  Building zlib with target all
--->  Staging zlib into destroot
--->  Installing zlib 1.2.3_1
--->  Activating zlib 1.2.3_1
--->  Cleaning zlib
--->  Fetching giflib
--->  Attempting to fetch giflib-4.1.4.tar.bz2 from http://downloads.sourceforge.n
et/libungif
--->  Verifying checksum(s) for giflib
--->  Extracting giflib
--->  Applying patches to giflib
--->  Configuring giflib
--->  Building giflib with target all
--->  Staging giflib into destroot
--->  Installing giflib 4.1.4_1
--->  Activating giflib 4.1.4_1
--->  Cleaning giflib
--->  Fetching libpng
--->  Attempting to fetch libpng-1.2.22.tar.bz2 from http://downloads.sourceforge.n
et/libpng
--->  Verifying checksum(s) for libpng
--->  Extracting libpng
--->  Configuring libpng
--->  Building libpng with target all
--->  Staging libpng into destroot
--->  Installing libpng 1.2.22_0+darwin_8
--->  Activating libpng 1.2.22_0+darwin_8
--->  Cleaning libpng
--->  Fetching tiff
--->  Attempting to fetch tiff-3.8.2.tar.gz from ftp://ftp.remotesensing.org/pub/li
btiff/
--->  Verifying checksum(s) for tiff
--->  Extracting tiff
--->  Configuring tiff
--->  Building tiff with target all
--->  Staging tiff into destroot
--->  Installing tiff 3.8.2_1+darwin_8+macosx
--->  Activating tiff 3.8.2_1+darwin_8+macosx
--->  Cleaning tiff
macbook3:/Users/ujpadmin root# 
  • 自動的にzlibがインストールされている.
  • GTK+(The GIMP Toolkit)をインストールする.
    • Photoshop並の?編集機能を持つといわれる画像編集ツールGIMPの為に開発されたGUIキット.
    • GNOMEでも採用.
  • このインストールは,関連もジュールが多いので,非常に時間(MacBookPro 2GHzで30分以上)がかかる.
macbook3:/Users/ujpadmin root# port install gtk2
--->  Fetching expat
--->  Attempting to fetch expat-2.0.1.tar.gz from http://downloads.sourceforge.net/
expat
--->  Verifying checksum(s) for expat
--->  Extracting expat
--->  Configuring expat
--->  Building expat with target all
--->  Staging expat into destroot
--->  Installing expat 2.0.1_0
--->  Activating expat 2.0.1_0
--->  Cleaning expat
--->  Fetching libiconv
--->  Attempting to fetch libiconv-1.11.tar.gz from http://ftp.gnu.org/gnu/libiconv
--->  Verifying checksum(s) for libiconv
--->  Extracting libiconv
--->  Configuring libiconv
--->  Building libiconv with target all
--->  Staging libiconv into destroot
--->  Installing libiconv 1.11_6+darwin_8
--->  Activating libiconv 1.11_6+darwin_8
--->  Cleaning libiconv
--->  Fetching gettext
--->  Attempting to fetch gettext-0.16.1.tar.gz from http://ftp.gnu.org/gnu/gettext
--->  Verifying checksum(s) for gettext
--->  Extracting gettext
--->  Applying patches to gettext
--->  Configuring gettext
--->  Building gettext with target all
--->  Staging gettext into destroot
--->  Installing gettext 0.16.1_0
--->  Activating gettext 0.16.1_0
--->  Cleaning gettext
--->  Fetching glib2
--->  Attempting to fetch glib-2.14.2.tar.bz2 from ftp://ftp.gtk.org/pub/glib/2.14
--->  Verifying checksum(s) for glib2
--->  Extracting glib2
--->  Applying patches to glib2
--->  Configuring glib2
--->  Building glib2 with target all
--->  Staging glib2 into destroot
--->  Installing glib2 2.14.2_0
--->  Activating glib2 2.14.2_0
--->  Cleaning glib2
--->  Fetching atk
--->  Attempting to fetch atk-1.20.0.tar.bz2 from http://mandril.creatis.insa-lyon.
fr/linux/gnome.org/sources/atk/1.20/
--->  Verifying checksum(s) for atk
--->  Extracting atk
--->  Configuring atk
--->  Building atk with target all
--->  Staging atk into destroot
--->  Installing atk 1.20.0_1
--->  Activating atk 1.20.0_1
--->  Cleaning atk
--->  Fetching freetype
--->  Attempting to fetch freetype-2.3.5.tar.bz2 from http://download.savannah.gnu.
org/releases/freetype/
--->  Verifying checksum(s) for freetype
--->  Extracting freetype
--->  Applying patches to freetype
--->  Configuring freetype
--->  Building freetype with target all
--->  Staging freetype into destroot
--->  Installing freetype 2.3.5_0
--->  Activating freetype 2.3.5_0
--->  Cleaning freetype
--->  Fetching fontconfig
--->  Attempting to fetch fontconfig-2.4.2.tar.gz from http://downloads.sourceforg
e.net/gimp-win
--->  Verifying checksum(s) for fontconfig
--->  Extracting fontconfig
--->  Configuring fontconfig
--->  Building fontconfig with target all
--->  Staging fontconfig into destroot
--->  Installing fontconfig 2.4.2_1+macosx
--->  Activating fontconfig 2.4.2_1+macosx
--->  Cleaning fontconfig
--->  Fetching render
--->  Attempting to fetch renderext-0.9.tar.bz2 from http://xlibs.freedesktop.org/
release/
--->  Verifying checksum(s) for render
--->  Extracting render
--->  Configuring render
--->  Building render with target all
--->  Staging render into destroot
--->  Installing render 0.9_1
--->  Activating render 0.9_1
--->  Cleaning render
--->  Fetching xrender
--->  Attempting to fetch libXrender-0.9.0.tar.bz2 from http://xlibs.freedesktop.o
rg/release/
--->  Verifying checksum(s) for xrender
--->  Extracting xrender
--->  Configuring xrender
--->  Building xrender with target all
--->  Staging xrender into destroot
--->  Installing xrender 0.9.0_1+darwin_8
--->  Activating xrender 0.9.0_1+darwin_8
--->  Cleaning xrender
--->  Fetching cairo
--->  Attempting to fetch cairo-1.4.10.tar.gz from http://cairographics.org/relea
ses/
--->  Verifying checksum(s) for cairo
--->  Extracting cairo
--->  Configuring cairo
--->  Building cairo with target all
--->  Staging cairo into destroot
--->  Installing cairo 1.4.10_0
--->  Activating cairo 1.4.10_0
--->  Cleaning cairo
--->  Fetching xorg-util-macros
--->  Attempting to fetch util-macros-1.1.5.tar.bz2 from http://www.x.org/pub/indi
vidual/util/
--->  Verifying checksum(s) for xorg-util-macros
--->  Extracting xorg-util-macros
--->  Configuring xorg-util-macros
--->  Building xorg-util-macros with target all
--->  Staging xorg-util-macros into destroot
--->  Installing xorg-util-macros 1.1.5_0
--->  Activating xorg-util-macros 1.1.5_0
--->  Cleaning xorg-util-macros
--->  Fetching xorg-xproto
--->  Attempting to fetch xproto-7.0.11.tar.bz2 from http://www.x.org/pub/individu
al/proto/
--->  Verifying checksum(s) for xorg-xproto
--->  Extracting xorg-xproto
--->  Configuring xorg-xproto
--->  Building xorg-xproto with target all
--->  Staging xorg-xproto into destroot
--->  Installing xorg-xproto 7.0.11_0
--->  Activating xorg-xproto 7.0.11_0
--->  Cleaning xorg-xproto
--->  Fetching Xft2
--->  Attempting to fetch libXft-2.1.12.tar.bz2 from http://xorg.freedesktop.org/r
eleases/individual/lib/
--->  Verifying checksum(s) for Xft2
--->  Extracting Xft2
--->  Configuring Xft2
--->  Building Xft2 with target all
--->  Staging Xft2 into destroot
--->  Installing Xft2 2.1.12_0
--->  Activating Xft2 2.1.12_0
--->  Cleaning Xft2
--->  Fetching pango
--->  Attempting to fetch pango-1.18.3.tar.bz2 from http://mandril.creatis.insa-
lyon.fr/linux/gnome.org/sources/pango/1.18
--->  Verifying checksum(s) for pango
--->  Extracting pango
--->  Applying patches to pango
--->  Configuring pango
--->  Building pango with target all
--->  Staging pango into destroot
--->  Installing pango 1.18.3_0
--->  Activating pango 1.18.3_0
--->  Cleaning pango
--->  Fetching gtk2
--->  Attempting to fetch gtk+-2.12.1.tar.bz2 from http://mandril.creatis.insa-l
yon.fr/linux/gnome.org/sources/gtk+/2.12
--->  Verifying checksum(s) for gtk2
--->  Extracting gtk2
--->  Configuring gtk2
--->  Building gtk2 with target all
--->  Staging gtk2 into destroot
--->  Installing gtk2 2.12.1_0
--->  Activating gtk2 2.12.1_0
--->  Cleaning gtk2
macbook3:/Users/ujpadmin root#
  • glib2もatkも自動的にインストールされた.
  • 次に,JPEG2000で,ロスレス圧縮ができるJasperライブラリをインストールする.
  • jasperをインストールする.
macbook3:/Users/ujpadmin root# port install jasper
--->  Fetching jasper
--->  Attempting to fetch jasper-1.701.0.zip from http://www.ece.uvic.ca/~mdadams/j
asper/software/
--->  Verifying checksum(s) for jasper
--->  Extracting jasper
--->  Applying patches to jasper
--->  Configuring jasper
--->  Building jasper with target all
--->  Staging jasper into destroot
--->  Installing jasper 1.701.0_0
--->  Activating jasper 1.701.0_0
--->  Cleaning jasper
macbook3:/Users/ujpadmin root# 
  • 次に,C/C++ラッパーの,SWIGをインストールする.
macbook3:/Users/ujpadmin root# port install swig
--->  Fetching swig
--->  Attempting to fetch swig-1.3.31.tar.gz from http://downloads.sourceforge.net/s
wig
--->  Verifying checksum(s) for swig
--->  Extracting swig
--->  Configuring swig
--->  Building swig
--->  Staging swig into destroot
--->  Installing swig 1.3.31_0+darwin_8
--->  Activating swig 1.3.31_0+darwin_8
--->  Cleaning swig
macbook3:/Users/ujpadmin root# 
macbook3:/Users/ujpadmin root# port install ffmpeg
--->  Fetching apr
--->  Attempting to fetch apr-1.2.11.tar.bz2 from http://www.apache.org/dist/apr
--->  Verifying checksum(s) for apr
--->  Extracting apr
--->  Configuring apr
--->  Building apr with target all
--->  Staging apr into destroot
--->  Installing apr 1.2.11_0
--->  Activating apr 1.2.11_0
--->  Cleaning apr
--->  Fetching db44
--->  Attempting to fetch patch.4.4.20.1 from http://www.oracle.com/technology/
products/berkeley-db/db/update/4.4.20/
--->  Attempting to fetch patch.4.4.20.2 from http://www.oracle.com/technology/
products/berkeley-db/db/update/4.4.20/
--->  Attempting to fetch patch.4.4.20.3 from http://www.oracle.com/technology/
products/berkeley-db/db/update/4.4.20/
--->  Attempting to fetch patch.4.4.20.4 from http://www.oracle.com/technology/
products/berkeley-db/db/update/4.4.20/
--->  Attempting to fetch db-4.4.20.tar.gz from http://downloads.sleepycat.com/
--->  Verifying checksum(s) for db44
--->  Extracting db44
--->  Applying patches to db44
--->  Configuring db44
--->  Building db44 with target all
--->  Staging db44 into destroot
--->  Installing db44 4.4.20_1+darwin_8
--->  Activating db44 4.4.20_1+darwin_8
--->  Cleaning db44
--->  Fetching ncursesw
--->  Attempting to fetch ncurses-5.6.tar.gz from http://ftp.gnu.org/gnu/ncurses
--->  Verifying checksum(s) for ncursesw
--->  Extracting ncursesw
--->  Applying patches to ncursesw
--->  Configuring ncursesw
--->  Building ncursesw with target all
--->  Staging ncursesw into destroot
--->  Installing ncursesw 5.6_0+darwin_8
--->  Activating ncursesw 5.6_0+darwin_8
--->  Cleaning ncursesw
--->  Fetching ncurses
--->  Verifying checksum(s) for ncurses
--->  Extracting ncurses
--->  Applying patches to ncurses
--->  Configuring ncurses
--->  Building ncurses with target all
--->  Staging ncurses into destroot
--->  Installing ncurses 5.6_0+darwin_8
--->  Activating ncurses 5.6_0+darwin_8
--->  Cleaning ncurses
--->  Fetching readline
--->  Attempting to fetch readline52-001 from http://ftp.gnu.org/gnu/readline/
readline-5.2-patches/
--->  Attempting to fetch readline52-002 from http://ftp.gnu.org/gnu/readline/
readline-5.2-patches/
--->  Attempting to fetch readline52-003 from http://ftp.gnu.org/gnu/readline/
readline-5.2-patches/
--->  Attempting to fetch readline52-004 from http://ftp.gnu.org/gnu/readline/
readline-5.2-patches/
--->  Attempting to fetch readline52-005 from http://ftp.gnu.org/gnu/readline/
readline-5.2-patches/
--->  Attempting to fetch readline52-006 from http://ftp.gnu.org/gnu/readline/
readline-5.2-patches/
--->  Attempting to fetch readline52-007 from http://ftp.gnu.org/gnu/readline/
readline-5.2-patches/
--->  Attempting to fetch readline-5.2.tar.gz from http://ftp.gnu.org/gnu/
readline
--->  Verifying checksum(s) for readline
--->  Extracting readline
--->  Applying patches to readline
--->  Configuring readline
--->  Building readline with target all
--->  Staging readline into destroot
--->  Installing readline 5.2.007_0
--->  Activating readline 5.2.007_0
--->  Cleaning readline
--->  Fetching sqlite3
--->  Verifying checksum(s) for sqlite3
--->  Extracting sqlite3
--->  Applying patches to sqlite3
--->  Configuring sqlite3
--->  Building sqlite3 with target all
--->  Staging sqlite3 into destroot
--->  Installing sqlite3 3.5.1_0+darwin_8
--->  Activating sqlite3 3.5.1_0+darwin_8
--->  Cleaning sqlite3
--->  Fetching apr-util
--->  Verifying checksum(s) for apr-util
--->  Extracting apr-util
--->  Configuring apr-util
--->  Building apr-util with target all
--->  Staging apr-util into destroot
--->  Installing apr-util 1.2.10_0
--->  Activating apr-util 1.2.10_0
--->  Cleaning apr-util
--->  Fetching openssl
--->  Verifying checksum(s) for openssl
--->  Extracting openssl
--->  Applying patches to openssl
--->  Configuring openssl
--->  Building openssl with target all
--->  Staging openssl into destroot
--->  Installing openssl 0.9.8g_0+darwin_8
--->  Activating openssl 0.9.8g_0+darwin_8
--->  Cleaning openssl
--->  Fetching neon
--->  Verifying checksum(s) for neon
--->  Extracting neon
--->  Configuring neon
--->  Building neon with target all
--->  Staging neon into destroot
--->  Installing neon 0.26.4_0
--->  Activating neon 0.26.4_0
--->  Cleaning neon
--->  Fetching subversion
--->  Verifying checksum(s) for subversion
--->  Extracting subversion
--->  Applying patches to subversion
--->  Configuring subversion
--->  Building subversion with target all mucc
--->  Staging subversion into destroot
--->  Installing subversion 1.4.5_0
--->  Activating subversion 1.4.5_0
--->  Cleaning subversion
--->  Fetching ffmpeg
--->  Verifying checksum(s) for ffmpeg
--->  Extracting ffmpeg
--->  Configuring ffmpeg
--->  Building ffmpeg with target all
--->  Staging ffmpeg into destroot
--->  Installing ffmpeg 0.4.9-pre1_2
--->  Activating ffmpeg 0.4.9-pre1_2
--->  Cleaning ffmpeg
macbook3:/Users/ujpadmin root# 
  • ffmpegの関連モジュールを確認する.
macbook3:/Users/ujpadmin root# port variants ffmpeg
ffmpeg has the variants:
        universal
        gpl
        postproc
        lame
        libogg
        vorbis
        theora
        faac
        faad
        xvid
        x264
        a52
macbook3:/Users/ujpadmin root# 
  • 追加でモジュールをインストールする.
macbook3:/Users/ujpadmin root# port install lame    
--->  Fetching lame
--->  Attempting to fetch lame-3.97.tar.gz from http://downloads.sourceforge.net/l
ame
--->  Verifying checksum(s) for lame
--->  Extracting lame
--->  Configuring lame
--->  Building lame with target all
--->  Staging lame into destroot
--->  Installing lame 3.97_0
--->  Activating lame 3.97_0
--->  Cleaning lame
macbook3:/Users/ujpadmin root# port install xvid
--->  Fetching XviD
--->  Attempting to fetch xvidcore-1.1.3.tar.bz2 from http://downloads.xvid.org/do
wnl
oads/
--->  Verifying checksum(s) for XviD
--->  Extracting XviD
--->  Configuring XviD
--->  Building XviD with target all
--->  Staging XviD into destroot
--->  Installing XviD 1.1.3_0+darwin_i386
--->  Activating XviD 1.1.3_0+darwin_i386
--->  Cleaning XviD
macbook3:/Users/ujpadmin root# port install faac  
--->  Fetching faac
--->  Attempting to fetch faac-1.25.tar.gz from http://downloads.sourceforge.net/fa
ac
--->  Verifying checksum(s) for faac
--->  Extracting faac
--->  Applying patches to faac
--->  Configuring faac
--->  Building faac with target all
--->  Staging faac into destroot
--->  Installing faac 1.25_0
--->  Activating faac 1.25_0
--->  Cleaning faac
macbook3:/Users/ujpadmin root# port install x264
--->  Fetching x264
--->  Attempting to fetch x264-snapshot-20070411-2245.tar.bz2 from ftp://ftp.
videolan.org/pub/videolan/x264/snapshots/
--->  Verifying checksum(s) for x264
--->  Extracting x264
--->  Configuring x264
--->  Building x264 with target default
--->  Staging x264 into destroot
--->  Installing x264 20070411_1
--->  Activating x264 20070411_1
--->  Cleaning x264
macbook3:/Users/ujpadmin root#
  • Oracleから何か?と,readlineというモジュールをダウンロードしているようである.
  • ここで,インストールされているパッケージを確認する.
macbook3:/Users/ujpadmin root# port installed     
The following ports are currently installed:
  aalib @1.4rc5_2 (active)
  apr @1.2.11_0 (active)
  apr-util @1.2.10_0 (active)
  atk @1.20.0_1 (active)
  audiofile @0.2.6_1 (active)
  bzip2 @1.0.4_1 (active)
  cairo @1.4.10_0 (active)
  db44 @4.4.20_1+darwin_8 (active)
  esound @0.2.38_1 (active)
  expat @2.0.1_0 (active)
  faac @1.25_0 (active)
  ffmpeg @0.4.9-pre1_2 (active)
  flac @1.2.1_0+darwin_i386 (active)
  fontconfig @2.4.2_1+macosx (active)
  freetype @2.3.5_0 (active)
  gd2 @2.0.35_0 (active)
  gettext @0.16.1_0 (active)
  giflib @4.1.4_1 (active)
  glib2 @2.14.2_0 (active)
  gtk2 @2.12.1_0 (active)
  id3lib @3.8.3_0 (active)
  ImageMagick @6.3.6-2_0+darwin_8 (active)
  jasper @1.701.0_0 (active)
  jpeg @6b_2 (active)
  lame @3.97_0 (active)
  libiconv @1.11_6+darwin_8 (active)
  libogg @1.1.3_2 (active)
  libpng @1.2.22_0+darwin_8 (active)
  libtool @1.5.24_1 (active)
  libvorbis @1.2.0_0 (active)
  libxml2 @2.6.30_0 (active)
  mrtg @2.15.2_0 (active)
  ncurses @5.6_0+darwin_8 (active)
  ncursesw @5.6_0+darwin_8 (active)
  neon @0.26.4_0 (active)
  openssl @0.9.8g_0+darwin_8 (active)
  pango @1.18.3_0 (active)
  pkgconfig @0.22_0 (active)
  readline @5.2.007_0 (active)
  render @0.9_1 (active)
  sqlite3 @3.5.1_0+darwin_8 (active)
  swig @1.3.31_0+darwin_8 (active)
  subversion @1.4.5_0 (active)
  tiff @3.8.2_1+darwin_8+macosx (active)
  x264 @20070411_1 (active)
  Xft2 @2.1.12_0 (active)
  xorg-util-macros @1.1.5_0 (active)
  xorg-xproto @7.0.11_0 (active)
  xrender @0.9.0_1+darwin_8 (active)
  XviD @1.1.3_0+darwin_i386 (active)
  zlib @1.2.3_1 (active)
macbook3:/Users/ujpadmin root# 
  • これで終了.

3.OpenCVのインストール

  • 以下の公式サイトから入手できる.
  • 2007年10月23日現在,最新版は2006-11-06リリースの1.0.0である.
  • ファイルを展開する.
macbook3:~/Documents/Downloads ujpadmin$ tar xfz opencv-1.0.0.tar.gz 
macbook3:~/Documents/Downloads ujpadmin$
  • 展開したファイルを確認する.
macbook3:/Users/ujpadmin/Documents/Downloads root# cd opencv-1.0.0
macbook3:/Users/ujpadmin/opencv-1.0.0 root# ls -1
AUTHORS
COPYING
ChangeLog
INSTALL
Makefile.am
Makefile.in
NEWS
README
THANKS
TODO
aclocal.m4
apps
autotools
configure
configure.in
cv
cvaux
cvconfig.h.in
cxcore
data
docs
interfaces
ml
opencv.pc.in
opencv.spec.in
otherlibs
samples
tests
utils
macbook3:/Users/ujpadmin/opencv-1.0.0 root# 
  • configireをする.
macbook3:/Users/ujpadmin/opencv-1.0.0 root# ./configure
checking build system type... i386-apple-darwin8.10.1
checking host system type... i386-apple-darwin8.10.1
checking target system type... i386-apple-darwin8.10.1
checking for a BSD-compatible install... /usr/bin/install -c
checking whether build environment is sane... yes
checking for gawk... no
checking for mawk... no
checking for nawk... no
checking for awk... awk
checking whether make sets $(MAKE)... yes
checking whether make sets $(MAKE)... (cached) yes
checking for g++... g++
checking for C++ compiler default output file name... a.out
checking whether the C++ compiler works... yes
checking whether we are cross compiling... no
checking for suffix of executables... 
checking for suffix of object files... o
checking whether we are using the GNU C++ compiler... yes
checking whether g++ accepts -g... yes
checking for style of include used by make... GNU
checking dependency style of g++... gcc3
checking for gcc... gcc
checking whether we are using the GNU C compiler... yes
checking whether gcc accepts -g... yes
checking for gcc option to accept ANSI C... none needed
checking dependency style of gcc... gcc3
checking how to run the C preprocessor... gcc -E
checking for a sed that does not truncate output... /usr/bin/sed
checking for egrep... grep -E
checking for ld used by gcc... /usr/bin/ld
checking if the linker (/usr/bin/ld) is GNU ld... no
checking for /usr/bin/ld option to reload object files... -r
checking for BSD-compatible nm... /usr/bin/nm -p
checking whether ln -s works... yes
checking how to recognise dependent libraries... pass_all
checking for ANSI C header files... yes
checking for sys/types.h... yes
checking for sys/stat.h... yes
checking for stdlib.h... yes
checking for string.h... yes
checking for memory.h... yes
checking for strings.h... yes
checking for inttypes.h... yes
checking for stdint.h... yes
checking for unistd.h... yes
checking dlfcn.h usability... yes
checking dlfcn.h presence... yes
checking for dlfcn.h... yes
checking how to run the C++ preprocessor... g++ -E
checking for g77... no
checking for f77... no
checking for xlf... no
checking for frt... no
checking for pgf77... no
checking for fort77... no
checking for fl32... no
checking for af77... no
checking for f90... no
checking for xlf90... no
checking for pgf90... no
checking for epcf90... no
checking for f95... no
checking for fort... no
checking for xlf95... no
checking for ifc... no
checking for efc... no
checking for pgf95... no
checking for lf95... no
checking for gfortran... no
checking whether we are using the GNU Fortran 77 compiler... no
checking whether  accepts -g... no
checking the maximum length of command line arguments... 196608
checking command to parse /usr/bin/nm -p output from gcc object... ok
checking for objdir... .libs
checking for ar... ar
checking for ranlib... ranlib
checking for strip... strip
checking if gcc supports -fno-rtti -fno-exceptions... no
checking for gcc option to produce PIC... -fno-common
checking if gcc PIC flag -fno-common works... yes
checking if gcc static flag -static works... no
checking if gcc supports -c -o file.o... yes
checking whether the gcc linker (/usr/bin/ld) supports shared libraries... yes
checking dynamic linker characteristics... darwin8.10.1 dyld
checking how to hardcode library paths into programs... immediate
checking whether stripping libraries is possible... yes
checking if libtool supports shared libraries... yes
checking whether to build shared libraries... yes
checking whether to build static libraries... no
configure: creating libtool
appending configuration tag "CXX" to libtool
checking for ld used by g++... /usr/bin/ld
checking if the linker (/usr/bin/ld) is GNU ld... no
checking whether the g++ linker (/usr/bin/ld) supports shared libraries... yes
checking for g++ option to produce PIC... -fno-common
checking if g++ PIC flag -fno-common works... yes
checking if g++ static flag -static works... no
checking if g++ supports -c -o file.o... yes
checking whether the g++ linker (/usr/bin/ld) supports shared libraries... yes
checking dynamic linker characteristics... darwin8.10.1 dyld
checking how to hardcode library paths into programs... immediate
appending configuration tag "F77" to libtool
checking whether to build debug version (no optimization)... no
configure: TARGET=i386-apple-darwin8.10.1 
checking for pow in -lm... yes
checking for dlopen in -ldl... yes
checking for pthread_create in -lpthread... yes
checking whether byte ordering is bigendian... no
checking for working alloca.h... yes
checking for alloca... yes
checking malloc.h usability... no
checking malloc.h presence... no
checking for malloc.h... no
checking for lrint... yes
checking Carbon/Carbon.h usability... yes
checking Carbon/Carbon.h presence... yes
checking for Carbon/Carbon.h... yes
checking QuickTime/QuickTime.h usability... yes
checking QuickTime/QuickTime.h presence... yes
checking for QuickTime/QuickTime.h... yes
checking jpeglib.h usability... yes
checking jpeglib.h presence... yes
checking for jpeglib.h... yes
checking for jpeg_destroy_decompress in -ljpeg... yes
checking zlib.h usability... yes
checking zlib.h presence... yes
checking for zlib.h... yes
checking for gzopen in -lz... yes
checking png.h usability... no
checking png.h presence... no
checking for png.h... no
checking libpng/png.h usability... no
checking libpng/png.h presence... no
checking for libpng/png.h... no
checking tiff.h usability... no
checking tiff.h presence... no
checking for tiff.h... no
checking jasper/jasper.h usability... no
checking jasper/jasper.h presence... no
checking for jasper/jasper.h... no
checking ImfCRgbaFile.h usability... no
checking ImfCRgbaFile.h presence... no
checking for ImfCRgbaFile.h... no
configure: Checking for necessary tools to build python wrappers
checking for python... /usr/bin/python
checking for python version... 2.3
checking for python platform... darwin
checking for python script directory... ${prefix}/lib/python2.3/site-packages
checking for python extension module directory... ${exec_prefix}/lib/python2.3/
site-packages
configure: PYTHON_CSPEC= -I/System/Library/Frameworks/Python.framework/Versions/
2.3/include/python2.3
configure: PYTHON_LSPEC=-Wl,-F. -Wl,-F. -F/System/Library/Frameworks -L/System/
Library/Frameworks/Python.framework/Versions/2.3/lib/python2.3/config -lpython2.
3 -u __dummy -u _PyMac_Error -framework System Python.framework/Versions/2.3/
Python -framework CoreServices -framework Foundation
checking Python.h usability... yes
checking Python.h presence... yes
checking for Python.h... yes
configure: creating ./config.status
config.status: creating Makefile
config.status: creating opencv.pc
config.status: creating opencv.spec
config.status: creating docs/Makefile
config.status: creating data/Makefile
config.status: creating cxcore/Makefile
config.status: creating cxcore/include/Makefile
config.status: creating cxcore/src/Makefile
config.status: creating cv/Makefile
config.status: creating cv/include/Makefile
config.status: creating cv/src/Makefile
config.status: creating cvaux/Makefile
config.status: creating cvaux/include/Makefile
config.status: creating cvaux/src/Makefile
config.status: creating ml/Makefile
config.status: creating ml/include/Makefile
config.status: creating ml/src/Makefile
config.status: creating otherlibs/Makefile
config.status: creating otherlibs/highgui/Makefile
config.status: creating apps/Makefile
config.status: creating apps/haartraining/Makefile
config.status: creating apps/haartraining/include/Makefile
config.status: creating apps/haartraining/src/Makefile
config.status: creating interfaces/Makefile
config.status: creating interfaces/swig/Makefile
config.status: creating interfaces/swig/filtered/Makefile
config.status: creating interfaces/swig/general/Makefile
config.status: creating interfaces/swig/python/Makefile
config.status: creating tests/Makefile
config.status: creating tests/python/Makefile
config.status: creating tests/cv/Makefile
config.status: creating tests/cv/src/Makefile
config.status: creating tests/cxts/Makefile
config.status: creating tests/cxcore/Makefile
config.status: creating tests/cxcore/src/Makefile
config.status: creating utils/Makefile
config.status: creating samples/Makefile
config.status: creating samples/c/Makefile
config.status: creating samples/python/Makefile
config.status: creating cvconfig.h
config.status: executing depfiles commands

General configuration ================================================
    Compiler:                 g++
    CXXFLAGS:                 -Wall -fno-rtti -pipe -O3 -g -march=prescott -
ffast-math -fomit-frame-pointer 

    Install path:             /usr/local

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

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

    Image I/O ---------------------
    Use libjpeg:              yes
    Use zlib:                 yes
    Use libpng:               no
    Use libtiff:              no
    Use libjasper:            no
    Use libIlmImf:            no

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

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

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

Now run make ...

macbook3:/Users/ujpadmin/opencv-1.0.0 root# 
  • 折角インストールしたのに,認識されていない.
  • これは,MacPortsでインストールしたパッケージのライブラリへのパスが抜けているためである.
  • よって,パスを追加する.
macbook3:/Users/ujpadmin/opencv-1.0.0 root#  ./configure CPPFLAGS="-I/op
t/local/include" LDFLAGS="-L/opt/local/lib"
checking build system type... i386-apple-darwin8.10.1
checking host system type... i386-apple-darwin8.10.1
checking target system type... i386-apple-darwin8.10.1
checking for a BSD-compatible install... /usr/bin/install -c
checking whether build environment is sane... yes
checking for gawk... no
checking for mawk... no
checking for nawk... no
checking for awk... awk
checking whether make sets $(MAKE)... yes
checking whether make sets $(MAKE)... (cached) yes
checking for g++... g++
checking for C++ compiler default output file name... a.out
checking whether the C++ compiler works... yes
checking whether we are cross compiling... no
checking for suffix of executables... 
checking for suffix of object files... o
checking whether we are using the GNU C++ compiler... yes
checking whether g++ accepts -g... yes
checking for style of include used by make... GNU
checking dependency style of g++... gcc3
checking for gcc... gcc
checking whether we are using the GNU C compiler... yes
checking whether gcc accepts -g... yes
checking for gcc option to accept ANSI C... none needed
checking dependency style of gcc... gcc3
checking how to run the C preprocessor... gcc -E
checking for a sed that does not truncate output... /usr/bin/sed
checking for egrep... grep -E
checking for ld used by gcc... /usr/bin/ld
checking if the linker (/usr/bin/ld) is GNU ld... no
checking for /usr/bin/ld option to reload object files... -r
checking for BSD-compatible nm... /usr/bin/nm -p
checking whether ln -s works... yes
checking how to recognise dependent libraries... pass_all
checking for ANSI C header files... yes
checking for sys/types.h... yes
checking for sys/stat.h... yes
checking for stdlib.h... yes
checking for string.h... yes
checking for memory.h... yes
checking for strings.h... yes
checking for inttypes.h... yes
checking for stdint.h... yes
checking for unistd.h... yes
checking dlfcn.h usability... yes
checking dlfcn.h presence... yes
checking for dlfcn.h... yes
checking how to run the C++ preprocessor... g++ -E
checking for g77... no
checking for f77... no
checking for xlf... no
checking for frt... no
checking for pgf77... no
checking for fort77... no
checking for fl32... no
checking for af77... no
checking for f90... no
checking for xlf90... no
checking for pgf90... no
checking for epcf90... no
checking for f95... no
checking for fort... no
checking for xlf95... no
checking for ifc... no
checking for efc... no
checking for pgf95... no
checking for lf95... no
checking for gfortran... no
checking whether we are using the GNU Fortran 77 compiler... no
checking whether  accepts -g... no
checking the maximum length of command line arguments... 196608
checking command to parse /usr/bin/nm -p output from gcc object... ok
checking for objdir... .libs
checking for ar... ar
checking for ranlib... ranlib
checking for strip... strip
checking if gcc supports -fno-rtti -fno-exceptions... no
checking for gcc option to produce PIC... -fno-common
checking if gcc PIC flag -fno-common works... yes
checking if gcc static flag -static works... no
checking if gcc supports -c -o file.o... yes
checking whether the gcc linker (/usr/bin/ld) supports shared libraries... yes
checking dynamic linker characteristics... darwin8.10.1 dyld
checking how to hardcode library paths into programs... immediate
checking whether stripping libraries is possible... yes
checking if libtool supports shared libraries... yes
checking whether to build shared libraries... yes
checking whether to build static libraries... no
configure: creating libtool
appending configuration tag "CXX" to libtool
checking for ld used by g++... /usr/bin/ld
checking if the linker (/usr/bin/ld) is GNU ld... no
checking whether the g++ linker (/usr/bin/ld) supports shared libraries... yes
checking for g++ option to produce PIC... -fno-common
checking if g++ PIC flag -fno-common works... yes
checking if g++ static flag -static works... no
checking if g++ supports -c -o file.o... yes
checking whether the g++ linker (/usr/bin/ld) supports shared libraries... yes
checking dynamic linker characteristics... darwin8.10.1 dyld
checking how to hardcode library paths into programs... immediate
appending configuration tag "F77" to libtool
checking whether to build debug version (no optimization)... no
configure: TARGET=i386-apple-darwin8.10.1 
checking for pow in -lm... yes
checking for dlopen in -ldl... yes
checking for pthread_create in -lpthread... yes
checking whether byte ordering is bigendian... no
checking for working alloca.h... yes
checking for alloca... yes
checking malloc.h usability... no
checking malloc.h presence... no
checking for malloc.h... no
checking for lrint... yes
checking Carbon/Carbon.h usability... yes
checking Carbon/Carbon.h presence... yes
checking for Carbon/Carbon.h... yes
checking QuickTime/QuickTime.h usability... yes
checking QuickTime/QuickTime.h presence... yes
checking for QuickTime/QuickTime.h... yes
checking jpeglib.h usability... yes
checking jpeglib.h presence... yes
checking for jpeglib.h... yes
checking for jpeg_destroy_decompress in -ljpeg... yes
checking zlib.h usability... yes
checking zlib.h presence... yes
checking for zlib.h... yes
checking for gzopen in -lz... yes
checking png.h usability... yes
checking png.h presence... yes
checking for png.h... yes
checking libpng/png.h usability... no
checking libpng/png.h presence... no
checking for libpng/png.h... no
checking for png_read_image in -lpng12... yes
checking for png_get_valid... yes
checking for png_set_tRNS_to_alpha... yes
checking tiff.h usability... yes
checking tiff.h presence... yes
checking for tiff.h... yes
checking for TIFFReadRGBAStrip in -ltiff... yes
checking jasper/jasper.h usability... yes
checking jasper/jasper.h presence... yes
checking for jasper/jasper.h... yes
checking for jas_image_readcmpt in -ljasper... yes
checking ImfCRgbaFile.h usability... no
checking ImfCRgbaFile.h presence... no
checking for ImfCRgbaFile.h... no
configure: Checking for necessary tools to build python wrappers
checking for python... /usr/bin/python
checking for python version... 2.3
checking for python platform... darwin
checking for python script directory... ${prefix}/lib/python2.3/site-packages
checking for python extension module directory... ${exec_prefix}/lib/python2.
3/site-packages
configure: PYTHON_CSPEC= -I/System/Library/Frameworks/Python.framework/Versio
ns/2.3/include/python2.3
configure: PYTHON_LSPEC=-Wl,-F. -Wl,-F. -F/System/Library/Frameworks -L/Syste
m/Library/Frameworks/Python.framework/Versions/2.3/lib/python2.3/config -lpyt
hon2.3 -u __dummy -u _PyMac_Error -framework System Python.framework/Versions
/2.3/Python -framework CoreServices -framework Foundation
checking Python.h usability... yes
checking Python.h presence... yes
checking for Python.h... yes
configure: creating ./config.status
config.status: creating Makefile
config.status: creating opencv.pc
config.status: creating opencv.spec
config.status: creating docs/Makefile
config.status: creating data/Makefile
config.status: creating cxcore/Makefile
config.status: creating cxcore/include/Makefile
config.status: creating cxcore/src/Makefile
config.status: creating cv/Makefile
config.status: creating cv/include/Makefile
config.status: creating cv/src/Makefile
config.status: creating cvaux/Makefile
config.status: creating cvaux/include/Makefile
config.status: creating cvaux/src/Makefile
config.status: creating ml/Makefile
config.status: creating ml/include/Makefile
config.status: creating ml/src/Makefile
config.status: creating otherlibs/Makefile
config.status: creating otherlibs/highgui/Makefile
config.status: creating apps/Makefile
config.status: creating apps/haartraining/Makefile
config.status: creating apps/haartraining/include/Makefile
config.status: creating apps/haartraining/src/Makefile
config.status: creating interfaces/Makefile
config.status: creating interfaces/swig/Makefile
config.status: creating interfaces/swig/filtered/Makefile
config.status: creating interfaces/swig/general/Makefile
config.status: creating interfaces/swig/python/Makefile
config.status: creating tests/Makefile
config.status: creating tests/python/Makefile
config.status: creating tests/cv/Makefile
config.status: creating tests/cv/src/Makefile
config.status: creating tests/cxts/Makefile
config.status: creating tests/cxcore/Makefile
config.status: creating tests/cxcore/src/Makefile
config.status: creating utils/Makefile
config.status: creating samples/Makefile
config.status: creating samples/c/Makefile
config.status: creating samples/python/Makefile
config.status: creating cvconfig.h
config.status: cvconfig.h is unchanged
config.status: executing depfiles commands

General configuration ================================================
    Compiler:                 g++
    CXXFLAGS:                 -Wall -fno-rtti -pipe -O3 -g -march=pres
cott -ffast-math -fomit-frame-pointer 

    Install path:             /usr/local

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

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

    Image I/O ---------------------
    Use libjpeg:              yes
    Use zlib:                 yes
    Use libpng:               yes
    Use libtiff:              yes
    Use libjasper:            yes
    Use libIlmImf:            no

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

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

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

Now run make ...

macbook3:/Users/ujpadmin/opencv-1.0.0 root# 
  • 一生懸命入れたのに,gtk+とffmpegとSWIGが認識されていない.
  • Video I/Oについて,MacOSだとQuickTimeがやってくれるので,問題ない.
macbook3:/Users/ujpadmin/opencv-1.0.0 root# make install
Making install in cxcore
Making install in src
test -z "/usr/local/lib" || /bin/sh ../../autotools/mkinstalldirs "/usr/local/
lib"
 /bin/sh ../../libtool --mode=install /usr/bin/install -c  'libcxcore.la' '/usr/
local/lib/libcxcore.la'
/usr/bin/install -c .libs/libcxcore.1.0.0.dylib /usr/local/lib/libcxcore.1.0.0.
dylib
(cd /usr/local/lib && { ln -s -f libcxcore.1.0.0.dylib libcxcore.1.dylib || { rm 
-f libcxcore.1.dylib && ln -s libcxcore.1.0.0.dylib libcxcore.1.dylib; }; })
(cd /usr/local/lib && { ln -s -f libcxcore.1.0.0.dylib libcxcore.dylib || { rm -
f libcxcore.dylib && ln -s libcxcore.1.0.0.dylib libcxcore.dylib; }; })
/usr/bin/install -c .libs/libcxcore.lai /usr/local/lib/libcxcore.la
----------------------------------------------------------------------
Libraries have been installed in:
   /usr/local/lib

If you ever happen to want to link against installed libraries
in a given directory, LIBDIR, you must either use libtool, and
specify the full pathname of the library, or use the `-LLIBDIR'
flag during linking and do at least one of the following:
   - add LIBDIR to the `DYLD_LIBRARY_PATH' environment variable
     during execution

See any operating system documentation about shared libraries for
more information, such as the ld(1) and ld.so(8) manual pages.
----------------------------------------------------------------------

〜略〜



 /Users/ujpadmin/opencv-1.0.0/autotools/install-sh -c -m 644 
'ref/pics/sigmoid_bipolar.png' '/usr/local/share/opencv/doc/ref/pics/sigmoid_
bipolar.png'
 /Users/ujpadmin/opencv-1.0.0/autotools/install-sh -c -m 644 
'ref/pics/subdiv.png' '/usr/local/share/opencv/doc/ref/pics/subdiv.png'
 /Users/ujpadmin/opencv-1.0.0/autotools/install-sh -c -m 644 
'ref/pics/threshold.png' '/usr/local/share/opencv/doc/ref/pics/threshold.png'
 /Users/ujpadmin/opencv-1.0.0/autotools/install-sh -c -m 644 
'python.txt' '/usr/local/share/opencv/doc/python.txt'
 /Users/ujpadmin/opencv-1.0.0/autotools/install-sh -c -m 644 
'python-wrappers-on-windows.txt' '/usr/local/share/opencv/doc/python-wrappers-on
-windows.txt'
make[2]: Nothing to be done for `install-exec-am'.
test -z "/usr/local/include/opencv" || /bin/sh ./autotools/mkinstalldirs "/usr/
local/include/opencv"
test -z "/usr/local/lib/pkgconfig" || /bin/sh ./autotools/mkinstalldirs "/usr/
local/lib/pkgconfig"
 /usr/bin/install -c -m 644 'opencv.pc' '/usr/local/lib/pkgconfig/opencv.pc'
macbook3:/Users/ujpadmin/opencv-1.0.0 root# 
  • インストール完了.

4.サンプルプログラムを動かす

  • ソースディレクトリに,pythonとCのサンプルが置いて在るので,使ってみる.
  • 今回は,Cのサンプルを利用する.
  • まずは,ディレクトリを移動して,ファイルを確認する.
macbook3:/Users/ujpadmin/opencv-1.0.0 root# cd samples/c/
macbook3:/Users/ujpadmin/opencv-1.0.0/samples/c root# ls -lat
total 4528
drwxrwxrwx   53 209   wheel    1802 Oct 24 16:35 .
-rw-r--r--    1 root  wheel   12849 Oct 24 16:35 Makefile
drwxrwxrwx    7 209   wheel     238 Oct 24 16:35 ..
-rw-r--r--    1 209   100     11567 Nov  4  2006 cvsample.dsp
-rw-r--r--    1 209   100     12676 Nov  4  2006 Makefile.in
-rw-r--r--    1 209   100     26301 Oct 31  2006 blobtrack.cpp
-rw-r--r--    1 209   100      6895 Oct 31  2006 camshiftdemo.c
-rw-r--r--    1 209   100      4593 Oct 31  2006 distrans.c
-rw-r--r--    1 209   100      2182 Oct 31  2006 inpaint.cpp
-rw-r--r--    1 209   100      2801 Oct 31  2006 morphology.c
-rw-r--r--    1 209   100      4789 Oct 31  2006 watershed.cpp
-rw-r--r--    1 209   100      4395 Oct 19  2006 dft.c
-rw-r--r--    1 209   100       697 Oct 18  2006 Makefile.am
-rw-r--r--    1 209   100       808 Oct 17  2006 makefile.ms
-rw-r--r--    1 209   100     10169 Oct 17  2006 cvsample.vcproj
-rw-r--r--    1 209   100     16603 Oct 17  2006 letter_recog.cpp
-rw-r--r--    1 209   100    712565 Oct 14  2006 letter-recognition.data
-rw-r--r--    1 209   100     10649 Oct 14  2006 mushroom.cpp
-rw-r--r--    1 209   100      3089 Oct  2  2006 contours.c
-rw-r--r--    1 209   100      1834 Aug 12  2006 houghlines.c
-rw-r--r--    1 209   100       526 Aug 10  2006 makefile.gnu
-rw-r--r--    1 209   100       445 Aug 10  2006 build_all.sh
-rw-r--r--    1 209   100      5200 Aug 10  2006 facedetect.c
-rw-r--r--    1 209   100      7592 Aug 10  2006 squares.c
-rw-r--r--    1 209   100      1624 Aug  8  2006 image.cpp
-rw-r--r--    1 209   100      1573 Aug  5  2006 edge.c
-rw-r--r--    1 209   100    373704 Aug  1  2006 agaricus-lepiota.data
-rw-r--r--    1 209   100      5597 Jul 19  2006 lkdemo.c
-rw-r--r--    1 209   100      2641 Jul 11  2006 convexhull.c
-rw-r--r--    1 209   100      5327 Jul 11  2006 ffilldemo.c
-rw-r--r--    1 209   100      4273 Jul 11  2006 kalman.c
-rw-r--r--    1 209   100      2691 Jul 11  2006 kmeans.c
-rw-r--r--    1 209   100      2798 Jul 11  2006 minarea.c
-rw-r--r--    1 209   100      6409 Jul  5  2005 motempl.c
-rw-r--r--    1 209   100      4366 Jul  1  2005 fitellipse.c
-rw-r--r--    1 209   100       989 Sep  3  2004 convert_cascade.c
-rw-r--r--    1 209   100      3128 Aug 19  2004 demhist.c
-rw-r--r--    1 209   100      5928 Aug 18  2004 delaunay.c
-rw-r--r--    1 209   100      5609 Aug 18  2004 drawing.c
-rwxr-xr-x    1 209   100        78 Aug 18  2004 facedetect.cmd
-rw-r--r--    1 209   100      1776 Aug 18  2004 laplace.c
-rw-r--r--    1 209   100      2298 Aug 18  2004 pyramid_segmentation.c
-rw-r--r--    1 209   100     85238 Dec  2  2002 airplane.jpg
-rw-r--r--    1 209   100    179920 Dec  2  2002 baboon.jpg
-rw-r--r--    1 209   100     82429 Dec  2  2002 fruits.jpg
-rw-r--r--    1 209   100     91814 Dec  2  2002 lena.jpg
-rw-r--r--    1 209   100     13160 Dec  2  2002 pic1.png
-rw-r--r--    1 209   100    259603 Dec  2  2002 pic2.png
-rw-r--r--    1 209   100     26055 Dec  2  2002 pic3.png
-rw-r--r--    1 209   100    110359 Dec  2  2002 pic4.png
-rw-r--r--    1 209   100     15790 Dec  2  2002 pic5.png
-rw-r--r--    1 209   100     16314 Dec  2  2002 pic6.png
-rw-r--r--    1 209   100     29365 Dec  2  2002 stuff.jpg
macbook3:/Users/ujpadmin/opencv-1.0.0/samples/c root# 
  • このbuild_all.shを実行すると,全てのサンプルが作成される.
  • その前に,環境変数PKG_CONFIGを設定する.
macbook3:~/opencv-1.0.0/samples/c ujpadmin$ export PKG_CONFIG_PAT
H=/usr/local/lib/pkgconfig
macbook3:~/opencv-1.0.0/samples/c ujpadmin$ 
  • コンパイルを実施する.
macbook3:/Users/ujpadmin/opencv-1.0.0/samples/c root# sh build_all.sh 
compiling camshiftdemo.c
compiling contours.c
compiling convert_cascade.c
compiling convexhull.c
compiling delaunay.c
compiling demhist.c
compiling dft.c
compiling distrans.c
compiling drawing.c
compiling edge.c
compiling facedetect.c
compiling ffilldemo.c
compiling fitellipse.c
compiling houghlines.c
compiling kalman.c
compiling kmeans.c
compiling laplace.c
compiling lkdemo.c
compiling minarea.c
compiling morphology.c
compiling motempl.c
compiling pyramid_segmentation.c
compiling squares.c
compiling blobtrack.cpp
compiling image.cpp
compiling inpaint.cpp
compiling letter_recog.cpp
compiling mushroom.cpp
compiling watershed.cpp
macbook3:/Users/ujpadmin/opencv-1.0.0/samples/c root#   
macbook3:/Users/ujpadmin/opencv-1.0.0/samples/c root# 
  • コンパイル&リンクできた模様.
  • 作成されたモジュールを確認する.
macbook3:/Users/ujpadmin/opencv-1.0.0/samples/c root# ls -lat|grep x
drwxrwxrwx   82 209   wheel    2788 Oct 24 18:50 .
-rwxr-xr-x    1 root  wheel   24652 Oct 24 18:50 mushroom
-rwxr-xr-x    1 root  wheel   19988 Oct 24 18:50 watershed
-rwxr-xr-x    1 root  wheel   19296 Oct 24 18:50 inpaint
-rwxr-xr-x    1 root  wheel   30884 Oct 24 18:50 letter_recog
-rwxr-xr-x    1 root  wheel   41880 Oct 24 18:50 blobtrack
-rwxr-xr-x    1 root  wheel   20852 Oct 24 18:50 image
-rwxr-xr-x    1 root  wheel   50904 Oct 24 18:50 pyramid_segmentation
-rwxr-xr-x    1 root  wheel   50920 Oct 24 18:50 squares
-rwxr-xr-x    1 root  wheel   51164 Oct 24 18:50 motempl
-rwxr-xr-x    1 root  wheel   49856 Oct 24 18:50 minarea
-rwxr-xr-x    1 root  wheel   50412 Oct 24 18:50 morphology
-rwxr-xr-x    1 root  wheel   49732 Oct 24 18:50 kmeans
-rwxr-xr-x    1 root  wheel   50160 Oct 24 18:50 laplace
-rwxr-xr-x    1 root  wheel   51052 Oct 24 18:50 lkdemo
-rwxr-xr-x    1 root  wheel   54084 Oct 24 18:50 kalman
-rwxr-xr-x    1 root  wheel   50608 Oct 24 18:50 ffilldemo
-rwxr-xr-x    1 root  wheel   50336 Oct 24 18:50 fitellipse
-rwxr-xr-x    1 root  wheel   49836 Oct 24 18:50 houghlines
-rwxr-xr-x    1 root  wheel   50976 Oct 24 18:50 facedetect
-rwxr-xr-x    1 root  wheel   54148 Oct 24 18:50 drawing
-rwxr-xr-x    1 root  wheel   50292 Oct 24 18:50 edge
-rwxr-xr-x    1 root  wheel   50620 Oct 24 18:50 distrans
-rwxr-xr-x    1 root  wheel   50680 Oct 24 18:50 demhist
-rwxr-xr-x    1 root  wheel   50120 Oct 24 18:50 dft
-rwxr-xr-x    1 root  wheel   49820 Oct 24 18:50 convexhull
-rwxr-xr-x    1 root  wheel   50860 Oct 24 18:50 delaunay
-rwxr-xr-x    1 root  wheel   54256 Oct 24 18:50 contours
-rwxr-xr-x    1 root  wheel   49764 Oct 24 18:50 convert_cascade
-rwxr-xr-x    1 root  wheel   55768 Oct 24 18:50 camshiftdemo
drwxrwxrwx    7 209   wheel     238 Oct 24 16:35 ..
-rw-r--r--    1 209   100      2641 Jul 11  2006 convexhull.c
-rwxr-xr-x    1 209   100        78 Aug 18  2004 facedetect.cmd
macbook3:/Users/ujpadmin/opencv-1.0.0/samples/c root# 
  • imageコマンドを実行してみる.
macbook3:/Users/ujpadmin/opencv-1.0.0/samples/c root# ./image
macbook3:/Users/ujpadmin/opencv-1.0.0/samples/c root# 
  • 次のような画像がでる.

  • 元の画像は,サンプルディレクトリにあるlena.jpである.

  • "grain"となっているので,粒々にしている模様...
  • 次に,顔認識エンジンのfacedetectを試してみる.
macbook3:/Users/ujpadmin/opencv-1.0.0/samples/c root# ./facedetect idols.jpg
macbook3:/Users/ujpadmin/opencv-1.0.0/samples/c root# 
  • 認識対象の画像ファイル名を指定して実行すると,次のような画面が表示される.

  • 何人か認識されていないようだが...
  • 次に,画像をつけないで実行する.
  • iSightが搭載さているMacだと,カメラからの画像が表示される.

  • コンソールには,次のように表示されている.
macbook3:/Users/ujpadmin/opencv-1.0.0/samples/c root# ./facedetect              
detection time = 1121.89ms
detection time = 1118.94ms
detection time = 1061.25ms
detection time = 1081.52ms
detection time = 1083.84ms
detection time = 1124.22ms
detection time = 1073.12ms
detection time = 1123.37ms
detection time = 1054.41ms
detection time = 1099.95ms
detection time = 1045.02ms
detection time = 1067.28ms
detection time = 1029.43ms
detection time = 1036.62ms
detection time = 1012.85ms
detection time = 1008.84ms
detection time = 995.082ms
detection time = 1011.56ms
detection time = 1236.46ms
detection time = 1166.59ms
detection time = 1125.85ms
detection time = 1172.99ms
detection time = 1018.88ms
detection time = 1022.81ms
detection time = 1068.03ms
detection time = 1062.4ms
detection time = 1066.55ms
macbook3:/Users/ujpadmin/opencv-1.0.0/samples/c root# 
  • カメラで撮影されている画像を常に追いかけて,顔の発見(detection)をしている.
  • 以上.


広告スペース
Google