약 35-40 프레임을 캡처 한 후 웹캠에서 캡처 한 얼굴을 성공적으로 감지했지만 응용 프로그램이 충돌하고 코드의 관련 부분 만 게시했습니다 _Image
은 클래스입니다 내가 구현 했어. 변경 내 코드 조금 AVI 파일을 재생하는 경우35-40 웹캠 프레임을 읽은 후 응용 프로그램이 충돌 함
_Image *Obj;
CvCapture* capture = cvCaptureFromCAM(CV_CAP_ANY);
if (!capture)
{
fprintf(stderr, "\n\n---ERROR: capture is NULL---\n");
}
IplImage * frame = cvQueryFrame(capture);
// Show the image captured from the camera in the window and repeat
while (1)
{
frame = cvQueryFrame(capture);
if (!frame) {
fprintf(stderr, "ERROR: Webcam frame is null...Unexpected Error - Exiting");
getchar();
exit(0);
}
Obj = new _Image(frame);
if(Obj==0)
{
fprintf(stderr, "\nERROR: Out of Memory!!\n");
cvReleaseImage(&frame);
cvDestroyAllWindows();
// Release the capture device
cvReleaseCapture(&capture);
exit(0);
}
flag = Obj->detect_face_in_image();
if(flag!=0)
{
Obj->add_frame_name();
Obj->webcam_reader(*Obj);
}
// Do not release the frame!
delete Obj;
cvNamedWindow("WEBCAM", CV_WINDOW_AUTOSIZE);
cvShowImage ("WEBCAM", frame);
if ((cvWaitKey(10)) == 27)
{
cvReleaseImage(&frame);
cvDestroyAllWindows();
// Release the capture device
cvReleaseCapture(&capture);
break;
}
}
그러나 나는이 단지 웹캠과 발생, 충돌의이 종류를하지 않습니다. 나는 Windows XP send or dont send error report
를 얻는다, 충돌 전에 특정한 오류 메시지 없음.
당신이 목격하고있는 충돌 (액세스 위반, 스택 오버플로 등 ...) 또는이 코드의 어디에서 충돌이 발생했는지는 언급하지 않았습니다. 디버거에서 무엇을 볼 수 있습니까? – Johnsyweb
프로그램이 그냥 충돌합니다. 마치 작업 관리자에서 작업을 끝내는 것처럼 ... 정확한 이유를 찾는 구체적인 방법이 없습니다 ... 여기 디버거를 어떻게 사용해야합니까? –
@Johnsyweb - 'Obj 삭제'문제를 해결할 때 문제가 해결되었지만 메모리 누수가 발생하지는 않으므로 어떻게 대응해야합니까? –