Сбои приложения говорят: «Место чтения нарушения доступа» 0xbaadf04d - PullRequest
0 голосов
/ 24 января 2012

Я делаю проект в opencv ... я получаю ошибку, подобную этой

"Необработанное исключение в 0x775a15ee в touch.exe: 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;
}

1 Ответ

1 голос
/ 24 января 2012

Попробуйте заменить

frame=cvCreateCameraCapture(2);

с

frame=cvCreateCameraCapture(-1);
if (!frame) {
    puts("Couldn't detect a camera.");
    return(1);
}
Добро пожаловать на сайт PullRequest, где вы можете задавать вопросы и получать ответы от других членов сообщества.
...