linux Installation Configuration: opencv3.4.6 + opencv3.4.6

Website: https://docs.opencv.org/master/d7/d9f/tutorial_linux_install.html [official website, look at this if you have a...
1. Download the specified version of opencv for linux
2. Put it into the server or computer target directory to decompress
3. cmake
4. make instruction
5. Generate files
6. Configure environment variables
There are two types of problems:
Next
Start detection using opencv

Website: https://docs.opencv.org/master/d7/d9f/tutorial_linux_install.html
[official website, look at this if you have any questions]

Reference: https://blog.csdn.net/qq_37027117/article/details/89163596
This brother has helped me a lot, but I have some problems when I carry out some detailed steps, so there will be many differences.

opencv

1. Download the specified version of opencv for linux

https://github.com/opencv/opencv/releases

Generally speaking, github is slow to hang up a ladder and download quickly.

2. Put it into the server or computer target directory to decompress

  • To the corresponding directory
unzip 3.4.6.zip

  • Entry directory
cd opencv-3.4.6
  • Create a folder called build
mkdir build

3. cmake

  • Go into the folder
cd build
  • Configure cmake
cmake -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=/usr/local/opencv346 -DPYTHON_DEFAULT_EXECUTABLE=$(which python3) -DWITH_TBB=ON -D WITH_EIGEN=ON ..


The main function is to configure, generate output and files to the specified location.
(- D should not be followed by a space, otherwise there will be an error that the directory cannot be found.)

4. make instruction

sudo make

sudo make install

  • This instruction can improve the execution speed of make on multi-core host and allow 7 parallel tasks at the same time
make -j7

(here is the original words on the official website)

5. Generate files

  • Enter doc folder
cd doc

make -j7 doxygen

6. Configure environment variables

  • Switch to superuser
sudo su
  • Modify the configuration with the privileges of super user
vi /etc/ld.so.conf.d/opencv.conf

Add at the end of the file: / usr/local/opencv346/lib (possibly an empty file)

  • Open vim again
vi /etc/bash.bashrc
  • Add at the end of the file:
PKG_CONFIG_PATH=$PKG_CONFIG_PATH:/usr/local/opencv346/lib/pkgconfig export PKG_CONFIG_PATH

Restart the terminal after configuration to make the configuration effective.
Or perform:

source /etc/bash.bashrc sudo updatedb
  • You can check whether the installation is successful. If it is successful, the following is displayed
ldconfig -v | grep opencv

opencv_contrib-3.4.6
cd build
cmake -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=/usr/local/opencv346 -DPYTHON_DEFAULT_EXECUTABLE=$(which python3) -DOPENCV_EXTRA_MODULES_PATH=../opencv_contrib-3.4.6/modules -DWITH_TBB=ON -DWITH_EIGEN=ON ..

(because the location of python3 in my server has been changed, so I write as follows)

cmake -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=/usr/local/opencv346 -DPYTHON_DEFAULT_EXECUTABLE=$(which /usr/bin/python3) -DOPENCV_EXTRA_MODULES_PATH=../opencv_contrib-3.4.6/modules -DWITH_TBB=ON -DWITH_EIGEN=ON ..
sudo make

There are two types of problems:

1⃣️When installing OpenCV, you will be prompted for a solution to the problem of missing the bootdesc? BGM. I file (with resources)

The main problem of the solution is clearly written, and there is no repetition here.

Replication method

2⃣️Solutions to opencv2/xfeatures2d/cuda.hpp: No such file or directory class problems

Take "opencv2/xfeatures2d/nonfree.hpp" as an example, the absolute path is:

/home/liu/Dear/opencv-3.4.6/opencv_contrib-3.4.6/modules/xfeatures2d/include/opencv2/xfeatures2d/nonfree.hpp

Continue to execute our sudo make.

  • At last!

Next

sudo make install

Installation complete!

Start detection using opencv

cd /home/liu/Dear/opencv-3.4.6/samples/cpp/example_cmake
cmake .
make

Because I didn't call the camera, it shows build but I didn't catch it. But the installation is ok!

Dear Slim. Published 19 original articles, won praise 16, visited 6199 Private letter follow

5 February 2020, 07:50 | Views: 7887

Add new comment

For adding a comment, please log in
or create account

0 comments