dlib系列笔记0:开发环境

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)
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值