cv::Exception at memory location 0x000000484DBDDFA0. [closed]
When i run my program in VS 2015 this is the error im getting :
Unhandled exception at 0x00007FFA3A268B9C in opencv.exe: Microsoft C++ exception: cv::Exception at memory location 0x000000484DBDDFA0.
my program is :
#include <stdio.h>
#include <opencv/cv.h>
#include <opencv/highgui.h>
#include <opencv/cxcore.h>
/*------ Declaration des variables globales ------*/
char key;
CvHaarClassifierCascade *cascade;
CvMemStorage *storage;
/*---------- Declaration des fonctions -----------*/
void detectFaces(IplImage *img);
/*------------------------------------------------*/
int main(void)
{
/* Declaration des variables */
CvCapture *capture;
IplImage *img;
const char *filename = "C:Users\Acer\Desktop\faceDetect\haarcascade_frontalface_alt.xml";
/* Chargement du classifieur */
cascade = (CvHaarClassifierCascade*)cvLoadHaarClassifierCascade(filename, cvSize(24, 24));
/* Ouverture du flux video de la camera */
capture = cvCreateCameraCapture(-1);
// Ouverture d'un fichier video
//capture = cvCreateFileCapture("C:Users\Acer\Desktop\faceDetect\cam.avi");
/* Initialisation de l'espace memoire */
storage = cvCreateMemStorage(0);
/* Creation d'une fenetre */
cvNamedWindow("Window-FT", 1);
/* Boucle de traitement */
while (key != 'q')
{
img = cvQueryFrame(capture);
detectFaces(img);
key = cvWaitKey(10);
}
/* Liberation de l'espace memoire*/
cvReleaseCapture(&capture);
cvDestroyWindow("Window-FT");
cvReleaseHaarClassifierCascade(&cascade);
cvReleaseMemStorage(&storage);
return 0;
}
/*------------------------------------------------*/
void detectFaces(IplImage *img)
{
/* Declaration des variables */
int i;
CvSeq *faces = cvHaarDetectObjects(img, cascade, storage, 1.1, 3, 0, cvSize(40, 40));
for (i = 0; i<(faces ? faces->total : 0); i++)
{
CvRect *r = (CvRect*)cvGetSeqElem(faces, i);
cvRectangle(img, cvPoint(r->x, r->y), cvPoint(r->x + r->width, r->y + r->height), CV_RGB(255, 0, 0), 1, 8, 0);
}
cvShowImage("Window-FT", img);
}
please do not use outdated c-api code like that any more.
throw it away entirely, start again with the objdetect tutorial and report back ...
please berak tell me how to fix Error loading face cascade Error loading eyes cascade
the error means, that those cascade files were not found, you will hat to correct the path to those xml files (try with an absolute path first., and use "/" , not "\" as seperator)
btw, do you see the difference between the c and the c++ version now ?
i tried :
String face_cascade_name = "/path/to/the/haarcascade_frontalface_alt.xml"; String eyes_cascade_name = "/path/to/the/haarcascade_eye_tree_eyeglasses.xml"; and : String face_cascade_name = "C:Users\Acer\Documents\Visual Studio 2015\Projects\opencv\haarcascade_frontalface_alt.xml"; String eyes_cascade_name = "C:Users\Acer\Documents\Visual Studio 2015\Projects\opencv\haarcascade_eye_tree_eyeglasses.xml";
and no result the same error :/
NEVER USE SINGLE BACKSLASHES IN FILENAMES
so how i define the directory where is files
either:
String face_cascade_name = "C:Users/Acer/Documents/Visual Studio 2015/Projects/opencv/haarcascade_frontalface_alt.xml";
orString face_cascade_name = "C:Users\\Acer\\Documents\\Visual Studio 2015\\Projects\\opencv\\haarcascade_frontalface_alt.xml";
same error with both :/ i have an other error "opencv.exe' (Win32): Loaded 'C:\Windows\System32\kernel.appcore.dll'. Cannot find or open the PDB file"
that is not an error, but a warning
i can't find solution for the error aout loading xml files please help me