0

I have a problem with a program on opencv3, this is the debug backtrace

Loaded the Face Detection cascade classifier [lbpcascade_frontalface.xml].
Loaded the 1st Eye Detection cascade classifier [haarcascade_lefteye_2splits.xml].
Loaded the 2nd Eye Detection cascade classifier [haarcascade_righteye_2splits.xml].
VIDIOC_QUERYMENU: Invalid argument
VIDIOC_QUERYMENU: Invalid argument
VIDIOC_QUERYMENU: Invalid argument
[New Thread 0x7fffdef9d700 (LWP 17762)]
[New Thread 0x7fffdeb9c700 (LWP 17764)]
[New Thread 0x7fffd6b9c700 (LWP 17763)]
+++++Cara detectada
        ojos abiertos

Program received signal SIGSEGV, Segmentation fault.
0x0000000000403967 in cv::Mat::release() ()
(gdb) bt
#0  0x0000000000403967 in cv::Mat::release() ()
#1  0x0000000000403730 in cv::Mat::~Mat() ()
#2  0x000000000040342a in main ()

and this is the main code, i'm new on opencv and c++, i'm trying to detect if the eyes are closed or not. I hope you would help meto see my mistake

int main(){
CascadeClassifier faceCascade;
CascadeClassifier eyeCascade1;
CascadeClassifier eyeCascade2;
initDetectors(faceCascade, eyeCascade1, eyeCascade2);
// Initialize and allocate memory to load the video stream from camera
VideoCapture camera(0);

if (!camera.isOpened())
    return 1;

while (true)
{
    // Grab and retrieve each frames of the video sequentially

    Mat frame;

    camera >> frame;

    // Set Region of Interest to the area defined by the box
    cv::Rect roi;
    roi.x = 0;
    roi.y = 0;
    roi.width = 640;
    roi.height = 480;

    // Crop the original image to the defined ROI
    cv::Mat crop = frame(roi);

    cv::imshow("crop", crop);

    vector<Mat> preprocessedFaces;

    Mat displayedFrame;
    frame.copyTo(displayedFrame);

    // Find a face and preprocess it to have a standard size and contrast & brightness.
    Rect faceRect;  // Position of detected face.
    Rect searchedLeftEye, searchedRightEye; // top-left and top-right regions of the face, where eyes were searched.
    Point leftEye, rightEye;    // Position of the detected eyes.

    getPreprocessedFace(frame, faceWidth, faceCascade, eyeCascade1, eyeCascade2, preprocessLeftAndRightSeparately, &faceRect, &leftEye, &rightEye, &searchedLeftEye, &searchedRightEye);

    //wait for 40 milliseconds
    int c = waitKey(40);

    //exit the loop if user press "Esc" key  (ASCII value of "Esc" is 27)
    if (27 == char(c))
        break;
}

return 0;}

this is the full code http://pasted.co/51b5c5dc

boui
  • 11
  • 4
  • You'll probably get some more helpful data (i.e. line number) out of that backtrace if you turn on the `-g` (debugging symbols) compiler flag. – CodeMouse92 Oct 15 '15 at 23:27
  • Also, [this question](http://stackoverflow.com/questions/33047452/definitive-list-of-common-reasons-for-segmentation-faults) *might* be helpful, though I can't say at this point. I didn't spot anything glaring in the code at first glance. – CodeMouse92 Oct 15 '15 at 23:29
  • make sure you're not linking debug libs in release mode, or viceversa. – Miki Oct 16 '15 at 00:28

0 Answers0