当前位置:网站首页>Ubantu1804 two opencv versions coexist

Ubantu1804 two opencv versions coexist

2022-06-11 20:40:00 On the way 1216

ubantu18.04 Bring their own opencv3.2.0

Due to the use indemind The binocular module needs to be installed opencv343;

First go opencv Download from the official website 343source Source code and extract ;

mkdir build && cd build

cmake Be sure to pay attention to the path , This installation is in /usr/local/opencv/opencv343

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

Next, compile

sudo make -j4

Execute the installation command

sudo make install

take OpenCV Add the library to the path , So that the system can find

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

After executing this command, a blank file is opened , Never mind , Copy the following code , Save and close

/usr/local/opencv/opencv343
/usr/local/opencv/opencv343/lib

Execute the following command to make the configuration path effective

sudo ldconfig  

To configure bash

sudo gedit /etc/bash.bashrc  

Add... At the end of the text

PKG_CONFIG_PATH=$PKG_CONFIG_PATH:/usr/local/opencv/opencv343/lib/pkgconfig
export PKG_CONFIG_PATH

Execute the following command to make the configuration take effect

source /etc/bash.bashrc  

 perhaps 

sudo ~/.bashrc
 Open and add the following sentence 
source /etc/bash.bashrc  

to update

sudo updatedb  

End pro test available .

Test the version , Back to client input

pkg-config opencv --modversion

Show

3.4.3

Express opencv Installation successful .

In the use of opencv343 when , Can be found in cmakelist Add... To the file

set(OpenCV_DIR "/home/tianbot/Downloads/opencv-3.4.3/build")   
set(OpenCV_LIB_PATH "/usr/local/opencv/opencv343/lib")   
set(OpenCV_INCLUDE_DIRS "/usr/local/opencv/opencv343/include") 

原网站

版权声明
本文为[On the way 1216]所创,转载请带上原文链接,感谢
https://yzsam.com/2022/162/202206112030016371.html