[official website, look at this if you have any questions]
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.
Generally speaking, github is slow to hang up a ladder and download quickly.
- To the corresponding directory
- Entry directory
- Create a folder called build
- Go into the folder
- 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.)
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
(here is the original words on the official website)
- Enter doc folder
make -j7 doxygen
- Switch to superuser
- Modify the configuration with the privileges of super user
Add at the end of the file: / usr/local/opencv346/lib (possibly an empty file)
- Open vim again
- 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.
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
- Website: https://github.com/opencv/opencv_contrib/releases
The same process, unzip to the "opencv-3.4.6" folder.
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 ..
The main problem of the solution is clearly written, and there is no repetition here.
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:
Continue to execute our sudo make.
- At last!
sudo make install
Because I didn't call the camera, it shows build but I didn't catch it. But the installation is ok!