Created
September 20, 2021 08:24
-
-
Save Nannigalaxy/1fa6474bcbb79188685f068ac8e6f19e to your computer and use it in GitHub Desktop.
OpenCV for C++ and Python (without contrib modules)
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
# Date: 20 Sept 2021 | |
# Script for installing opencv for c++ and python (without contrib modules) | |
# Tested on Pop!_OS 20.04 | |
echo "Installing Pre-requisites" | |
sudo apt install build-essential cmake git pkg-config libgtk-3-dev \ | |
libavcodec-dev libavformat-dev libswscale-dev libv4l-dev \ | |
libxvidcore-dev libx264-dev libjpeg-dev libpng-dev libtiff-dev \ | |
gfortran openexr libatlas-base-dev python3-dev python3-numpy \ | |
libtbb2 libtbb-dev libdc1394-22-dev libopenexr-dev \ | |
libgstreamer-plugins-base1.0-dev libgstreamer1.0-dev | |
mkdir ~/opencv_build && cd ~/opencv_build | |
echo "Downloading Opencv" | |
git clone https://github.com/opencv/opencv.git | |
cd ~/opencv_build/opencv | |
mkdir -p build && cd build | |
echo "Generating configuration" | |
cmake -D CMAKE_BUILD_TYPE=RELEASE \ | |
-D CMAKE_INSTALL_PREFIX=/usr/local \ | |
-D INSTALL_C_EXAMPLES=ON \ | |
-D INSTALL_PYTHON_EXAMPLES=ON \ | |
-D OPENCV_GENERATE_PKGCONFIG=ON \ | |
-D BUILD_EXAMPLES=ON .. | |
echo "Installing OpenCV" | |
make -j$(nproc) | |
sudo make install | |
echo "Testing Installation" | |
pkg-config --modversion opencv4 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment