Home  >  Article  >  Operation and Maintenance  >  (1) Install and compile OpenCV3.0.0 on Linux

(1) Install and compile OpenCV3.0.0 on Linux

PHP中文网
PHP中文网Original
2017-07-04 19:32:261532browse

The full name of OpenCV is: Open Source Computer Vision Library. OpenCV is a cross-platform computer vision library based on (open source) distribution and can run on Linux, Windows and Mac OS operating systems. It is lightweight and efficient - composed of a series of C functions and a small number of C++ classes. It also provides interfaces in Python, Ruby, Matlab and other languages ​​to implement image processing and many common algorithms in computer vision.

1. Install OpenCV dependency packages

[Compiler] > sudo apt-get install build-essential

[Must be installed] > sudo apt-get install cmake git libgtk2.0-dev pkg-config libavcodedec-dev libavformat-dev libswscale-dev

[Optional installation] > sudo apt-get install python-dev python-numpy libtbb2 libtbb-dev libjpeg-dev libpng-dev libtiff-dev libjasper-dev libdc1394-22-dev

2. Build from source codeOpenCV

After installing Python, Python-related software packages, and cmake, you can build OpenCV. First start with

Download the source code and unzip it, then move it to the folder where you unzipped the folder on your terminal.

Then run the following command:

>> mkdir build

>> cd build

Use the following cmake command for compilation settings

>> cmake –D CMAKE_BUILD_TYPE=Release –D CMAKE_INSTALL_PREFIX=/usr/local ..

>> make

>> make install

If you run the opencv library under python, you must install the following

sudo apt-get install python-opencv

Complete the above process and the installation is complete

3. Test and check whether opencv is installed successfully

Please note in the following code that the image and code files must be in the same folder, otherwise the image path must be indicated.

As shown in the above figure, if the picture is displayed, it proves that opencv is installed successfully.

Notes: 1. This process uses the Raspberry Pi 3 system to install opencv. Of course, it is very time-consuming when compiling! ! ! ! ! !

2. The downloading process of opencv source code is very slow, so FQ is recommended. refer to:

This blog refers to "OpenCV3 Computer Vision"

The above is the detailed content of (1) Install and compile OpenCV3.0.0 on Linux. For more information, please follow other related articles on the PHP Chinese website!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn