著者アーカイブ

マイナビ様より「OpenCV 2 プログラミングブック」を献本頂きましたのでレビューを
簡単にまとめたいと思います.購入する際の参考にして頂ければと思います.

OpenCV 2 プログラミングブック OpenCV 2.2/2.3対応

著者/訳者:OpenCV 2 プログラミングブック制作チーム

出版社:マイナビ( 2011-12-27 )

定価:¥ 3,570

Amazon価格:¥ 3,570

単行本(ソフトカバー) ( 296 ページ )

ISBN-10 : 4839941262

ISBN-13 : 9784839941260




構成としては書籍ページの目次に沿って(本音ベースで)書いています.

▽Chapter.1 導入 編
OpenCVの歴史だけでなくてライセンス面の記載も
これまでの書籍に比べてしっかり書かれている印象です。

▽Chapter.2 スタートアップ 編
1 OpenCV 2.3簡単インストール(Windows編)
2 OpenCVをMacで利用する
3 Ubuntu 10.04 LTSでOpenCVを利用する

スクリーンショット付きで解説が丁寧なのと,Win,Mac,Linux一通り載っているのは○。
あと,Linuxでよくトラブルになりがちなカメラキャプチャについてもシステムの問題か
OpenCVの問題かを切り分けるための基本アプリ紹介は地味にうれしいかも。

4 C++インタフェース
従来の書籍ではあまり触れられていないC, C++ I/Fの違いやC,C++ I/Fの共存方法についての
記載はこれまでC I/Fで作った資産を再活用したい場合には嬉しいです。

5 Pythonインタフェース
スクリーンショット付きでわかりやすいのと結構嵌りがちなNumpyインストールも
きちんと書かれています。Mac,Linuxについては紙面の都合で省略?
 
6 GPUによる画像処理
GPU関連の記載はちょっと薄めな印象。
おそらく,執筆当時はあまりGPU機能が有効になる関数が多くなかったことや
最近のGPU実装更新のスピードが速いためだと思われます。ただ,基本的な使い方は
押さえてあるので導入についてはすんなり読めるはず。欲を言うなら,
GPU実装されている関数リスト等があると便利かも。

▽Chapter.3 リファレンス 編
1 cv::Matの基本処理
2 線形代数
3 画像処理
4 描画処理

C++ I/F最初の難関であるMatの使い方や基本的な画像処理の関数の使い方が
一通り網羅されています。サンプル付きなので非常にとっかかりやすいと思います。

5 入出力
6 その他の機能

画像の読み書きやカメラキャプチャ等よく使う機能は一通り網羅されているため,
サンプルを参考にすれば大抵のことはできると思います.
欲を言えばDirectShowを使ったキャプチャもVideoCaptureで使えることが
あまり知られていないようなのでその辺の記述もあるとなお良いかも。
あと,Qtを有効にした場合の基本的な使い方もあるとうれしかったです(結構便利なので)。

▽Chapter.4 ケーススタディ 編
1 画素値の直接操作

画素アクセス方法別の速度比較はパフォーマンス的に重要なトピックなので
初学者だけでなくとも読む価値があると思います。
 
2 カメラキャリブレーションとステレオ視による距離計測
基本的なキャリブレーションのやり方については記載されているので簡単に試せます。
欲を言えば2.3から導入されたCirclesGridを使ったキャリブレーションの
記事もあると嬉しかったかも。

3 画像のJPEG圧縮とPSNRの計算
これまでのOpenCV本ではあまり取り上げられていないと思われる画像指標PSNRについて
記載があるので,この辺りのデータを取る必要がある研究者向けとしては割とうれしいトピック。

4 簡単な笑顔度の算出
5 CAPTCHA画像の生成

比較的簡単なアルゴリズムの組み合わせによる笑顔度算出サンプルが紹介されている。
OpenCVの中身に慣れてきたら自身でアルゴリズム改善等をしてみて楽しめるトピック。

6 KinectとOpenCVの連携
Kinect連携はOpenCVを使ってやるサンプルはWeb上にそこまで多くない(Kinectを
他のSDK叩くサンプルが多い)のでサンプルとしてまとまっているのは重宝するかも。
 
7 ミニチュア風画像処理
8 SURF特徴を使ったイメージモザイキング
このあたりのトピックは最近のスマートフォン向け画像処理アプリでよく使われると思われるので
オリジナルの画像編集アプリ等を作りたい場合には参考になりそう。

