AccessViolationException on detectMultiScale

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

AccessViolationException on detectMultiScale

opencv-users mailing list
I want use CascadeClassifier to detect face but when
face_cascade.detectMultiScale execute in my code rise :
AccessViolationException, this is my code :

#include "stdafx.h"#include "FaceDetection.h"using namespace cv;
FaceDetection::FaceDetection(void){
    face_cascade = CascadeClassifier();
    face_Cascade_Path =
"D:\\book\\ComputerLessons\\CascadesFiles\\haarcascade_frontalface_alt.xml";
    face_cascade.load(face_Cascade_Path);}
Mat FaceDetection::detect(Mat input){
    Mat face = Mat(input);
    faceExist = false;
    if (!face_cascade.empty())
    {
        std::vector<Rect> faces;
        faces.resize(1);
        Mat grayInput;
        cvtColor( input, grayInput, COLOR_BGR2GRAY );
        equalizeHist( grayInput, grayInput );
        face_cascade.detectMultiScale( grayInput, faces, 1.1, 2,
CASCADE_SCALE_IMAGE, Size(100, 100));
        float maxArea = 0;
        int total = faces.size();
        if (total>0)
        {
            for (size_t i = 0; i < faces.size(); i++)
            {
                Rect r = faces[i];
                if (r.area() > maxArea)
                {
                    faceExist = true;
                    faceBound = r;
                    maxArea = r.area();
                }
            }
            face = input(faceBound);
        }
    }
    return face;}Rect FaceDetection::getBound(){
    if (faceExist)
    {
        return faceBound;
    }
    else
    {
        return Rect();
    }}

this is exception details:[image: enter image description here]
<http://i.stack.imgur.com/KPoe3.png>

my pc is x64 architecture and image size is : 800 x 600 and opencv version
I use is 3.1 why this exception occurred ?
Loading...