Skip to content

Instantly share code, notes, and snippets.

@pjspillai
Created November 30, 2018 03:07
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save pjspillai/64da7a0fe491b927dce1b63f0ec1950e to your computer and use it in GitHub Desktop.
Save pjspillai/64da7a0fe491b927dce1b63f0ec1950e to your computer and use it in GitHub Desktop.
OpenCV 4.0 , Ubuntu 18.04 Installation
git clone --recursive https://github.com/opencv/opencv_contrib.git
git clone --recursive https://github.com/opencv/opencv.git
Make sure the CmakeCache params are loaded (refer the one in gist), in cmake-gui
make -j8 install
sudo ldconfig
Note: This might not setup python opencv version correctly. It initially showed me 3.2 when I did
cv2.__version__
cd opencv/opencv/build/python_loader
sudo python3 setup.py build
sudo python3 setup.py build install --prefix=/usr/local
sudo link the .so file in /usr/local/python/cv2/python-3.6
sudo ln -s cv2.cpython-36m-x86_64-linux-gnu.so cv2.so
Add following line in bashrc which contains the cv2.so (opencv 4 lib)
export PYTHONPATH=$PYTHONPATH:/usr/local/python/cv2/python-3.6
source ~/.bashrh
now open a fresh terminal to check
import cv2
cv2.__version__
This should print out the following
'4.0.0-dev'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment