Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

App crash error code c0000374

Hi guys.. I need your help... cant finish my project because of this error: c0000374. After starting the program it fails and crashes. I use opencv 3.1 with VS 2010. Programm basically have to show a video window from computer webcam.

I run this code in button click eventhandler from my MFC dialog based project:

void CsdkDemoDlg::OnBnClickedButtonRecognizeFace() { cout << "start recognizing..." << endl;

//load pre-trained data sets
Ptr<cv::face::FaceRecognizer>  model = cv::face::createFisherFaceRecognizer(num_compFisher,thresholdFisher);
model->load("C:\\Users\\Alexey\\Documents\\Visual Studio 2012\\Projects\\RaptorBOT_PC_Control\\С++\\RaptorBOT_PC_Control\\OpenCV3.1\\IMG_DB\\YML\\fisherface.yml");


Mat testSample = imread("C:\\Users\\Alexey\\Documents\\Visual Studio 2012\\Projects\\RaptorBOT_PC_Control\\С++\\RaptorBOT_PC_Control\\OpenCV3.1\\IMG_DB\\DB_Bilityuk_Alexey\\Snapshot_20160106.JPG");

int img_width = testSample.cols;
int img_height = testSample.rows;

string classifier = "C:\\Program Files\\opencv\\build_\\install\\etc\\haarcascades\\haarcascade_frontalface_default.xml";


CascadeClassifier face_cascade;
string window = "Capture - face";


if (!face_cascade.load(classifier)){
    cout << " Error loading file" << endl;

}

VideoCapture cap(1);


if (!cap.isOpened())
{
    cout << "exit" << endl;

}

//double fps = cap.get(CV_CAP_PROP_FPS);
//cout << " Frames per seconds " << fps << endl;
//namedWindow(window, 1);

int count = 0;

while(true)
{

    vector<Rect> faces;
    Mat frame;
    Mat graySacleFrame;
    Mat original;

    cap >> frame;
    //cap.read(frame);
    count = count + 1;//count frames;

    if (!frame.empty()){

        //clone from original frame
        original = frame.clone();

        //convert image to gray scale and equalize
        cvtColor(original, graySacleFrame, CV_BGR2GRAY);
        //equalizeHist(graySacleFrame, graySacleFrame);

        //detect face in gray image
        face_cascade.detectMultiScale(graySacleFrame, faces, 1.1, 3, 0, cv::Size(80, 80));          
        //face_cascade.detectMultiScale(graySacleFrame, faces);

        //number of faces detected
        cout << faces.size() << " faces detected" << endl;          
        std::string frameset = SSTR(count);
        std::string faceset = SSTR(faces.size());

        int width = 0, height = 0;

        //region of interest
        //cv::Rect roi;

        //person name
        string Pname = "";

        for (int i = 0; i < faces.size(); i++)
        {
            //region of interest
            Rect face_i = faces[i];

            //crop the roi from grya image
            Mat face = graySacleFrame(face_i);

            //resizing the cropped image to suit to database image sizes
            Mat face_resized;
            cv::resize(face, face_resized, Size(img_width, img_height), 1.0, 1.0, INTER_CUBIC);

            //recognizing what faces detected
            int label = -1; double confidence = 0;
            model->predict(face_resized, label, confidence);            

            cout << " confidencde " << confidence << endl;
            cout << " label " << label << endl;

            //drawing green rectagle in recognize face
            rectangle(original, face_i, CV_RGB(255, 0, 0), 1);

            string text = "Opredelen";
            if (label == 1){
                //string text = format("Person is  = %d", label);
                Pname = "Alexey";
            }
            if (label == 2){

                Pname = "Tanya";
            }
                if (label == -1 || label == 0){

                Pname = "Neizvestniy";
            }


            int pos_x = std::max(face_i.tl().x - 10, 0);
            int pos_y = std::max(face_i.tl().y - 10, 0);

            //name the person who is in the image
            putText(original, text, Point(pos_x, pos_y), FONT_HERSHEY_COMPLEX_SMALL, 1.0, CV_RGB(255, 0, 0), 1.0);
            //cv::imwrite("E:/FDB/"+frameset+".jpg", cropImg);

        }


        putText(original, "Kadrov: " + frameset, Point(30, 60), CV_FONT_HERSHEY_COMPLEX_SMALL, 1.0, CV_RGB(255, 0, 0), 1.0);
        putText(original, "Imya: " + Pname, Point(30, 90), CV_FONT_HERSHEY_COMPLEX_SMALL, 1.0, CV_RGB(255, 0, 0), 1.0);
        //display to the winodw

        cv::imshow("IDC_STATIC", original);



        //cout << "model infor " << model->getDouble("threshold") << endl;

    }
    if (waitKey(30) >= 0) break;

}

}

