OpenCV installation and configuration

1. go to the official website to download opencv, chosen in this tutorial when opencv3.4.1, similar to other versions of the configuration methods.
Download link http://opencv.org/releases.html, select sources version

2. Extract the downloaded zip package

opencv-3.4.1.zip the unzip

3. package into the unpacked

4. dependent libraries and cmake, if need reminding apt-get update, it would first enter sudo su root privileges, then sudo apt-get update, then execute the following command

APT-GET install cmake sudo

sudo install APT-GET-dev Build-Essential libgtk2.0 libavformat the libavcodec-dev-dev libjpeg.dev libtiff4.dev libswscale-dev-dev libjasper

execute commands 5. After installing cmake, create a folder compiled , prompts not created (see below)
the in-Source builds are not allowed.

mkdir build
cd build

6.cmake about

cmake ..
Note: If you have already compiled in a new folder, but the error will appear before, and then delete the compiler can cmakecache.txt

May download a thing during the wait for a while is OK


7. Run, lengthy compilation process

sudo make

8. Run

sudo make install


9.sudo make install after the implementation of OpenCV compilation process is over, then you need to configure some OpenCV compiler environment first add the path to the OpenCV library, which allows the system to find

sudo gedit /etc/ld.so.conf.d/opencv.conf

after executing this command to open may be a blank document, do not bother, just at the end of file add

/usr/local/lib


10. Run the following commands to take effect so that the configuration path just

sudo ldconfig

this time may be prompted with the following error (upper portion) shown in FIG.

sbin / ldconfig.real: /usr/lib/nvidia-375/libEGL.so.1 is not a symbolic link
/sbin/ldconfig.real: /usr/lib32/nvidia-375/libEGL.so.1 is not a symbolic link
this error It may be due to the system caused by BUG

Only four lines are required to enter the upper portion of FIG command can solve
the sudo Music Videos /usr/lib/nvidia-375/libEGL.so.1 /usr/lib/nvidia-375/libEGL.so.1.org
the sudo Music Videos / usr / the lib32 / NVIDIA-375 / libEGL.so.1 /usr/lib32/nvidia-375/libEGL.so.1.org
the sudo -s /usr/lib/nvidia-375/libEGL.so.375.39 LN / usr / lib / NVIDIA-375 / libEGL.so.1
the sudo -s /usr/lib32/nvidia-375/libEGL.so.375.39 /usr/lib32/nvidia-375/libEGL.so.1 LN

11. Configure bash

sudo gedit /etc/bash.bashrc

at the very end add

= $ PKG_CONFIG_PATH PKG_CONFIG_PATH: / usr / local / lib / the pkgconfig
Export PKG_CONFIG_PATH


saved, run the following command to take effect so that the configuration

source /etc/bash.bashrc

update

updatedb sudo

12. At this point all the configurations have been completed
following with a small test program

Find the
cd to opencv-3.4.1 / samples / cpp / directory under example_cmake
we can see that this directory has been given an official of example we can bring cmake test
execution order

. cmake
the make
./opencv_example

you can see the open camera in the upper left corner there is a hello opencv
means that the configuration is successful

original link: https: //blog.csdn.net/cocoaqin/article/details/78163171

Guess you like

Origin www.cnblogs.com/huang-y-x/p/11635126.html