Reputation: 440
In python API of dlib there is a function called compute_face_descriptor()
but I couldn't find any alternative to it in C++ API.
How can I create an alternative to it in C++?
Upvotes: 4
Views: 2233
Reputation: 1644
compute_face_descriptor()
is coming from dlib.face_recognition_model_v1(face_recognition_model)
face_recognition_model
contains dlib_face_recognition_resnet_model_v1.dat
see here https://github.com/ageitgey/face_recognition_models/blob/master/face_recognition_models/init.py
face_recognition_model = face_recognition_models.face_recognition_model_location()
face_encoder = dlib.face_recognition_model_v1(face_recognition_model)
.....
def face_encodings(face_image, known_face_locations=None, num_jitters=1):
raw_landmarks = _raw_face_landmarks(face_image, known_face_locations, model="small")
return [np.array(face_encoder.compute_face_descriptor(face_image, raw_landmark_set, num_jitters)) for raw_landmark_set in raw_landmarks]
Upvotes: 2
Reputation: 4791
There is a C++ example program that comes with dlib that shows how to do this: http://dlib.net/dnn_face_recognition_ex.cpp.html
Upvotes: 1
Reputation:
A very quick perusing through dlib's source code reveals that this function is implemented in tools/python/src/face_recognition.cpp.
So all you have to do is bring that code into your project. It being licensed under the BOOST license makes it simple.
Upvotes: 2