Search code examples
c++opencvface-detectiondlib

Dlib deserialize face shape model using istream


I'm total noob as it comes to dlib. I know how to load face shape model directly from file and it works.

dlib::shape_predictor face_shape_predictor_;
dlib::deserialize("shape_predictor_68_face_landmarks.dat") >> face_shape_predictor_;

But how to deserialize from istream?

I have the following code:

dlib::shape_predictor face_shape_predictor_;
std::stringstream face_data_stream;

loadDataToStream(face_data_stream);
dlib::deserialize(face_shape_predictor_, face_data_stream);

And I don't know how to get it work.


Solution

  • Actually, adding the following code:

    using namespace dlib;
    

    Solved the compilation problem.