And right after the end of the while loop programm throws app crash with the folowing information:

Problem name: APPCRASH App name: sdkDemo.exe App version: 1.0.0.1 Timestamp: 56900b92 Error module name: StackHash_cf76 Version of error module: 6.1.7601.17725 Error module timestamp: 4ec49b8f Exception code: c0000374

Help me to find out the problem please...

Also run the cmd /scannnow procedure. Evrythink is ok with dlls and system files...

App crash error code c0000374

Hi guys.. I need your help... cant finish my project because of this error: c0000374. After starting the program it fails and crashes. I use opencv 3.1 with VS 2010. Programm basically have to show a video window from computer webcam.webcam. I found the matter of the problem, it because of CPropertySheet and CPropertyPages. My MFC dialog project is based on MFC Property sheets, and i noticed that when i am trying to run this code in Property Sheet project it crashes and fails every time, but if i run the same code in MFC dialog based project without any property pages and property sheets it runs well without any crashes and errors. I really need a help of guru, i can't find any solutions in google, even close to my problem, it seems like nobody meet the same problem...

I run this code in button click eventhandler from my MFC dialog based project:property page (if i run the same code not from the mfc property page, but from simple mfc dialog, it works without problem):

void CsdkDemoDlg::OnBnClickedButtonRecognizeFace() { cout << "start recognizing..." << endl;

//load pre-trained data sets
Ptr<cv::face::FaceRecognizer>  model = cv::face::createFisherFaceRecognizer(num_compFisher,thresholdFisher);
model->load("C:\\Users\\Alexey\\Documents\\Visual Studio 2012\\Projects\\RaptorBOT_PC_Control\\С++\\RaptorBOT_PC_Control\\OpenCV3.1\\IMG_DB\\YML\\fisherface.yml");


Mat testSample = imread("C:\\Users\\Alexey\\Documents\\Visual Studio 2012\\Projects\\RaptorBOT_PC_Control\\С++\\RaptorBOT_PC_Control\\OpenCV3.1\\IMG_DB\\DB_Bilityuk_Alexey\\Snapshot_20160106.JPG");

int img_width = testSample.cols;
int img_height = testSample.rows;

string classifier = "C:\\Program Files\\opencv\\build_\\install\\etc\\haarcascades\\haarcascade_frontalface_default.xml";


CascadeClassifier face_cascade;
string window = "Capture - face";


if (!face_cascade.load(classifier)){
    cout << " Error loading file" << endl;

}

VideoCapture cap(1);


if (!cap.isOpened())
{
    cout << "exit" << endl;

}

//double fps = cap.get(CV_CAP_PROP_FPS);
//cout << " Frames per seconds " << fps << endl;
//namedWindow(window, 1);

int count = 0;

while(true)
{

    vector<Rect> faces;
    Mat frame;
    Mat graySacleFrame;
    Mat original;

    cap >> frame;
    //cap.read(frame);
    count = count + 1;//count frames;

    if (!frame.empty()){

        //clone from original frame
        original = frame.clone();

        //convert image to gray scale and equalize
        cvtColor(original, graySacleFrame, CV_BGR2GRAY);
        //equalizeHist(graySacleFrame, graySacleFrame);

        //detect face in gray image
        face_cascade.detectMultiScale(graySacleFrame, faces, 1.1, 3, 0, cv::Size(80, 80));          
        //face_cascade.detectMultiScale(graySacleFrame, faces);

        //number of faces detected
        cout << faces.size() << " faces detected" << endl;          
        std::string frameset = SSTR(count);
        std::string faceset = SSTR(faces.size());

        int width = 0, height = 0;

        //region of interest
        //cv::Rect roi;

        //person name
        string Pname = "";

        for (int i = 0; i < faces.size(); i++)
        {
            //region of interest
            Rect face_i = faces[i];

            //crop the roi from grya image
            Mat face = graySacleFrame(face_i);

            //resizing the cropped image to suit to database image sizes
            Mat face_resized;
            cv::resize(face, face_resized, Size(img_width, img_height), 1.0, 1.0, INTER_CUBIC);

            //recognizing what faces detected
            int label = -1; double confidence = 0;
            model->predict(face_resized, label, confidence);            

            cout << " confidencde " << confidence << endl;
            cout << " label " << label << endl;

            //drawing green rectagle in recognize face
            rectangle(original, face_i, CV_RGB(255, 0, 0), 1);

            string text = "Opredelen";
            if (label == 1){
                //string text = format("Person is  = %d", label);
                Pname = "Alexey";
            }
            if (label == 2){

                Pname = "Tanya";
            }
                if (label == -1 || label == 0){

                Pname = "Neizvestniy";
            }


            int pos_x = std::max(face_i.tl().x - 10, 0);
            int pos_y = std::max(face_i.tl().y - 10, 0);

            //name the person who is in the image
            putText(original, text, Point(pos_x, pos_y), FONT_HERSHEY_COMPLEX_SMALL, 1.0, CV_RGB(255, 0, 0), 1.0);
            //cv::imwrite("E:/FDB/"+frameset+".jpg", cropImg);

        }


        putText(original, "Kadrov: " + frameset, Point(30, 60), CV_FONT_HERSHEY_COMPLEX_SMALL, 1.0, CV_RGB(255, 0, 0), 1.0);
        putText(original, "Imya: " + Pname, Point(30, 90), CV_FONT_HERSHEY_COMPLEX_SMALL, 1.0, CV_RGB(255, 0, 0), 1.0);
        //display to the winodw

        cv::imshow("IDC_STATIC", original);



        //cout << "model infor " << model->getDouble("threshold") << endl;

    }
    if (waitKey(30) >= 0) break;

}

}

