取得の仕方がわかりません。
下記ソースコード14行目で、openCVによるウィンドウを立ち上げていますが、このウィンドウを設定すればよろしいのでしょうか。
そもそも、音声の設定のためになぜウィンドウハンドルを設定する必要があるのでしょうか?
どなたか、詳しい方教えていただけないでしょうか。
よろしくお願いします。
int main()
{
//画像処理
CvCapture *capture = cvCreateCameraCapture(0);
CvSize size = cvSize(WIDTH, HEIGHT);
IplImage *sourceImage = cvCreateImage(size, IPL_DEPTH_8U,3);
IplImage *grayImage = cvCreateImage(size, IPL_DEPTH_8U,1);
IplImage *grayLastImage = cvCreateImage(size, IPL_DEPTH_8U,1);
IplImage *TimeSubImage = cvCreateImage(size, IPL_DEPTH_8U,1);
char windowNameCapture[] = "Capture";
cvNamedWindow(windowNameCapture, CV_WINDOW_AUTOSIZE);
//音声処理
//*********初期化***************
pDxSound->InitDirectSound( );//ここでHWND型のウィンドウハンドルを使う
while (1)
{
sourceImage = cvQueryFrame(capture);
cvFlip(sourceImage,sourceImage,0);//画面反転
cvCvtColor(sourceImage, grayImage, CV_BGR2GRAY); // グレースケールへ変換
cvAbsDiff(grayImage, grayLastImage, TimeSubImage);//フレーム間差分
cvThreshold(TimeSubImage, TimeSubImage, 30, 255, CV_THRESH_BINARY); //2値化処理(閾値10)
gSabunValue = getFeature(TimeSubImage);//差分量取得
wprintf( L"Feature Value: %f\n", gSabunValue);
cvShowImage(windowNameCapture, TimeSubImage);
if (cvWaitKey(33) == 'q') break;
cvCopy(grayImage, grayLastImage);
}
//リソースを開放
cvReleaseCapture(&capture);
cvReleaseImage(&grayImage);
cvReleaseImage(&grayLastImage);
cvReleaseImage(&TimeSubImage);
cvDestroyWindow(windowNameCapture);
return 0;
}