cv::Exception at memory location 0x000000484DBDDFA0. [closed]

asked 2016-01-21 08:23:14 -0600

skander gravatar image

updated 2016-01-21 08:38:06 -0600

berak gravatar image

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);
}

edit retag flag offensive reopen merge delete

Closed for the following reason the question is answered, right answer was accepted by sturkmen
close date 2020-12-08 18:21:00.038557

Comments

1

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 ...

berak gravatar imageberak ( 2016-01-21 08:40:18 -0600 )edit

please berak tell me how to fix Error loading face cascade Error loading eyes cascade

skander gravatar imageskander ( 2016-01-21 09:18:06 -0600 )edit

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 ?

berak gravatar imageberak ( 2016-01-21 09:27:25 -0600 )edit

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 :/

skander gravatar imageskander ( 2016-01-21 09:42:55 -0600 )edit

NEVER USE SINGLE BACKSLASHES IN FILENAMES

berak gravatar imageberak ( 2016-01-21 09:59:01 -0600 )edit

so how i define the directory where is files

skander gravatar imageskander ( 2016-01-21 10:05:02 -0600 )edit

either: String face_cascade_name = "C:Users/Acer/Documents/Visual Studio 2015/Projects/opencv/haarcascade_frontalface_alt.xml"; or String face_cascade_name = "C:Users\\Acer\\Documents\\Visual Studio 2015\\Projects\\opencv\\haarcascade_frontalface_alt.xml";

berak gravatar imageberak ( 2016-01-21 10:08:47 -0600 )edit

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"

skander gravatar imageskander ( 2016-01-21 10:16:12 -0600 )edit

that is not an error, but a warning

berak gravatar imageberak ( 2016-01-21 10:28:47 -0600 )edit

i can't find solution for the error aout loading xml files please help me

skander gravatar imageskander ( 2016-01-21 17:29:48 -0600 )edit