Skip to content

Instantly share code, notes, and snippets.

@fengyuentau
Last active August 30, 2024 09:33
Show Gist options
  • Save fengyuentau/4cb7b17c0c41c10c3c20fe140fbee685 to your computer and use it in GitHub Desktop.
Save fengyuentau/4cb7b17c0c41c10c3c20fe140fbee685 to your computer and use it in GitHub Desktop.
Guide to build and install OpenCV 5

Dependencies

  • OS: Ubuntu / macOS
  • CMake >= 3.20
  • gcc
  • g++
  • Python >= 3.6

Build OpenCV 5

git clone --branch 5.x https://github.com/opencv/opencv

cmake -B opencv-build -S opencv -DCMAKE_INSTALL_PREFIX=opencv-build/install # Add -DWITH_ZLIB=OFF on macOS
cmake --build opencv-build --target install -j6

# Install Python package. Uninstall old ones first.
python3 -m pip uninstall opencv-python
python3 -m pip install opencv-build/python_loader
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment