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;
}
}
A breakpoint is not an error! Its a place where you halt the execution of your code to inspect what it is doing and in what state all variables are at that moment. Make sure that you did not place one yourself, in most IDE environments, this is seen as a red dot marked in front of a line ...
@StevenPuttemans don't you think that it's devoted to array size?
@StevenPuttemans I have to say that Visual Studio sometimes shows errors as "myprogram.exe has triggered a breakpoint". I think it's due to compiler options, but in any case it's not due to an explicit manual breakpoint.
@Mehdi.Am you should carefully debug your program and see what exact line throws the error
@LorenaGdL, did not know that! Could this mean some assert was generated?
@StevenPuttemans I don't know, to be honest. I haven't still discovered why those weird triggered a breakpoint messages appear. Usually, CV_ASSERT errors show as normal exceptions. I suspect they point out memory/heap errors, but just a guess