Use Anaconda to install OpenCV under Ubuntu

Source: Internet
Author: User
Tags git clone
use Anaconda to install OpenCV under Ubuntu

Recently under the Ubuntu16.04 use Anaconda installs the OpenCV, encounters many pits, records the memo. Can be directly pip installation OpenCV, but unable to read the video, need to compile the source code.

Anaconda Installing the OPENCV process

1. Cannot compile OpenCV with Anaconda installed, compile will link Anaconda Library, compile program will error. Installed first remove

    1. To the root directory, open the terminal and enter:
        sudo gedit ~/.bashrc
    2. Comment out the previously added path (or delete it directly) at the end of the. bashrc file with the # number:
        #export path=/home/lq/ Anaconda3/bin: $PATH
        Save and close the file
    3. Make it effective immediately in terminal execution:
        source ~/.BASHRC
    4.anaconda Modify Location or delete
    5. Best reboot

2 Installing OPENCV

Prerequisites # Install build tools $ sudo apt-get install build-essential cmake git # install OpenCV dependencies $ sudo Apt-get Install pkg-config Libgtk2.0-dev # Install SSL for HTTPS, v4l for video $ sudo apt-get install Libssl-dev libv4l-d EV v4l-utils Install OpenCV 3.2 $ git clone https://github.com/opencv/opencv.git $ cd opencv/$ git checkout tags/3.2.0 $ CD opencv/$ mkdir build $ cd build/$ cmake \-dcmake_build_type=release \-dcmake_install_prefix=/usr/local \ \-dwith_c
Uda=off \-dbuild_docs=off \-dbuild_examples=off \-dbuild_tests=off \-dbuild_perf_tests=off \. # If CMake hangs during "icv:downloading ippicv_linux_20151201.tgz ..." $ icv_path=: /3rdparty/ippicv/downloads/linux-808b791a6eac9ed78d32a7666804320e/ippicv_linux_20151201.tgz && \ ICV_URL= Https://github.com/opencv/opencv_3rdparty/raw/ippicv/master_20151201/ippicv/ippicv_linux_20151201.tgz & & \ rm-f $ICV _path && wget $ICV _url && mv ippicv_linux_20151201.tgz $ICV _path $ make -j$ (Nproc--all) $ sudo make install 

3 Installing OPENCV in Anaconda

Copy the/usr/local/lib/python2.7/site-packages/cv2.so to the anaconda corresponding directory

Pip Install Opencv-python

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.