Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Shell Script for SetUp OpenCV
#!/bin/sh
sudo apt update
## Install Dependencies (Build Tools)
sudo apt install -y build-essential
sudo apt install -y cmake
sudo apt install -y cmake-curses-gui
sudo apt install -y ninja-build
sudo apt install -y pkg-config
## Install Dependencies (GUI)
sudo apt install -y libgtk-3-dev
sudo apt install -y qt5-default
sudo apt install -y freeglut3-dev
sudo apt install -y libvtk8-qt-dev
## Install Dependencies (Image)
sudo apt install -y libjpeg-dev
sudo apt install -y libpng++-dev
sudo apt install -y libtiff-dev
## Install Dependencies (Video)
sudo apt install -y libv4l-dev
sudo apt install -y libavcodec-dev
sudo apt install -y libavformat-dev
sudo apt install -y libswscale-dev
sudo apt install -y libxine2-dev
## Install Dependencies (Parallel)
sudo apt install -y libtbb2
sudo apt install -y libtbb-dev
## Install Dependencies (Other)
sudo apt install -y libhdf5-dev
## Clone/CheckOut OpenCV
git clone https://github.com/opencv/opencv_contrib.git
cd opencv_contrib
git checkout -b 4.2.0 refs/tags/4.2.0
cd ..
git clone https://github.com/opencv/opencv.git
cd opencv
git checkout -b 4.2.0 refs/tags/4.2.0
## Build/Install OpenCV
mkdir -p build
cd build
cmake .. -GNinja # Please use ccmake to set configuration in details. (cmake .. && ccmake ..)
cmake --build .
sudo cmake --build . --target install
sudo ldconfig
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.