Also, credit to Adrian Rosebrock on his post. Step 5: Test out the OpenCV 3.0 and Python 3.4+ install $ workon cv Notice how I am changing the name from to cv2.so - this is so Python can import our OpenCV bindings using the name cv2. $ ln -s /usr/local/lib/python3.4/site-packages/ cv2.so However, in order to use OpenCV 3.0 within our cv virtual environment, we first need to sym-link OpenCV into the site-packages directory of the cv environment, like this: (Be sure to take note of ) $ cd ~/.virtualenvs/cv/lib/python3.4/site-packages/ Here, our OpenCV bindings are stored under the name If you’ve reached this step, OpenCV 3.0 should now be installed in /usr/local/lib/python3.4/site-packages/. Let's start OpenCV compile process : $ make -j4Īssuming OpenCV 3.0 compiled without error, you can now install it on your system: $ sudo make install For python 3.7 on ubuntu I had to use sudo apt-get install python3.7-tk to make it work. And I could find no way to pip install tkinter inside that environment. I did not think this would work because I forgot that the virtual environment ( myenvironment in the example above) was referencing the base python on my Ubuntu 18.04 distro for WSL. D OPENCV_EXTRA_MODULES_PATH=~/opencv_contrib/modules \ yum install tkinter for python3 user, install python3-tk package by following command sudo apt-get install python3-tk tk-devel also needs to be installed in my case. Found my solution: sudo apt-get install python3-tk. Step 3: Build and install OpenCV 3.0 with Python 3.4+ bindings $ cd ~ OpenCV represents images as NumPy arrays, so we need to install NumPy into our cv virtual environment: $ pip install numpy We’ll need to install the Python 3.4+ headers and development files: $ sudo apt-get install python3.4-dev Source /usr/local/bin/virtualenvwrapper.sh Now we can update our ~/.bashrc file (place at the bottom of the file): # virtualenv and virtualenvwrapperĮxport VIRTUALENVWRAPPER_PYTHON=/usr/bin/python3 Let’s use our fresh pip3 install to setup virtualenv and virtualenvwrapper : $ sudo pip3 install virtualenv virtualenvwrapper Let’s download pip, a Python package manager, installed for Python 3: $ wget Install packages that are used to optimize various functions inside OpenCV, such as matrix operations: $ sudo apt-get install libatlas-base-dev gfortran Install GTK so we can use OpenCV’s GUI features: $ sudo apt-get install libgtk2.0-dev Install libraries and packages used to read various image and videos formats from disk: $ sudo apt-get install libjpeg8-dev libtiff5-dev libpng-dev libavcodec-dev libavformat-dev libswscale-dev libv4l-dev Install developer tools used to compile OpenCV 3.0: $ sudo apt-get install build-essential cmake git pkg-config Upgrade any pre-installed packages: $ sudo apt-get update Well this will be a lengthy answer, so let's start :
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |