Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

myproject.exe has triggered a breakpoint.

Hi guys

When I compile my code I face this error:

kooh1.exe has triggered a breakpoint.

, I don't know exactly what the problem is! maybe the size of the array caused this error:

here is a part of my code:(when it detects a face this error appears)

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(90, 90));

            //number of faces detected
            cout << faces.size() << " faces detected" << endl;
            std::string frameset = std::to_string(count);
            std::string faceset = std::to_string(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;

                //drawing green rectagle in recognize face
                rectangle(original, face_i, CV_RGB(0, 255, 0), 1);
                string text = "Detected";
                if (label == 40){
                    //string text = format("Person is  = %d", label);
                    Pname = "gihan";
                }
                else{
                    Pname = "unknown";
                }


                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(0, 255, 0), 1.0);
                //cv::imwrite("E:/FDB/"+frameset+".jpg", cropImg);

            }


            putText(original, "Frames: " + frameset, Point(30, 60), CV_FONT_HERSHEY_COMPLEX_SMALL, 1.0, CV_RGB(0, 255, 0), 1.0);
            putText(original, "Person: " + Pname, Point(30, 90), CV_FONT_HERSHEY_COMPLEX_SMALL, 1.0, CV_RGB(0, 255, 0), 1.0);
            //display to the winodw
            cv::imshow(window, original);

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

        }
        if (waitKey(10) >= 0) cout<<"hi"<<endl;
    }

}

myproject.exe Myproject.exe has triggered a breakpoint.

Hi guys

When I compile my code I face this error:

kooh1.exe has triggered a breakpoint.

, I don't know exactly what the problem is! maybe the size of the array caused this error:

here is a part of my code:(when it detects a face this error appears)

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(90, 90));

            //number of faces detected
            cout << faces.size() << " faces detected" << endl;
            std::string frameset = std::to_string(count);
            std::string faceset = std::to_string(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;

                //drawing green rectagle in recognize face
                rectangle(original, face_i, CV_RGB(0, 255, 0), 1);
                string text = "Detected";
                if (label == 40){
                    //string text = format("Person is  = %d", label);
                    Pname = "gihan";
                }
                else{
                    Pname = "unknown";
                }


                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(0, 255, 0), 1.0);
                //cv::imwrite("E:/FDB/"+frameset+".jpg", cropImg);

            }


            putText(original, "Frames: " + frameset, Point(30, 60), CV_FONT_HERSHEY_COMPLEX_SMALL, 1.0, CV_RGB(0, 255, 0), 1.0);
            putText(original, "Person: " + Pname, Point(30, 90), CV_FONT_HERSHEY_COMPLEX_SMALL, 1.0, CV_RGB(0, 255, 0), 1.0);
            //display to the winodw
            cv::imshow(window, original);

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

        }
        if (waitKey(10) >= 0) cout<<"hi"<<endl;
    }

}