Dlib Configure on Raspberry PI
2018-02-27 13:02
302 查看
Install dlib dependences
The dlib library requires four prerequisites:BoostBoost.Python
CMake
X11
These can all be installed via the following commandssudo apt-get update
sudo apt-get install build-essential cmake
sudo apt-get install libgtk-3-dev
sudo apt-get install libboost-all-dev
Access your Python virtual environment (if you are using them)
All of my OpenCV install tutorials on the PyImageSearch blog make use of Python virtual environments.Using Python’s virtualenv and virtualenvwrapper libraries, we can create separate Python environments for each project we are working on — this is considered a best practice when developing software in the Python programming language.I’ve discussed Python virtual environments many times before on the PyImageSearch blog, so I’ll spare any discussion of them here. If you would like to read more about Python virtual environments please refer to any of my installing OpenCV tutorials along with this excellent Python virtual environment primer.If you would like to install dlib into a pre-existing Python, virtual environment, use the workon command:workon <your virtualenv name>For example, most tutorials here on PyImageSearch create a virtual environment named cv. We can access the cv virtual environment via:workon cvOtherwise, I suggest creating an entirely separate virtual environment using themkvirtualenv command.The command below will create a Python virtual environment named py2_dlib with the Python 2.7 interpreter: mkvirtualenv py2_dlibWhile this command will create a Python 3 virtual environment named py3_dlib : mkvirtualenv py3_dlib -p python3Please keep in mind that this step is optional, but highly recommended.
Use pip to install dlib with Python bindings
We’ll start with the basic NumPy + SciPy stack, followed by scikit-image, a library commonly used in conjunction with dlib:pip install numpy pip install scipy pip install scikit-imageWe can then install dlib via pip as well:
pip install dlib
Note: Use 'pip3' for python3
Test out your dlib install
To test out your dlib install, open up a Python shell (making sure to access your Python virtual environment if you used one), and then try to import dlib :Python 2.7.13:pi@raspberrypi:~ $ python
Python 2.7.13 (default, Nov 24 2017, 17:33:09)
[GCC 6.3.0 20170516] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import dlib
>>>
Python 3.5:
Use "pip3 install dlib" if Python3 did not find 'dlib'.pi@raspberrypi:~ $ python3
Python 3.5.3 (default, Jan 19 2017, 14:11:04)
[GCC 6.3.0 20170124] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import dlib
>>>
If you would like to access your OpenCV bindings along with your dlib bindings from the same virtual environment, make sure your cv2.so bindings are properly sym-linked into the site-packages directory of your Python virtual environment.
Example:
Facial landmark detection with dlib and the Raspberry Pi
Refer https://www.pyimagesearch.com/2017/05/01/install-dlib-raspberry-pi/
RTD
Reference:
Install dlib on the Raspberry Pi, https://www.pyimagesearch.com/2017/05/01/install-dlib-raspberry-pi/
相关文章推荐
- JavaFX game on Raspberry PI
- GStreamer 1.2 on the Raspberry Pi
- Navigating with Navit on the Raspberry Pi
- How to burn raspberry pi image to SD card on ubuntu
- Installing on Raspberry PI/Raspbian from source
- 树莓派(raspberry pi) Installing ROS Indigo on Raspberry Pi
- .NET Core on Raspberry Pi
- I/O test of Sandisk Ultra 16GB Class 10 MiniSDHC on Raspberry Pi
- Qt 5 on Raspberry Pi
- Node.js installation with nvm on Raspberry pi
- Installing ROS Kinetic on the Raspberry Pi
- mjpg-streamer on raspberrypi
- Installing ROS Indigo on the Raspberry Pi
- Adding an On/Off switch to your Raspberry Pi
- Kubernetes on Raspberry Pi
- Run TeamViewer on Raspberry Pi
- [raspberry pi] install logitech media server on raspberry pi
- Trajectory following with MAVROS OFFBOARD on Raspberry Pi
- Configuring a Static IP address on your Raspberry Pi
- Running your first RTEMS program on the Raspberry Pi