And right after the end of the while loop programm throws app crash with the folowing information:

Problem name: APPCRASH App name: sdkDemo.exe App version: 1.0.0.1 Timestamp: 56900b92 Error module name: StackHash_cf76 Version of error module: 6.1.7601.17725 Error module timestamp: 4ec49b8f Exception code: c0000374

I specially make a couple of new projects to be completly sure that the problem is in the property pages and that it for sure... Maybe i have to define cv::imshow("IDC_STATIC", original) window as one of the property page of main Property Sheet, but i dont know how to do it...

Help me to find out the problem please...solution please. How to run opencv project with mfc property pages???

Also run the cmd /scannnow procedure. Evrythink is ok with dlls and system files...

App crash error code c0000374

Hi guys.. I need your help... cant finish my project because of this error: c0000374. After starting the program it fails and crashes. I use opencv 3.1 with VS 2010. Programm basically have to show a video window from computer webcam. I found the matter of the problem, it because of CPropertySheet and CPropertyPages. My MFC dialog project is based on MFC Property sheets, and i noticed that when i am trying to run this code in Property Sheet project it crashes and fails every time, but if i run the same code in MFC dialog based project without any property pages and property sheets it runs well without any crashes and errors. I really need a help of guru, i can't find any solutions in google, even close to my problem, it seems like nobody meet the same problem...

I run this code in button click eventhandler from my MFC property page (if i run the same code not from the mfc property page, but from simple mfc dialog, it works without problem):

