Skip to content

Instantly share code, notes, and snippets.

@jennyshane
Created March 20, 2020 21:26
Show Gist options
  • Save jennyshane/2127500671f18e4e4f68860840861e70 to your computer and use it in GitHub Desktop.
Save jennyshane/2127500671f18e4e4f68860840861e70 to your computer and use it in GitHub Desktop.
opencv install
wget https://github.com/opencv/opencv_contrib/archive/4.2.0.tar.gz
gunzip 4.2.0.tar.gz && tar -xvf 4.2.0.tar && rm 4.2.0.tar
mv opencv_contrib-4.2.0/ opencv_contrib
wget https://github.com/opencv/opencv/archive/4.2.0.tar.gz
gunzip 4.2.0.tar.gz && tar -xvf 4.2.0.tar && rm 4.2.0.tar
mv opencv-4.2.0/ opencv
apt-get update
apt-get install --assume-yes pkg-config build-essential cmake
apt-get install --assume-yes libjpeg-dev libpng-dev libtiff-dev
add-apt-repository "deb http://security.ubuntu.com/ubuntu xenial-security main"
apt-get update
apt-get install --assume-yes libjasper1 libjasper-dev
apt-get install --assume-yes libavcodec-dev libavformat-dev libswscale-dev libv4l-dev
apt-get install --assume-yes libxvidcore-dev libx264-dev
apt-get install --assume-yes libgtk-3-dev
apt-get install --assume-yes libatlas-base-dev gfortran
apt-get install --assume-yes python3.6-dev
apt-get install --assume-yes python3-numpy
cd opencv && mkdir build && cd build
cmake -D CMAKE_BUILD_TYPE=RELEASE -D CMAKE_INSTALL_PREFIX=/usr/local \
-D WITH_CUDA=OFF -D PYTHON_DEFAULT_EXECUTABLE=/usr/bin/python3 \
-D BUILD_opencv_python3=ON -D INSTALL_PYTHON_EXAMPLES=ON \
-D OPENCV_EXTRA_MODULES_PATH=~/opencv_contrib/modules -D WITH_FFMPEG=ON \
-D OPENCV_ENABLE_NONFREE=ON -D BUILD_EXAMPLES=ON ..
make -j4
make install
ldconfig
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment