View difference between Paste ID: XWLKbacA and hRw56cfC
SHOW: | | - or go back to the newest paste.
1
### Installs globally for 2.7 and 3 python, no virtualenv. Use Pyenv from github to switch between ### 2.7 and 3.5 
2
# https://www.learnopencv.com/install-opencv3-on-ubuntu/
3
# mod of learnopencv dot com ,install opencv3 on ubuntu
4
# libpng12-dev not available on ubuntu, use libpng-dev
5
# installed on ubuntu 17
6
sudo apt-get -y update
7
sudo apt-get -y upgrade
8
sudo apt-get -y remove x264 libx264-dev
9
sudo apt-get install -y build-essential checkinstall cmake pkg-config yasm gfortran git
10
sudo apt-get install -y libjpeg8-dev libjasper-dev libpng-dev libpng16-16
11
sudo apt-get install -y libtiff5-dev
12
sudo apt-get install -y libavcodec-dev libavformat-dev libswscale-dev libdc1394-22-dev
13
sudo apt-get install -y libxine2-dev libv4l-dev
14
sudo apt-get install -y libgstreamer0.10-dev libgstreamer-plugins-base0.10-dev
15
sudo apt-get install -y libqt4-dev libgtk2.0-dev libtbb-dev
16
sudo apt-get install -y libatlas-base-dev
17
sudo apt-get install -y libfaac-dev libmp3lame-dev libtheora-dev
18
sudo apt-get install -y libvorbis-dev libxvidcore-dev
19
sudo apt-get install -y libopencore-amrnb-dev libopencore-amrwb-dev
20
sudo apt-get install -y x264 v4l-utils
21
sudo apt-get install -y libprotobuf-dev protobuf-compiler
22
sudo apt-get install -y libgoogle-glog-dev libgflags-dev
23
sudo apt-get install -y libgphoto2-dev libeigen3-dev libhdf5-dev doxygen
24
sudo apt-get install -y python-dev python-pip python3-dev python3-pip
25
sudo pip2 install    -y pip numpy
26
sudo pip3 install    -y pip numpy
27
sudo pip2 install    -y scipy matplotlib scikit-image scikit-learn ipython
28-
sudo pip3 install    -y jupyter-notebook
28+
sudo pip3 install    -y jupyter-core jupyter-notebook
29
##########
30
git clone https://github.com/opencv/opencv.git
31
cd opencv 
32
git checkout 3.3.0 
33
cd ..
34
git clone https://github.com/opencv/opencv_contrib.git
35
cd opencv_contrib
36
git checkout 3.3.0
37
###############
38
cd ..
39
cd opencv
40
mkdir build
41
cd build
42
cmake -D CMAKE_BUILD_TYPE=RELEASE \
43
      -D CMAKE_INSTALL_PREFIX=/usr/local \
44
      -D INSTALL_C_EXAMPLES=ON \
45
      -D INSTALL_PYTHON_EXAMPLES=ON \
46
      -D WITH_TBB=ON \
47
      -D WITH_V4L=ON \
48
      -D WITH_QT=ON \
49
      -D WITH_OPENGL=ON \
50
      -D OPENCV_EXTRA_MODULES_PATH=../../opencv_contrib/modules \
51
      -D PYTHON_EXECUTABLE=/usr/bin/python3.5 \
52
      -D BUILD_EXAMPLES=ON ..
53
make -j4
54
sudo make install
55
sudo sh -c 'echo "/usr/local/lib" >> /etc/ld.so.conf.d/opencv.conf'
56
sudo ldconfig
57
find /usr/local/lib/ -type f -name "cv2*.so"
58
# outputs 
59
#/usr/local/lib/python2.7/dist-packages/cv2.so
60
#/usr/local/lib/python3.5/dist-packages/cv2.cpython-35m-x86_64-linux-gnu.so
61
cd /usr/local/lib/python3.5/dist-packages
62
mv cv2.cpython-36m-x86_64-linux-gnu.so cv2.so