在VC++6.0上使用opencv捕获摄像头并输出,但弹出的窗口一片黑,怎么回事?求助。
用的是电脑自带的摄像头,程序如下:#include"cv.h"#include"cxcore.h"#include"highgui.h"intmain(intargc,c...
用的是电脑自带的摄像头,程序如下:
#include "cv.h"
#include "cxcore.h"
#include "highgui.h"
int main(int argc, char** argv)
{
char c;
IplImage* frame=0;
CvCapture* capture = cvCaptureFromCAM(0);
//CvCapture* capture=cvCreateFileCapture("E:\My videos\documentary\japen.avi");
cvNamedWindow("Example2", CV_WINDOW_AUTOSIZE);
while(1)
{
frame=cvQueryFrame(capture);
if(!frame) break;
cvShowImage("Example2",frame);
c= cvWaitKey(33);
if(c>=0) break;
}
cvReleaseCapture(&capture);
cvDestroyWindow("Example2");
return 0;
} 展开
#include "cv.h"
#include "cxcore.h"
#include "highgui.h"
int main(int argc, char** argv)
{
char c;
IplImage* frame=0;
CvCapture* capture = cvCaptureFromCAM(0);
//CvCapture* capture=cvCreateFileCapture("E:\My videos\documentary\japen.avi");
cvNamedWindow("Example2", CV_WINDOW_AUTOSIZE);
while(1)
{
frame=cvQueryFrame(capture);
if(!frame) break;
cvShowImage("Example2",frame);
c= cvWaitKey(33);
if(c>=0) break;
}
cvReleaseCapture(&capture);
cvDestroyWindow("Example2");
return 0;
} 展开
2个回答
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询