9 機械学習と画像処理
クラスタリングの話がメイン。
この分野の需要はあると思われるのでもう少しボリュームがあると嬉しいかも。
(OpenCVの機械学習がアレなので意図的に削られた?)

10 顔の子供化
11 Photoshop向けプラグインの作成

OpenCVを使ったPhotoshop向けプラグイン作成の記事は
従来のOpenCV本には無いはずなので,自前で作ったアルゴリズムを俺々Photoshopプラグインを
作りたい場合には有用(おそらくWeb上にもあまり情報は無いはず)。

12 動画ファイルをカメラ入力のように扱う
研究の場合,動画ファイルを入力としてアルゴリズム実装することが多いので
開発効率という点でこのトピックは嬉しいと思います。よく動画読み込みで
コーデック関連のトラブルを耳にするのでその辺まで突っ込んだ記事があれば良かったかも。

Comments コメントなし »

なんと半年振りの更新です(苦笑)

OpenCV 2.2をiOS SDK上で動作させたい一心で
半徹夜状態でスクリプトを作って記事を書きました。。。
OpenCV/Using OpenCV 2.2 on iOS SDK 4.1

それでは良いお年を!

Comments コメントなし »

blog放置プレイ3ヶ月というかなり酷い状態です.
書きたいことはあるんだけどまとめる時間が無いという。。。orz

******************

このエントリの続きを読む »

Comments コメントなし »

2ヶ月以上,blog更新サボってました.スミマセン.twitterはいろいろ危険だ!!

あと,OpenCV関連のことはごにょごにょとやっているので
形になったら記事でも書きます(多分)

このエントリの続きを読む »

Comments コメントなし »



から機能追加しました!!

・財布画像アップデート

