4

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++?

Rabbid76
  • 202,892
  • 27
  • 131
  • 174
mbnoimi
  • 490
  • 4
  • 21

3 Answers3

2

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.

2

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]
flyingduck92
  • 1,449
  • 2
  • 23
  • 39
1

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

Davis King
  • 4,731
  • 1
  • 25
  • 26