EWCLIBヘルプ
というものを使いました。
下記コード(これだけではビルドが通りませんが…)の要領で Webcam 画像を表示してみました。
// OpenCVCameraViewer.cpp : コンソール アプリケーションのエントリ ポイントを定義します。 // #include "stdafx.h" /** * @file Threshold.cpp * @brief Sample code that shows how to use the diverse threshold options offered by OpenCV * @author OpenCV team */ #include "opencv2/highgui/highgui.hpp" #include "ewclib/ewclib.h" using namespace cv; const char* window_name = "Threshold Demo"; /** * @function main */ int main(int, char** argv) { EWC_Open(0, 640, 480, 60); EWC_Run(0); void* pBuffer = nullptr; namedWindow(window_name, WINDOW_AUTOSIZE); EWC_GetBuffer(0, &pBuffer); Mat dst = Mat(480, 640, CV_8UC4, pBuffer); while (true) { imshow(window_name, dst); int c; c = waitKey(20); if ((char)c == 27) { break; } } destroyWindow(window_name); EWC_Close(0); }
Visual Studio 2015 でビルドしようとすると qedit.h が足りないと怒られたので、次の記事を参考に解決してみました。
失った時を数えて: #include "qedit.h"におけるエラーの解決方法
実行すると Webcam の映像がウィンドウに表示されます。
この ewclib の中を勉強してみたいと思います。