C++ Debug Assertion Failed While Using Opencv

I am trying to compare two image and check whether they belongs to same person. This code giving Debug assertion failed Like here. I have checked, it can access to photos. Then what is the problem. People say that you are trying to access the something which is not actually exist. However, I could not find anything about it in my code. Regards;

        #include <iostream>
        #include <string>
        #include "opencv2\core\core.hpp"
        #include "opencv2\core.hpp"
        #include "opencv2\face.hpp"
        #include "opencv2\highgui\highgui.hpp"
       #include "opencv2\objdetect\objdetect.hpp"
        #include "opencv2\opencv.hpp"
        #include<direct.h>
        #include "vector"


      using namespace std;
      using namespace cv;
      using namespace cv::face;

     int main() {
       vector<Mat> img;
       img[0]= imread("C://Users//Gökhan//Desktop//faces//faces442.jpg");
       Mat img2 = imread("C://Users//Gökhan//Desktop//faces//faces448.jpg");
       vector<int> label;
       label[0] = 1;
       Ptr<LBPHFaceRecognizer> model = LBPHFaceRecognizer::create();
       model->train(img[0], label[0]);
       int predictedLabel = model->predict(img2);
       if (predictedLabel == 1) {
       cout << "found";
  }

  }


Read more here: https://stackoverflow.com/questions/68469602/c-debug-assertion-failed-while-using-opencv

Content Attribution

This content was originally published by Gokhan at Recent Questions - Stack Overflow, and is syndicated here via their RSS feed. You can read the original post over there.

%d bloggers like this: