我在opencv做项目...我得到这样的错误
“touch.exe中0x775a15的未处理异常:0xC0000005:访问冲突读取位置0xbaadf04d。”
代码是
using namespace std;
#include "stdafx.h"
#include "cv.h"
#include "cxcore.h"
#include "highgui.h"
#include "math.h"
#include <iostream>
#include <stdio.h>
#include <string.h>
#include <conio.h>
#include <sstream>
int main(int argc, char* argv[]){
//declerations
CvCapture *frame=0;
IplImage *image=0;
cvNamedWindow( "Image taken", CV_WINDOW_AUTOSIZE );
frame=cvCreateCameraCapture(2);
frame=cvCreateCameraCapture(2);
image = cvQueryFrame(frame);
cvShowImage("Image taken", image);
cvWaitKey(0);
return 0;
}
答案 0 :(得分:1)
尝试替换
frame=cvCreateCameraCapture(2);
带
frame=cvCreateCameraCapture(-1);
if (!frame) {
puts("Couldn't detect a camera.");
return(1);
}