void CsdkDemoDlg::OnBnClickedButtonRecognizeFace() { cout << "start recognizing..." << endl;

//load pre-trained data sets
Ptr<cv::face::FaceRecognizer>  model = cv::face::createFisherFaceRecognizer(num_compFisher,thresholdFisher);
model->load("C:\\Users\\Alexey\\Documents\\Visual Studio 2012\\Projects\\RaptorBOT_PC_Control\\С++\\RaptorBOT_PC_Control\\OpenCV3.1\\IMG_DB\\YML\\fisherface.yml");


Mat testSample = imread("C:\\Users\\Alexey\\Documents\\Visual Studio 2012\\Projects\\RaptorBOT_PC_Control\\С++\\RaptorBOT_PC_Control\\OpenCV3.1\\IMG_DB\\DB_Bilityuk_Alexey\\Snapshot_20160106.JPG");

int img_width = testSample.cols;
int img_height = testSample.rows;

string classifier = "C:\\Program Files\\opencv\\build_\\install\\etc\\haarcascades\\haarcascade_frontalface_default.xml";


CascadeClassifier face_cascade;
string window = "Capture - face";


if (!face_cascade.load(classifier)){
    cout << " Error loading file" << endl;

}

VideoCapture cap(1);


if (!cap.isOpened())
{
    cout << "exit" << endl;

}

//double fps = cap.get(CV_CAP_PROP_FPS);
//cout << " Frames per seconds " << fps << endl;
//namedWindow(window, 1);

int count = 0;

while(true)
{

    vector<Rect> faces;
    Mat frame;
    Mat graySacleFrame;
    Mat original;

    cap >> frame;
    //cap.read(frame);
    count = count + 1;//count frames;

    if (!frame.empty()){

        //clone from original frame
        original = frame.clone();

        //convert image to gray scale and equalize
        cvtColor(original, graySacleFrame, CV_BGR2GRAY);
        //equalizeHist(graySacleFrame, graySacleFrame);

        //detect face in gray image
        face_cascade.detectMultiScale(graySacleFrame, faces, 1.1, 3, 0, cv::Size(80, 80));          
        //face_cascade.detectMultiScale(graySacleFrame, faces);

        //number of faces detected
        cout << faces.size() << " faces detected" << endl;          
        std::string frameset = SSTR(count);
        std::string faceset = SSTR(faces.size());

        int width = 0, height = 0;

        //region of interest
        //cv::Rect roi;

        //person name
        string Pname = "";

        for (int i = 0; i < faces.size(); i++)
        {
            //region of interest
            Rect face_i = faces[i];

            //crop the roi from grya image
            Mat face = graySacleFrame(face_i);

            //resizing the cropped image to suit to database image sizes
            Mat face_resized;
            cv::resize(face, face_resized, Size(img_width, img_height), 1.0, 1.0, INTER_CUBIC);

            //recognizing what faces detected
            int label = -1; double confidence = 0;
            model->predict(face_resized, label, confidence);            

            cout << " confidencde " << confidence << endl;
            cout << " label " << label << endl;

            //drawing green rectagle in recognize face
            rectangle(original, face_i, CV_RGB(255, 0, 0), 1);

            string text = "Opredelen";
            if (label == 1){
                //string text = format("Person is  = %d", label);
                Pname = "Alexey";
            }
            if (label == 2){

                Pname = "Tanya";
            }
                if (label == -1 || label == 0){

                Pname = "Neizvestniy";
            }


            int pos_x = std::max(face_i.tl().x - 10, 0);
            int pos_y = std::max(face_i.tl().y - 10, 0);

            //name the person who is in the image
            putText(original, text, Point(pos_x, pos_y), FONT_HERSHEY_COMPLEX_SMALL, 1.0, CV_RGB(255, 0, 0), 1.0);
            //cv::imwrite("E:/FDB/"+frameset+".jpg", cropImg);

        }


        putText(original, "Kadrov: " + frameset, Point(30, 60), CV_FONT_HERSHEY_COMPLEX_SMALL, 1.0, CV_RGB(255, 0, 0), 1.0);
        putText(original, "Imya: " + Pname, Point(30, 90), CV_FONT_HERSHEY_COMPLEX_SMALL, 1.0, CV_RGB(255, 0, 0), 1.0);
        //display to the winodw

        cv::imshow("IDC_STATIC", original);



        //cout << "model infor " << model->getDouble("threshold") << endl;

    }
    if (waitKey(30) >= 0) break;

}

}

And right after the end of the while loop programm throws app crash with the folowing information:

Problem name: APPCRASH App name: sdkDemo.exe App version: 1.0.0.1 Timestamp: 56900b92 Error module name: StackHash_cf76 Version of error module: 6.1.7601.17725 Error module timestamp: 4ec49b8f Exception code: c0000374

Error ocurs in dbgheap.c

extern "C" _CRTIMP int __cdecl _CrtIsValidHeapPointer( const void * pUserData ) { if (!pUserData) return FALSE;

    if (!_CrtIsValidPointer(pHdr(pUserData), sizeof(_CrtMemBlockHeader), FALSE))
        return FALSE;

    return HeapValidate( _crtheap, 0, pHdr(pUserData) );

}<----- HERE OCURS THE ERROR

I specially make a couple of new projects to be completly sure that the problem is in the property pages and that it for sure... Maybe i have to define cv::imshow("IDC_STATIC", original) window as one of the property page of main Property Sheet, but i dont know how to do it...

Help me to find out the solution please. How to run opencv project with mfc property pages???