Skip to content

Instantly share code, notes, and snippets.

@logtheta
Last active May 27, 2021 09:59
Show Gist options
  • Save logtheta/211709a760339c9ef5b379849063d8a8 to your computer and use it in GitHub Desktop.
Save logtheta/211709a760339c9ef5b379849063d8a8 to your computer and use it in GitHub Desktop.
opencv_ubuntu
sudo apt-get install build-essential cmake git pkg-config libgtk-3-devsudo
sudo apt-get install libavcodec-dev libavformat-dev libswscale-dev libv4l-dev libxvidcore-dev libx264-devsudo
sudo apt-get install libjpeg-dev libpng-dev libtiff-dev gfortran openexr libatlas-base-devsudo
sudo apt-get install python3-dev python3-numpy libtbb2 libtbb-dev libdc1394-22-dev
mkdir ~/opencv_build && cd ~/opencv_build
git clone https://github.com/opencv/opencv.git
git clone https://github.com/opencv/opencv_contrib.git
cd ~/opencv_build/opencv
mkdir build && cd build
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 OPENCV_EXTRA_MODULES_PATH=~/opencv_build/opencv_contrib/modules \
-D BUILD_EXAMPLES=ON ..
make -j8
sudo make install
pkg-config --modversion opencv4
@YiqinZhao
Copy link

Confirmed working on Ubuntu 18.04 for building OpenCV 4. But there are some mistakes on this script, hope you could fix them. sudo are misplaced in line 1,2,3,4. make j8 should be make -j8.

@logtheta
Copy link
Author

logtheta commented Nov 6, 2019

Thanks for your comment @YiqinZhao

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