をキャプチャすることができません、私のウェブカメラは、それが他のlaptop.The出力で動作open.Butすることができません「エラー:キャプチャがnullである」である他のノートパソコンで動作し、画像をキャプチャすることができません画像OpenCVの
#include "cv.h"
#include "highgui.h"
#include <stdio.h>
// A Simple Camera Capture Framework
int main() {
CvCapture* capture = cvCaptureFromCAM(CV_CAP_ANY);
if (!capture) {
fprintf(stderr, "ERROR: capture is NULL \n");
getchar();
return -1;
}
// Create a window in which the captured images will be presented
cvNamedWindow("mywindow", CV_WINDOW_AUTOSIZE);
// Show the image captured from the camera in the window and repeat
while (1) {
// Get one frame
IplImage* frame = cvQueryFrame(capture);
if (!frame) {
fprintf(stderr, "ERROR: frame is null...\n");
getchar();
break;
}
cvShowImage("mywindow", frame);
// Do not release the frame!
//If ESC key pressed, Key=0x10001B under OpenCV 0.9.7(linux version),
//remove higher bits using AND operator
if ((cvWaitKey(10) & 255) == 27) break;
}
// Release the capture device housekeeping
cvReleaseCapture(&capture);
cvDestroyWindow("mywindow");
return 0;
}
1.私は私のUSBウェブカメラを試しました。それはまだ仕事をしませんでした。2.私はvisual studio.23を使用しています。私はあなたの.exeセットアップとgetbackを使ってそれを再インストールしようとします... thanks @ rics –
Windowsで作業しているなら、このページ(http://code.google.com/p/javaac/wiki/Windows7AndOpenCV)あなたに役立つことがあります。これはキャプチャではなくVideoInputFrameGrabberを示唆しています。 (私はそれまでこれを試していない) – rics
ya私は感謝.. @ rics働いた –