dlib系列笔记0:开发环境
ubuntu 16.04 python3.5 opencv3.4.0
opencv3.4.0 安装编译
unzip opencv-3.4.0.zip
cd opencv
sudo apt install cmake
sudo apt install build-essential libgtk2.0-dev libavcodec-dev libavformat-dev libjpeg.dev libtiff4.dev libswscale-dev libjasper-dev
mkdir my_build
cd my_build
## cmake 中会下载安装一个大文件,网速会很慢
cmake -D CMAKE_BUILD_TYPE=Release -D CMAKE_INSTALL_PREFIX=/usr/local ..
sudo make
sudo make install
sudo gedit /etc/ld.so.conf.d/opencv.conf
# add this
"
/usr/local/lib
"
sudo ldconfig
sudo gedit /etc/bash.bashrc
# add this
"
PKG_CONFIG_PATH=$PKG_CONFIG_PATH:/usr/local/lib/pkgconfig
export PKG_CONFIG_PATH
"
source /etc/bash.bashrc
sudo updatedb
# test
cd opencv***/smaples/cpp/example_cmake
cmake .
make
./opencv_example
# and you will see yourself
# compete
dlib 安装编译
git clone https://github.com/davisking/dlib.git
cd dlib
mkdir build
cd build
cmake .. -DDLIB_USE_CUDA=0 -DUSE_AVX_INSTRUCTIONS=1
cmake --build . --config Release
# 安装python包
cd ..
python3 setup.py install --yes USE_AVX_INSTRUCTIONS --no DLIB_USE_CUDA
编译opencv程序
- use g++
g++ main.cpp `pkg-config opencv --cflags --libs`
- use cmake
nano CMakeLists.txt
cmake_minimum_required(VERSION 2.8)
project(test)
find_package(OpenCV REQUIRED)
add_executable(main main.cpp)
target_link_libraries(main ${OpenCV_LIBS})
编译 dlib 程序
- use g++
g++ -std=c++11 -O3 -I.. dlib_package_root/dlib/dlib/all/source.cpp -lpthread -lX11 example_program_name.cpp
- use cmake
nano CMakeLists.txt
cmake_minimum_required(VERSION 2.8)
project(test)
add_subdirectory(/home/....../dlib/dlib dlib_build)
add_executable(main main.cpp)
target_link_libraries(face_detector dlib::dlib)