Created
September 6, 2017 18:40
-
-
Save krishh-konar/6edf17df2bd5d9677b3b9f01bf98ff04 to your computer and use it in GitHub Desktop.
Install OpenCV3 for Python (with ffmpeg support)
This file contains hidden or 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
#Create Directory | |
mkdir OpenCV && cd OpenCV | |
#Install dependencies | |
sudo apt-get update | |
sudo apt-get upgrade | |
sudo apt-get install -y build-essential checkinstall cmake pkg-config yasm libtiff5-dev \ | |
libjpeg-dev libjasper-dev libavcodec-dev libavformat-dev libswscale-dev libdc1394-22-dev libgstreamer0.10-dev \ | |
libgstreamer-plugins-base0.10-dev libv4l-dev python-dev python-numpy python-pip libtbb-dev libeigen3-dev \ | |
libqt4-dev libgtk2.0-dev libmp3lame-dev libopencore-amrnb-dev libopencore-amrwb-dev libtheora-dev libvorbis-dev \ | |
libxvidcore-dev x264 v4l-utils libgtk2.0-dev unzip libhdf5-dev wget | |
#Get OpenCV | |
sudo wget https://github.com/daveselinger/opencv/archive/3.1.0-with-cuda8.zip -O opencv-3.1.0.zip -nv | |
unzip opencv-3.1.0.zip | |
mv opencv-3.1.0-with-cuda8 opencv-3.1.0 | |
cd opencv-3.1.0 | |
rm -rf build | |
mkdir build | |
cd build | |
#make opencv | |
sudo cmake -D CUDA_ARCH_BIN=3.2 \ | |
-D CUDA_ARCH_PTX=3.2 \ | |
-D CMAKE_BUILD_TYPE=RELEASE \ | |
-D CMAKE_INSTALL_PREFIX=/usr/local \ | |
-D WITH_TBB=ON \ | |
-D BUILD_NEW_PYTHON_SUPPORT=ON \ | |
-D WITH_V4L=ON \ | |
-D BUILD_TIFF=ON \ | |
-D WITH_QT=ON \ | |
-D ENABLE_PRECOMPILED_HEADERS=OFF \ | |
-D WITH_OPENGL=ON .. | |
sudo make -j4 | |
sudo make install | |
sudo echo "/usr/local/lib" | sudo tee -a /etc/ld.so.conf.d/opencv.conf | |
sudo ldconfig | |
sudo cp ./lib/cv2.so /usr/lib/python2.7/dist-packages/cv2.so |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment