-
Notifications
You must be signed in to change notification settings - Fork 18
openCV installation
Jaroslaw Karwowski edited this page Jun 5, 2020
·
1 revision
sudo apt-get update
sudo apt-get upgrade
sudo apt-get install build-essential cmake unzip pkg-config
sudo apt-get install libjpeg-dev libpng-dev libtiff-dev
sudo apt-get install python-dev python-numpy libtbb2 libtbb-dev libjpeg-dev libpng-dev libtiff-dev libjasper-dev libdc1394-22-dev
sudo apt-get install libjpeg8-dev libtiff5-dev libjasper-dev libpng12-dev
sudo apt-get install libavcodec-dev libavformat-dev libswscale-dev libv4l-dev
sudo apt-get install libxvidcore-dev libx264-dev
sudo apt-get install libgtk-3-dev libgtkglext1-dev
sudo apt-get install libatlas-base-dev gfortran
sudo apt-get install python3-dev
cd ~/Downloads
wget -O opencv.zip https://github.com/opencv/opencv/archive/3.4.5.zip # or newer version if exists (check wiki on github)
unzip opencv.zip
wget -O opencv_contrib.zip https://github.com/opencv/opencv_contrib/archive/3.4.5.zip
unzip opencv_contrib.zip
sudo apt-get install python-pip && pip install --upgrade pip
Omitted some python-related stuff (env setup) from the links below:
- https://medium.com/@debugvn/installing-opencv-3-3-0-on-ubuntu-16-04-lts-7db376f93961
- (extra) https://www.pyimagesearch.com/2016/10/24/ubuntu-16-04-how-to-install-opencv/
cd ~/Downloads/opencv-3.4.5
mkdir build
cd build
cmake -D CMAKE_BUILD_TYPE=RELEASE -D CMAKE_INSTALL_PREFIX=/usr/local -D INSTALL_C_EXAMPLES=ON -D OPENCV_EXTRA_MODULES_PATH=~/Downloads/opencv_contrib-3.4.5/modules -D BUILD_EXAMPLES=ON ..
make -j4
sudo make install
sudo ldconfig
pkg-config --modversion opencv
cd ~/Downloads
rm -r opencv-3.4.5 opencv_contrib-3.4.5 opencv_contrib.zip opencv.zip