Recent work has been used in the Dlib library, which is a machine learning open Source Library, easy to use, directly include the header files, and do not rely on other libraries (self-contained image codec library source code). However, because it is open source, so the number of bugs some, i example compile and use encountered some problems, summarized as follows:
1.example compilation
Follow the instructions on the website to download the latest version 18.18 Dlib, then unzip to a path. Dlib libraries do not have to be compiled separately, only need to compile example, you can see the effect. According to the steps in the README.txt file, under the Exmaple folder, execute the following command,
mkdir Build
CD Build
CMake.
CMake--build.
But generally in the last step you will encounter some problems, resulting in a compilation failure, the workaround is as follows:
1. Add set (Boost_use_static_libs on) to the next line of Project (Dlib) in Dlib/cmakelists.txt
2. Comment The following code in the IF (Dlib_png_support) (around 227 lines) line, and the rest is unchanged.
# try toFindlibpng #find_package (PNG QUIET) # Make sure there isn't something wrong with the version of LIBPNG# installed on the this system. #if(Png_found)#set (cmake_required_libraries ${png_library}) #CHECK_FUNCTION_EXISTS (Png_create_read_struct LIB Png_is_good)#endif()#if(Png_found and Libpng_is_good)#include_directories (${png_include_dir}) #set (Dlib_needed_libraries ${dlib_needed_libraries} $ {png_library}) #else()# If We can't find libpng then statically compile it in.
3. Comment The following code in the IF (Dlib_jpeg_support) (around 280 lines) line, and the rest is unchanged.
# try toFindlibjpeg #find_package (JPEG QUIET) # Make sure there isn't something wrong with the version of Libjpeg# installed on the this system. Also Don't use the installed Libjpeg#ifThis was an APPLE system because apparently it's broken (as of 2015/01/01). #if(Jpeg_found)#set (cmake_required_libraries ${jpeg_library}) #CHECK_FUNCTION_EXISTS (Jpeg_read_header libjpeg_ Is_good)#endif()#if(Jpeg_found and Libjpeg_is_good and not APPLE)#include_directories (${jpeg_include_dir}) #set (Dlib_needed_libraries ${dlib_needed_libraries} ${jpeg_library})#else()# If We can't find Libjpeg then statically compile it in.
This should be able to compile the pass, the compiled binaries should also be executed, if the execution still error can not find the JPEG or PNG library, and then confirm whether the Cmakelists file according to the above modification.
Dlib Library Use