動作確認

動作確認コード。

#include <cv.h>
#include <highgui.h>

using namespace cv;

int main(int argc, char* argv[])
{
    VideoCapture cap(0);
    if(!cap.isOpened()) {
        return -1;
    }

    namedWindow("sample", CV_WINDOW_AUTOSIZE);
    for(;;) {
        Mat frame;
        cap >> frame;
        imshow("sample", frame);
        if(waitKey(30)>=0) break;
    }
    return 0;
}

そしてコンパイルと実行。

$ export PKG_CONFIG_PATH=/usr/local/lib/pkgconfig/
$ g++ -O3 -Wall -o sample sample.cpp `pkg-config --cflags --libs opencv`
$ ./sample

動きました\(゚∀゚)/