Skip to content

Instantly share code, notes, and snippets.

@koji
Last active December 24, 2018 21:35
Show Gist options
  • Save koji/34d0c8cb8b664282709d84e26cf25002 to your computer and use it in GitHub Desktop.
Save koji/34d0c8cb8b664282709d84e26cf25002 to your computer and use it in GitHub Desktop.
install opencv on ubuntu
sudo add-apt-repository "deb http://security.ubuntu.com/ubuntu bionic-security main"
sudo apt-get -y install build-essential checkinstall cmake unzip pkg-config yasm
sudo apt-get -y install git gfortran python3-dev
sudo apt-get -y install libjpeg8-dev libjasper-dev libpng12-dev libavcodec-dev libavformat-dev libswscale-dev libdc1394-22-dev libxine2-dev libv4l-dev
sudo apt-get -y install libjpeg-dev libpng-dev libtiff-dev libtbb-dev
sudo apt-get -y install libavcodec-dev libavformat-dev libswscale-dev libv4l-dev libatlas-base-dev libxvidcore-dev libx264-dev libgtk-3-dev

# download opencv source code version 3.4.4
cd
git clone https://github.com/opencv/opencv.git
git clone https://github.com/opencv/opencv_contrib.git

cd opencv_contrib
git checkout -b 3.4.4 refs/tags/3.4.4
cd ../opencv/
git checkout -b 3.4.4 refs/tags/3.4.4

mkdir build
cd build
cmake -D CMAKE_BUILD_TYPE=Release \
-D CMAKE_INSTALL_PREFIX=/usr/local \
-D WITH_TBB=ON \
-D OPENCV_EXTRA_MODULES_PATH=../../opencv_contrib/modules ..
make -j7
make install
echo /usr/local/lib > /etc/ld.so.conf.d/opencv.conf
ldconfig -v

# version check
opencv_version

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment