前の日 / 次の日 / 最新 / 2009-11

01 02 03 04 05 06 07 08 09 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30

2009-11-18 Wed

highgui を使ってみる [D言語][OpenCV]

OpenCV をビルドできたかな?
D言語から OpenCV を呼んでみる。

highgui200.lib を coffimplib で変換
highgui200.dll と cxcore200.dll にパスを通す。
以下のソースを作成

module test;
pragma(lib,"highgui200.lib");
extern(C){
    const CV_WINDOW_AUTOSIZE = 1;
    int cvNamedWindow(char* name,int flags);
    void cvDestroyWindow(char* name);
    int cvWaitKey(int delay);
}

void main()
{
    cvNamedWindow(cast(char*)"Window".ptr,CV_WINDOW_AUTOSIZE);
    cvWaitKey(0);
    cvDestroyWindow(cast(char*)"Window".ptr);
}

で、ウインドウが表示された。

リンクするライブラリはデバッグとリリースで
別のライブラリにするべきだろうか?

debug{
    pragma(lib,"highgui200d.lib");
}else{
    pragma(lib,"highgui200.lib");
}