Step1: Download Dlib
- Download Dlib from http://dlib.net/ and extract.
- Download face landmark detection predictor data http://dlib.net/files/shape_predictor_68_face_landmarks.dat.bz2
Step2: Use cmake to generate library
- Use cmake to build the library. Set the directories as shown in the Figure 1 below
- Click “Generate” and set the configuration as shown in Figure 2
- Click “Finish”
- Go to “C:/Users/xmeng525/Dropbox/OPENCV_STUDY/dlib-19.4/build”, open the Dlib solution
- Run the “ALL_BUILD” project to under “Release x64” and “Debug x64”
- You will get “Debug” and “Release” folders as shown in Figure 3, containing “dlib.lib”
Figure 1
Figure 2
Figure 3
Step3: Build a new win32 console Application for testing.
- Add “VC++ Directories”
- Change “C/C++ / General”
- Change “C/C++ / Preprocessor”, add “DLIB_JPEG_SUPPORT” and “DLIB_PNG_SUPPORT”
- Change “Linker/General/Additional Library Directories” to the directory with “Dlib.lib”
- Change “Linker/ Input”
Step4: Testing.
- Build a testing file “face_landmark_detection_ex.cpp” as shown in the figure below.
- Copy the following code to the main file
- Run, if there is error:
“USER_ERROR__missing_dlib_all_source_cpp_file__OR__inconsistent_use_of_DEBUG_or_ENABLE_ASSERTS_preprocessor_directives”- Go to C:\Users\xmeng525\Dropbox\OPENCV_STUDY\dlib-19.4\dlib\threads\threads_kernel_shared.h
- Comment the following code:
Step5: Get results
Hi Xiaoxumeng,
thank you for writing this tutorial. Unfortunately, the example code does not compile due to missing types in some vector and array2d definitions. You can copy those types from the official example here: http://dlib.net/face_landmark_detection_ex.cpp.html
Thank you for your tip! I’ll add it to my post.