c++opencvcascade-classifiereye-detection

error C2679: binary '=' : no operator found which takes a right-hand operand of type 'IplImage *' (or there is no acceptable conversion) OpenCV


Hi I am trying to use this code Cascade Classifier. I got the error in title. I am using VS 2013 and OpenCV 3.0.

I am new and I don't understand why this code works for everybody except me? What is the way to fix it?

Here error line:

frame = cvQueryFrame(capture);

Solution

  • cvQueryFrame returns an IplImage*, while your frame is of type Mat.

    You have two options:

    1) Convert from IplImage* to Mat

    frame = Mat(cvQueryFrame(capture));
    

    2) use C++ syntax, with VideoCapture (recommended)

    VideoCapture cap(0);
    ...
    for(;;)
    {
        Mat frame;
        cap >> frame;
        ...
    }