Opencv can be used in Linux; opencv is a cross-platform computer vision and machine learning software library released based on BSD license open source. It can run on Linux, Windows, Android and macOS operating systems, and consists of a series of C functions It is composed of a small number of "C" classes, and provides interfaces for Python, Ruby, MATLAB and other languages, and implements many general algorithms in image processing and computer vision.
#The operating environment of this tutorial: linux7.3 system, Dell G3 computer.
OpenCV is a cross-platform computer vision and machine learning software library released based on BSD license (open source), which can run on Linux, Windows, Android and Mac OS on the system. It is lightweight and efficient - it consists of a series of C functions and a small number of C classes. It also provides interfaces in Python, Ruby, MATLAB and other languages, implements many common algorithms in image processing and computer vision, and uses them when available. MMX and SSE instructions now also provide support for C#, Ch, Ruby, and GO.
Download OpenCV
Download in the virtual machine. The download URL is Releases - OpenCV. Since it is Linux, download the source version
After downloading, copy the file to the home directory or create a new folder in the home to store it, enter the command line to decompress, the decompression command is
unzip opencv-3.4.15.zip
Here you enter according to your own version Different number, mine is 3.4.15. After decompression, it is as follows
Then configure the environment and download the dependent libraries and cmake required by opencv, because the configuration file obtained after downloading cannot To use it directly, you need to use cmake to compile
Download through the command
sudo apt-get install cmake sudo apt-get install build-essential libgtk2.0-dev libavcodec-dev libavformat-dev libjpeg.dev libtiff5.dev libswscale-dev libjasper-dev
and then enter the file, then create a my_build_dir file in the file, and enter
mkdir my_build_dir cd my_build_dir
and then cmake Start building and generating some configuration files
cmake -D CMAKE_BUILD_TYPE=Release -D CMAKE_INSTALL_PREFIX=/usr/local ..
The next step is the compilation process. Use sudo make
sudo make
After completion, execute sudo make install. This command is used for installation.
sudo make install
The next step is to configure the environment variables. The configuration process is a little more complicated than under Windows system. First add the path through gedit and open the file, and add /usr/local/lib at the end of the file
sudo gedit /etc/ld.so.conf.d/opencv.conf
After saving, switch to the command line interface and execute the command to make the configuration path take effect
sudo ldconfig
Configuring bash
sudo gedit /etc/bash.bashrc
Recommended learning: Linux video tutorial
The above is the detailed content of Can Linux use opencv?. For more information, please follow other related articles on the PHP Chinese website!