twitter上で前回の動画に言及してくれていた
ちょりさん(http://www.nicovideo.jp/mylist/15194746)に
ダメもとで財布イラストを依頼してみたところ,
キレイな財布イラストを描いて頂きました.
本当にありがとうございます!!

・小銭音再生機能
加速度センサの値を取得して,激しく振りが検出された場合に
小銭の音が鳴ります.

・スライドして段階的にバリバリ鳴る
指をスライドすることで段階的にバリバリ鳴ります

・財布の開閉が可能
指を上下にスライドすることで財布が開閉します.
※バリバリ音は開くときのみに鳴ります

・「やめて!!」表示機能
振ったとき or たくさんスライドすると「やめて!!」という
メッセージが表示されます.

AppStore申請完了しました!!
受領されたらアプリの配信URLと動画を公開したいと思います.

このエントリの続きを読む »

Comments 1 コメント »

昨日の酒の勢いで,「彼氏の財布がマジックテープ式だった」
iPhoneアプリで再現してみました.製作時間1時間ということで
かなりヘタレな実装ですが,マジックテープ式財布を扱った
iPhoneアプリとしては世界初なはず!!(多分)



絵が得意な方がいらっしゃいましたら,絵を提供下さい。。。
動画にある絵はパワポでてきとーに描きました(苦笑)

某絵師さんに財布のイラスト依頼しました!!

*************************

【追記(2009/10/26)】

タグがカオスな感じになってきた!!
「無駄に高画質」タグはちょっと意外だったかも.
無駄って言うな-!! ヽ(`Д´)ノウワァァァン
#ビデオカメラ持ってるのに出すのが面倒でデジカメで撮りました.

あと,「実写でもいいんじゃね」「くだらねぇww」
ってコメントに対しては,自分でもそう思ってるので
全く反論の余地がありません(汗)

【追記(2009/11/1)】
描画方法をOpenGL ESに変更したり,100均でマジックテープ入手して
サンプリングしたりしてます.短い音をスワイプ量によって鳴らして
それらしく鳴るのかはやってみないとなんとも。。。
#コメントが流れすぎて要望機能の全てを拾えないかも.

今週末くらいに形になって,気分が乗ったらAppStoreに申請したいな-と.

このエントリの続きを読む »

Comments コメントなし »

約2週間ぶりの更新です.

twitterはちょこちょこ投稿してるんですが,
blogはほったらかしというgdgdっぷりですみません.

あと,10月後半の週末は,

IVRC 2009
インタラクティブ東京2009
ワークショップ@DIGITAL CONTENT EXPO 2009

があるので,計画立てとかないと全部回れそうにない。。。
そろそろちゃんと考えようかな.

*************************



をちょっとだけ歌ってみました.
今度こそ実年齢より声が幼くなってないはず(多分)

今年の年末はちゃんと帰省しようかな。。。



このエントリの続きを読む »

Comments コメントなし »

9/27に東京ゲームショウ2009に行ってきました.
上京してから初めての参加だったので勝手が分かってなかったけど,
思ったよりも混雑していなかったような.

あと,撮影した写真はdandelion1124@Picasaにて公開中.
会場暗くて手ぶれしまくったり,ゲーム画面撮影禁止だったりとかで
枚数少なめ.


下の写真は会場で買ったおみやげ.
かわいかったので勢いで買ってしまった(汗)

Comments コメントなし »

かえるさんに教えて頂いたSENSEWARE展に行ってきました.
人工繊維の可能性を探るイベントということで,専門的には明らかに
畑違いですが,公式サイトを見ると楽しそうだったので足を運んでみました.

会場が東京ミッドタウンなせいか知的な感じの人が多かった気がします.
どうみても(自分が)場違いです.スミマセンでした。。。orz

あと,アクセスマップの左上「21_21」というところが
会場なんですけど,最初,本当にそんな形してると思ってなくて
軽くスルーしそうになった人がここにいます(苦笑)


これは庭園に貼ってあったポスター.
公式マスコットなのかよくわかんないけどなんだか憎めないヤツです.



会場入り口のポスター.いろんな人が撮影してた.



受付を済ませると,入場証としてシールがもらえます(※写真にあるのは一般用).
これを服や鞄等の目立つところに貼るんだけど,会場出てから帰宅するまで
はがすのを忘れてた人です。。。orz

まー,誰も見てないから良いよね??多分.



会場入り口の書籍販売コーナーに置いてあったディスプレイ.


というわけで,ここ以降は基本的に撮影禁止だったので写真は無しです.
※後日行かれる方は気を付けましょう.

なので,下記に公式ムービーを掲載します.



作品一覧は公式サイトにおまかせするとして,
個人的なイチオシはダントツで「拭き掃除ロボット」です.
なんかもこもこ動いててとにかくカワイイ(※動画の1:07あたりで出てきます).

あとは,撥水布をうまく使ったWATER LOGOや光を通す
コンクリートなんかは繊維の知識が無くても素直に楽しかったり.


一通り見終わった後,タイミング良くトークイベントをやってたので参加.
かえるさんも近くを通ったらしく,ニアミスした模様.

トークイベントが終わって感じたのは,一線級でバリバリ活躍している
デザイナーさんは自分のやりたい事が明確かつ貪欲だということ.
分野は違えど自分はまだまだその辺の詰めが甘いなと思ったりとかした.


というわけで,繊維やアートとか良くわかんないし。。。って人もいろいろ
刺激を受けられると思うので,東京近辺の方は足を運んでみると良いかも.

Comments 2 コメント »

Open Computer Vision Library@SourceForge.netにて
OpenCV 2.0 beta(※2009/9/12現在はWindows版のみ)が
リリースされたということでインストールしてみました.

また,OpenCV 1.1preからの変更点について
ChangeLogの記述を抜粋しました.

>>> New functionality, features: <<<

– General:
* The brand-new C++ interface for most of OpenCV functionality
(cxcore, cv, highgui) has been introduced.
Generally it means that you will need to do less coding to achieve the same results;
it brings automatic memory management and many other advantages.
See the C++ Reference section in opencv/doc/opencv.pdf and opencv/include/opencv/*.hpp.
The previous interface is retained and still supported.

* The source directory structure has been reogranized; now all the external headers are placed
in the single directory on all platforms.

* The primary build system is CMake, http://www.cmake.org (2.6.x is the preferable version).
+ In Windows package the project files for Visual Studio, makefiles for MSVC,
Borland C++ or MinGW are note supplied anymore; please, generate them using CMake.

+ In MacOSX the users can generate project files for Xcode.

+ In Linux and any other platform the users can generate project files for
cross-platform IDEs, such as Eclipse or Code Blocks,
or makefiles for building OpenCV from a command line.

* OpenCV repository has been converted to Subversion, hosted at SourceForge:

http://opencvlibrary.svn.sourceforge.net/svnroot/opencvlibrary

where the very latest snapshot is at

http://opencvlibrary.svn.sourceforge.net/svnroot/opencvlibrary/trunk,

and the more or less stable version can be found at

http://opencvlibrary.svn.sourceforge.net/svnroot/opencvlibrary/tags/latest_tested_snapshot

– CXCORE, CV, CVAUX:

* CXCORE now uses Lapack (CLapack 3.1.1.1 in OpenCV 2.0) in its various linear algebra functions
(such as solve, invert, SVD, determinant, eigen etc.) and the corresponding old-style functions
(cvSolve, cvInvert etc.)

* Lots of new feature and object detectors and descriptors have been added
(there is no documentation on them yet), see cv.hpp and cvaux.hpp:

+ FAST – the fast corner detector, submitted by Edward Rosten

+ MSER – maximally stable extremal regions, submitted by Liu Liu

+ LDetector – fast circle-based feature detector by V. Lepetit (a.k.a. YAPE)

+ Fern-based point classifier and the planar object detector -
based on the works by M. Ozuysal and V. Lepetit

+ One-way descriptor – a powerful PCA-based feature descriptor,
(S. Hinterstoisser, O. Kutter, N. Navab, P. Fua, and V. Lepetit,
“Real-Time Learning of Accurate Patch Rectification”).
Contributed by Victor Eruhimov

+ Spin Images 3D feature descriptor – based on the A. Johnson PhD thesis;
implemented by Anatoly Baksheev

+ Self-similarity features – contributed by Rainer Leinhart

+ HOG people and object detector – the reimplementation of Navneet Dalal framework
(http://pascal.inrialpes.fr/soft/olt/). Currently, only the detection part is ported,
but it is fully compatible with the original training code.
See cvaux.hpp and opencv/samples/c/peopledetect.cpp.

+ Extended variant of the Haar feature-based object detector – implemented by Maria Dimashova.
It now supports Haar features and LBPs (local binary patterns);
other features can be more or less easily added

+ Adaptive skin detector and the fuzzy meanshift tracker – contributed by Farhad Dadgostar,
see cvaux.hpp and opencv/samples/c/adaptiveskindetector.cpp

* The new traincascade application complementing the new-style HAAR+LBP object detector has been added.
See opencv/apps/traincascade.

* The powerful library for approximate nearest neighbor search FLANN by Marius Muja
is now shipped with OpenCV, and the OpenCV-style interface to the library
is included into cxcore. See cxcore.hpp and opencv/samples/c/find_obj.cpp

* The bundle adjustment engine has been contributed by PhaseSpace; see cvaux.hpp

* Added dense optical flow estimation function (based on the paper
“Two-Frame Motion Estimation Based on Polynomial Expansion” by G. Farnerback).
See cv::calcOpticalFlowFarneback and the C++ documentation

* Image warping operations (resize, remap, warpAffine, warpPerspective)
now all support bicubic and Lanczos interpolation.

* Most of the new linear and non-linear filtering operations (filter2D, sepFilter2D, erode, dilate …)
support arbitrary border modes and can use the valid image pixels outside of the ROI
(i.e. the ROIs are not “isolated” anymore), see the C++ documentation.

* The data can now be saved to and loaded from GZIP-compressed XML/YML files, e.g.:
cvSave(“a.xml.gz”, my_huge_matrix);

– MLL:
* Added the Extremely Random Trees that train super-fast,
comparing to Boosting or Random Trees (by Maria Dimashova).

* The decision tree engine and based on it classes
(Decision Tree itself, Boost, Random Trees)
have been reworked and now:
+ they consume much less memory (up to 200% savings)
+ the training can be run in multiple threads (when OpenCV is built with OpenMP support)
+ the boosting classification on numerical variables is especially
fast because of the specialized low-overhead branch.

* mltest has been added. While far from being complete,
it contains correctness tests for some of the MLL classes.

– HighGUI:
* [Linux] The support for stereo cameras (currently Videre only) has been added.
There is now uniform interface for capturing video from two-, three- … n-head cameras.

* Images can now be compressed to or decompressed from buffers in the memory,
see the C++ HighGUI reference manual

– Documentation:
* The reference manual has been converted from HTML to LaTeX (by James Bowman and Caroline Pantofaru),
so there is now:
+ opencv.pdf for reading offline
+ and the online up-to-date documentation
(as the result of LaTeX->Sphinx->HTML conversion) available at

http://opencv.willowgarage.com/documentation/index.html

– Samples, misc.:
* Better eye detector has been contributed by Shiqi Yu,
see opencv/data/haarcascades/*[lefteye|righteye]*.xml
* sample LBP cascade for the frontal face detection
has been created by Maria Dimashova,
see opencv/data/lbpcascades/lbpcascade_frontalface.xml
* Several high-quality body parts and facial feature detectors
have been contributed by Modesto Castrillon-Santana,
see opencv/data/haarcascades/haarcascade_mcs*.xml

>>> Optimization:
* Many of the basic functions and the image processing operations
(like arithmetic operations, geometric image transformations, filtering etc.)
have got SSE2 optimization, so they are several times faster.

– The model of IPP support has been changed. Now IPP is supposed to be
detected by CMake at the configuration stage and linked against OpenCV.
(In the beta it is not implemented yet though).

* PNG encoder performance improved by factor of 4 by tuning the parameters

>>> Bug fixes: <<<
TBD
(see http://sourceforge.net/tracker/?group_id=22870&atid=376677 of the list
of the closed and still opened bugs).

Many thanks to everybody who submitted bug reports and/or provided the patches!

>>> Known issues:
* configure+autotools based build is currently broken.
Please, use CMake.
* OpenCV bug tracker at SF still lists about 150 open bugs.
Some of them may be actually fixed already, and most of the remaining bugs
are going to be fixed by OpenCV 2.0 gold.
* IPP is not supported. As the new OpenCV includes a lot of SSE2 code,
it may be not such a serious problem, though.
The support (at least for most important functions that do not have
SSE2 optimization) will be returned in 2.0 gold.
* The documentation has been updated and improved a lot, but it still
needs quite a bit of work:
– some of the new functionality in cvaux is not described yet.
– the bibliography part is broken
– there are quite a few known bugs and typos there
– many of the hyperlinks are not working.
* The existing tests partly cover the new functionality
(via the old backward-compatibility OpenCV 1.x API), but the coverage is
not sufficient of course.
* The new-style Python interface is not included yet

Many of the problems will be addressed in 2.0 gold.
If you have found some specific problem, please, put the record to the bug tracker:

http://sourceforge.net/tracker/?group_id=22870

Better if the bug reports will include a small code sample in C++/python +
all the necessary data files needed to reproduce the problem.


これに説明を書こうと思ったけど,変更が多すぎて大変そうなので
今回はインストール周りの注意点だけ書いてみます.

■(デフォルト)インストールディレクトリの変更

従来:C:\Program Files\OpenCV
OpenCV 2.0 beta:C:\Program Files\OpenCV1.2


個人的には
・バージョンがなぜ1.2なのか(OpenCV 1.2にしようとした名残??)
・なぜインストールディレクトリ名を変更したのか
が気になるところ.

■インクルードパスの変更
OpenCV 2.0 betaでは必要なヘッダが一つのディレクトリにまとまっています.
そのため,インクルードパスとしては下記のパス一つだけ指定すればOK.
これは地味にうれしい.

C:\Program Files\OpenCV1.2\include\opencv


ただし,従来のインクルードパスとは異なるので,
Visual Studioの設定変更が必要となります.

■ライブラリパスの変更

従来:C:\Program Files\OpenCV\lib
OpenCV 2.0 beta:C:\Program Files\OpenCV1.2\lib


従来のライブラリパスとは異なるので,
Visual Studioの設定変更が必要となります.

■ライブラリ名の変更

従来:cv.lib
OpenCV 2.0 beta:cv120.lib


ライブラリ名が変わっているので,ソース中で

#pragma comment(lib,”cv.lib”)

としている場合にはライブラリ名の修正が必要になります.

■ライブラリビルド方法変更
従来のOpenCVはVisual Studioのソリューションファイルが
提供されていましたが,OpenCV 2.0 betaからCmakeを用いて
Visual Studioのソリューションファイルを生成し,ライブラリを
ビルドする必要があります.

以前書いたOpenCV/SVN版 OpenCVビルド – Point at infinity
Cmakeを使ったビルド部分を参考にすることでビルドが可能です.
(※指定パスを変更する必要あり)

その他にもディレクトリ構成がかなり変更されていますが,
それは別の機会にでも。。。

ということで正式版が出るまでしばらく遊んでみようかなーと.

Comments コメントなし »