Overview
The following packages will be installed:
- OpenBLAS 0.2.19
- Numpy 1.12.1
- OpenCV 3.2
OpenBLAS 0.2.19
Install LAPACK.
sudo apt install liblapacke-dev
Make and install (be careful of the prefix).
make
sudo make PREFIX=/usr/local/openblas install
Add the following to .bashrc
export PATH=$PATH:/usr/local/openblas/bin
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/usr/local/openblas/lib
export CPATH=$CPATH:/usr/local/openblas/include
Numpy 1.12.1
Download Numpy (https://github.com/numpy/numpy/releases/tag/v1.12.1)
sudo apt install libfftw3-dev
cd numpy
cp site.cfg.example site.cfg
Uncomment these lines to enable OpenBLAS and fftw3.
[openblas]
libraries = openblas
library_dirs = /usr/local/openblas/lib
include_dirs = /usr/local/openblas/include
[fftw]
libraries = fftw3
Check configuration, and the output should look something like this.
python setup.py config
openblas_info:
FOUND:
libraries = ['openblas', 'openblas']
library_dirs = ['/usr/local/openblas/lib']
language = c
define_macros = [('HAVE_CBLAS', None)]
FOUND:
libraries = ['openblas', 'openblas']
library_dirs = ['/usr/local/openblas/lib']
language = c
define_macros = [('HAVE_CBLAS', None)]
Then just build and install.
python setup.py build
sudo python setup.py install
Install OpenCV 3.2
Download:
- https://github.com/opencv/opencv/archive/3.2.0.zip
- https://github.com/opencv/opencv_contrib/archive/3.2.0.zip
Install dependent packages.
sudo apt install libjpeg8-dev libtiff5-dev libjasper-dev libpng12-dev libavcodec-dev libavformat-dev libswscale-dev libv4l-dev libxvidcore-dev libx264-dev libgtk-3-dev libatlas-base-dev
Configure CMAKE
, build, and install. Note: don't compile under virtualenv
, otherwise some of the libraries will have wrong Python path.
mkdir build && cd build
cmake -D CMAKE_BUILD_TYPE=RELEASE \
-D WITH_OPENGL=ON \
-D WITH_CUDA=ON \
-D ENABLE_FAST_MATH=1 \
-D CUDA_FAST_MATH=1 \
-D WITH_CUBLAS=1 \
-D CMAKE_INSTALL_PREFIX=/usr/local \
-D INSTALL_PYTHON_EXAMPLES=ON \
-D INSTALL_C_EXAMPLES=ON \
-D OPENCV_EXTRA_MODULES_PATH=~/tmp/opencv_contrib-3.2.0/modules \
-D BUILD_EXAMPLES=ON ..
make -j8
sudo make install
References