Porting code from opencv 2.4.1 to opencv 4.8

Hello dear community! I am trying to port some absolete code from v.2.4.1 to v.4.8, could you please help me to port this code:

cv::Mat reconstructFace(const cv::Ptr<cv::face::FaceRecognizer> model, const cv::Mat preprocessedFace)
    try {
        cv::Mat eigenvectors = model->get<Mat>("eigenvectors");
        cv::Mat averageFaceRow = model->get<Mat>("mean");

What should i use instead of get method and how to get cv::Mat from cv::face::FaceRecognizer? Thank you

please look at a more recent code sample instead.

then – be aware, that this method is never used for any recognition, it’s only to visualize temporary eigenvectors.

1 Like

Thank you very much, it helped!!! Yea i know the code is very old, but it work under opencv_next right now)))

please also consider using dnns instead of eigenfaces, etc.

1 Like

Thank you for the usful link, is there any complete tutorial or code example of face recognition using opencv dnns?