Skip to content
eiichiromomma edited this page Aug 16, 2014 · 2 revisions

"A Discriminatively Trained, Multiscale, Deformable Part Model", Pedro Felzenszwalb, David McAllester and Deva Ramanan,IEEE Conference on Computer Vision and Pattern Recognition, 2008.

Discriminatively Trained Multiscale Deformable Part Modelsのサンプルを動かしてみる。

環境

MATLAB7.2b + Visual Studio 2008

手順

  1. サンプルを拾って展開
  2. mex -setup
  3. compile.mを実行
  4. demo.mを実行

で動けば万万歳。うちの環境ではそもそもVC++が認識されずダメだった。(パスの問題かも?)

mexを使った手動コンパイル

mexはMATLABとC言語を繋ぐコンパイラらしい。

ソースには一部Visual C++で対応していない個所がある。

resize.ccの加工

alphainfo ofs[len];

alphainfo* ofs = new alphainfo[len];

とする。

bzero(dst,  chan*width*dheight*sizeof(double));

memset(dst, '\0', chan*width*dheight*sizeof(double));

とする。

round関数が無いので

    inline int round(double x)
    {
      return (int)(x+1-0.5);
    }

とでも定義しておく。

df.ccの加工

int32_t -> int

と書換える。

手順

  1. Visual Studioのコマンドプロンプト(スタートメニューから探す)を開く

  2. ソースの置かれているフォルダに移動(TABキーを駆使すれば楽に到達可能)

  3. 以下のコマンドを実行

    mex -f "c:\Program Files\MATLAB\R2007b\bin\win32\mexopts\msvc80opts.bat" resize.cc mex -f "c:\Program Files\MATLAB\R2007b\bin\win32\mexopts\msvc80opts.bat" dt.cc mex -f "c:\Program Files\MATLAB\R2007b\bin\win32\mexopts\msvc80opts.bat" features.cc mex -f "c:\Program Files\MATLAB\R2007b\bin\win32\mexopts\msvc80opts.bat" fconv.cc

あとはMATLABからdemo.mを実行。

Clone this wiki locally