Last active
December 7, 2018 11:24
-
-
Save yuanzhuohao/fabe987ed644e61e558ec2a69e77ed91 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$ sudo apt-get update | |
$ sudo apt-get upgrade | |
$ sudo apt-get install build-essential cmake git pkg-config | |
$ sudo apt-get install libjpeg8-dev libtiff4-dev libjasper-dev libpng12-dev | |
$ sudo apt-get install libgtk2.0-dev | |
$ sudo apt-get install libavcodec-dev libavformat-dev libswscale-dev libv4l-dev | |
$ sudo apt-get install libatlas-base-dev gfortran | |
$ sudo apt-get install python2.7-dev | |
# clone source | |
$ cd ~ | |
$ git clone https://github.com/Itseez/opencv.git | |
$ cd opencv | |
$ git checkout 3.0.0 | |
# SIFT SURF are in opencv_contrib.git | |
$ cd ~ | |
$ git clone https://github.com/Itseez/opencv_contrib.git | |
$ cd opencv_contrib | |
$ git checkout 3.0.0 | |
# | |
$ cd ~/opencv | |
$ mkdir build | |
$ cd build | |
$ cmake -DCMAKE_BUILD_TYPE=RELEASE \ | |
-DOPENCV_EXTRA_MODULES_PATH=~/opencv_contrib-3.4.4/modules \ | |
-DWITH_TBB=ON \ | |
-DBUILD_NEW_PYTHON_SUPPORT=ON \ | |
-DINSTALL_C_EXAMPLES=ON \ | |
-DINSTALL_PYTHON_EXAMPLES=ON \ | |
-DBUILD_EXAMPLES=ON \ | |
-DWITH_CUDA=OFF \ | |
-DBUILD_TIFF=ON \ | |
-DCMAKE_INSTALL_PREFIX=$(python -c "import sys; print(sys.prefix)") \ | |
-DPYTHON_EXECUTABLE=$(which python) \ | |
-DPYTHON_INCLUDE_DIR=$(python -c "from distutils.sysconfig import get_python_inc; print(get_python_inc())") \ | |
-DPYTHON_PACKAGES_PATH=$(python3 -c "from distutils.sysconfig import get_python_lib; print(get_python_lib())") \ | |
.. | |
# -DCMAKE_INSTALL_PREFIX=/usr/local \ #specify any location you want to install | |
$ make -j4 | |
$ sudo make install | |
$ sudo ldconfig | |
# check if .so are installed in your specified location | |
# ex. cv2.so should be installed into | |
# /home/wew57/anaconda/lib/python2.7/site-packages/cv2.so | |
$ python | |
>>> import cv2 | |
>>> cv2.__version__ | |
'3.0.0' # is it the version you installed | |
# taste demo | |
opencv/samples/python2/demo.py |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment