Last active
May 30, 2017 07:40
-
-
Save MizukiSonoko/31420f5d217bc5618b9b5e54c77c4283 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
CORENUM=`grep -c ^processor /proc/cpuinfo` | |
apt update | |
apt -y install build-essential cmake pkg-config | |
apt -y wget unzip | |
apt -y install libjpeg8-dev libtiff5-dev libjasper-dev libpng12-dev | |
apt -y install libavcodec-dev libavformat-dev libswscale-dev libv4l-dev | |
apt -y install libxvidcore-dev libx264-dev libgtk2.0-dev libatlas-base-dev gfortran | |
curl "https://bootstrap.pypa.io/get-pip.py" -o "get-pip.py" | |
python3 get-pip.py | |
pip install numpy | |
wget -O opencv.zip https://github.com/Itseez/opencv/archive/3.2.0.zip | |
unzip opencv.zip | |
wget -O opencv_contrib.zip https://github.com/Itseez/opencv_contrib/archive/3.2.0.zip | |
unzip opencv_contrib.zip | |
mkdir -p opencv-3.2.0/build | |
cd opencv-3.2.0/build | |
cmake -DCMAKE_BUILD_TYPE=RELEASE \ | |
-DCMAKE_INSTALL_PREFIX=/usr/local \ | |
-DINSTALL_C_EXAMPLES=OFF \ | |
-DINSTALL_PYTHON_EXAMPLES=OFF \ | |
-DOPENCV_EXTRA_MODULES_PATH=/opencv_contrib-3.2.0/modules \ | |
-DBUILD_EXAMPLES=OFF \ | |
-DBUILD_opencv_python2=ON \ | |
-DBUILD_opencv_python3=ON \ | |
-DWITH_FFMPEG=1 \ | |
-DWITH_CUDA=0 \ | |
-DPYTHON3_EXECUTABLE=$(which python3) \ | |
-DPYTHON2_EXECUTABLE=$(which python) \ | |
-DPYTHON2_INCLUDE_DIR=/usr/include/python2.7 \ | |
-DPYTHON3_INCLUDE_DIR=/usr/include/python3.5m \ | |
-DPYTHON2_LIBRARY=/usr/lib/x86_64-linux-gnu/libpython2.7.so.1 \ | |
-DPYTHON3_LIBRARY=/usr/lib/x86_64-linux-gnu/libpython3.5m.so.1 .. | |
make -j$CORENUM | |
make install | |
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
CORENUM=`grep -c ^processor /proc/cpuinfo` | |
apt update | |
apt install -y cmake git gcc g++ autoconf wget | |
apt install -y libjpeg-dev libpng-dev libtiff5-dev libjasper-dev libavcodec-dev libavformat-dev libswscale-dev pkg-config cmake libgtk2.0-dev libeigen3-dev libtheora-dev libvorbis-dev libxvidcore-dev libx264-dev sphinx-common libtbb-dev yasm libfaac-dev libopencore-amrnb-dev libopencore-amrwb-dev libopenexr-dev libgstreamer-plugins-base1.0-dev libavcodec-dev libavutil-dev libavfilter-dev libavformat-dev libavresample-dev | |
apt install -y yasm libx264-dev libx265-dev libfdk-aac-dev libmp3lame-dev libopus-dev libvpx-dev | |
apt install -y python-dev python-numpy libtbb2 libtbb-dev libjpeg-dev libpng-dev libtiff-dev libjasper-dev libdc1394-22-dev | |
apt install -y libass-dev libv4l-dev | |
apt install -y python3.5-dev libpython3-dev python3-numpy | |
# Ref https://github.com/toggl/toggldesktop/issues/1894 | |
wget http://fr.archive.ubuntu.com/ubuntu/pool/main/g/gst-plugins-base0.10/libgstreamer-plugins-base0.10-0_0.10.36-1_amd64.deb | |
wget http://fr.archive.ubuntu.com/ubuntu/pool/universe/g/gstreamer0.10/libgstreamer0.10-0_0.10.36-1.5ubuntu1_amd64.deb | |
sudo dpkg -i libgstreamer*.deb | |
apt install gstreamer1.0-plugins-ugly | |
mkdir -p ~/ffmpeg_sources | |
cd ~/ffmpeg_sources | |
wget http://ffmpeg.org/releases/ffmpeg-snapshot.tar.bz2 | |
tar xf ffmpeg-snapshot.tar.bz2 | |
cd ffmpeg | |
CFLAGS=`freetype-config --cflags` LDFLAGS=`freetype-config --libs` PKG_CONFIG_PATH="/usr/lib/pkgconfig" ./configure --extra-cflags="-I$HOME/ffmpeg_build/include" --extra-ldflags="-L$HOME/ffmpeg_build/lib" --bindir="$HOME/bin" --enable-gpl --enable-libass --enable-libfdk-aac --enable-libfreetype --enable-libmp3lame --enable-libopus --enable-libtheora --enable-libvorbis --enable-libvpx --enable-libx264 --enable-libx265 --enable-nonfreee | |
make -j$CORENUM | |
make install | |
cd | |
wget https://github.com/opencv/opencv/archive/3.2.0.tar.gz | |
tar xzf 3.2.0.tar.gz | |
cd opencv-3.2.0 | |
mkdir build; cd build | |
cmake \ | |
-DCMAKE_BUILD_TYPE=RELEASE \ | |
-DCMAKE_INSTALL_PREFIX=/usr/local \ | |
-DINSTALL_C_EXAMPLES=OFF \ | |
-DBUILD_TIFF=ON \ | |
-DENABLE_AVX=ON \ | |
-DWITH_FFMPEG=ON \ | |
-DWITH_OPENGL=ON \ | |
-DWITH_OPENCL=ON \ | |
-DWITH_IPP=ON \ | |
-DWITH_TBB=ON \ | |
-DWITH_EIGEN=ON \ | |
-DWITH_V4L=ON \ | |
-DWITH_VTK=OFF \ | |
-DBUILD_TESTS=OFF \ | |
-DBUILD_PERF_TESTS=OFF \ | |
-DBUILD_opencv_world=OFF \ | |
-DBUILD_opencv_python2=ON \ | |
-DBUILD_opencv_python3=ON \ | |
-DBUILD_NEW_PYTHON_SUPPORT=ON \ | |
-DINSTALL_PYTHON_EXAMPLES=ON \ | |
-DPYTHON3_EXECUTABLE=$(which python3) \ | |
-DPYTHON2_EXECUTABLE=$(which python) \ | |
-DPYTHON2_INCLUDE=/usr/include/python2.7 \ | |
-DPYTHON3_INCLUDE=/usr/include/python3.5m \ | |
-DPYTHON2_LIBRARY=/usr/lib/x86_64-linux-gnu/libpython2.7.so.1 \ | |
-DPYTHON3_LIBRARY=/usr/lib/x86_64-linux-gnu/libpython3.5m.so.1 .. | |
make -j$CORENUM | |
make install | |
cd | |
curl "https://bootstrap.pypa.io/get-pip.py" -o "get-pip.py" | |
python3 get-pip.py | |
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
root@245ac95ed80e:~# python3 | |
Python 3.5.2+ (default, Sep 22 2016, 12:18:14) | |
[GCC 6.2.0 20160927] on linux | |
Type "help", "copyright", "credits" or "license" for more information. | |
>>> import cv2 | |
>>> video = cv2.VideoCapture('sample.mp4') | |
Unable to stop the stream: Inappropriate ioctl for device | |
(python3:12540): GStreamer-CRITICAL **: gst_element_link_pads_full: assertion 'GST_IS_ELEMENT (src)' failed | |
OpenCV Error: Unspecified error (GStreamer: cannot link color -> sink | |
) in cvCaptureFromCAM_GStreamer, file /root/opencv-3.2.0/modules/videoio/src/cap_gstreamer.cpp, line 792 | |
VIDEOIO(cvCreateCapture_GStreamer (CV_CAP_GSTREAMER_FILE, filename)): raised OpenCV exception: | |
/root/opencv-3.2.0/modules/videoio/src/cap_gstreamer.cpp:792: error: (-2) GStreamer: cannot link color -> sink | |
in function cvCaptureFromCAM_GStreamer | |
>>> exit() | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment