Can Linux use opencv?

11-17-2023

Designed for programming, automatic code writing robot, free to open. Most people don't quite understand whether this Linux article can use opencv, so Xiaobian summed up the following contents, with detailed contents and clear steps, which has certain reference value. I hope everyone can gain something after reading this article. Let's take a look at whether this Linux article can use opencv.

Opencv; can be used in linux; Opencv is a cross-platform computer vision and machine learning software library based on BSD license and open source distribution. It can run on linux, windows, Android and macOS operating systems, and is composed of a series of C functions and a few C++ classes. At the same time, it provides interfaces for languages such as Python, Ruby and MATLAB, and realizes many common algorithms in image processing and computer vision.

Operating environment of this tutorial: linux7.3 system and Dell G3 computer.

Can opencv be used in Linux OpenCV is a cross-platform computer vision and machine learning software library based on BSD license (open source), which can run on Linux, Windows, Android and Mac OS operating systems. It is lightweight and efficient-it is composed of a series of C functions and a small number of C++ classes. At the same time, it provides interfaces for languages such as Python, Ruby and MATLAB, and realizes many general algorithms in image processing and computer vision. When available, it uses MMX and SSE instructions, and now it also provides support for C#, Ch, Ruby and GO.

Download OpenCV

Download in the virtual machine. The download address is Releases-OpenCV. Because it is Linux, download the source version.

After downloading, copy the file to the home directory or create a new folder in the home for storage, and enter the command line to decompress. The decompression command is

unzip opencv-3.4.15.zip

Here is a different number according to your own version, I am 3.4.15, and after decompression, it is as follows.

Then configure the environment and download the dependency library and cmake needed by opencv, because the configuration file obtained after downloading cannot be used directly and needs to be compiled by cmake.

Download by 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

Then enter the file, create a my_build_dir file in the file, and enter.

mkdir my_build_dir cd my_build_dir

Cmake then started to build and generate some configuration files.

cmake -D CMAKE_BUILD_TYPE=Release -D CMAKE_INSTALL_PREFIX=/usr/local  ..

The next step is the compilation process, using sudo make.

sudo make

After the completion, it is to execute sudo make install, which 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 that under Windows system. First, add the road strength 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 just take effect.

sudo ldconfig

Configure bash

sudo gedit /etc/bash.bashrc

The above is the content of this article about whether Linux can use opencv. I believe everyone has a certain understanding. I hope that the content shared by Xiaobian will be helpful to everyone. If you want to know more about the relevant knowledge, please pay attention to the Yisu Cloud Industry Information Channel.

Ask AI for details

Copyright Description:No reproduction without permission。

Knowledge sharing community for developers。

Let more developers benefit from it。

Help developers share knowledge through the Internet。

Follow us