Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How to realize the coexistence of multiple versions of opencv2.4.8 and opencv3.3.1 in Ubuntu14.04

2025-01-20 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >

Share

Shulou(Shulou.com)06/01 Report--

This article mainly shows you "how to achieve multi-version coexistence of opencv2.4.8 and opencv3.3.1 in Ubuntu14.04", which is easy to understand and clear. I hope it can help you solve your doubts. Let me lead you to study and learn "how to achieve multi-version coexistence of opencv2.4.8 and opencv3.3.1 in Ubuntu14.04".

First of all, because I used ROS, I installed ros-indigo-destop-full and version 2.4.8 opencv when I installed ROS, because some files in ROS depend on that version of opencv, such as cv_bridge and image_pipeline. So it seems unwise to uninstall opencv2.4.8 and install opencv3.3 (because some code needs to use opencv3). Therefore, we install opencv3.3 on the basis of the original version of opencv2.4.8, so the coexistence of multiple versions of ubuntu opencv is involved here.

CUDA was previously installed, and there was an error related to CUDA during compilation, so several options need to be turned off.

Use the command to view the current version of opencv:

Pkg-config-modversion opencv

And my system comes with opencv-2.4.8.

Install opencv3.3

-first download the new version of the opencv installation package (it is recommended to download the new version and try versions 3.1 and 3.2, but also install some other dependencies). Here I download opencv3.3.1, then unzip and install the opencv dependencies

Sudo apt-get install build-essential libgtk2.0-dev libvtk5-dev libjpeg-dev libtiff4-dev libjasper-dev libopenexr-dev libtbb-dev

Enter the unzipped opencv installation package, create a new directory named build, and enter the directory

Mkdir build & & cd build

Enter a command

Sudo mkdir-r / usr/local/opencv331cmake-D CMAKE_BUILD_TYPE=RELEASE-D WITH_TBB=ON-D WITH_V4L=ON-D WITH_V4L=ON-D WITH_CUBLAS=0-D WITH_CUDA=0-D WITH_CUFFT=0-D CMAKE_INSTALL_PREFIX=/usr/local/opencv331. Make sudo make install

Here, the installation directory of opencv3.3 is placed in the / usr/local/opencv331 folder, and the parts related to CUDA are annotated (the currently installed CUDA7.5, which cannot be compiled at compile time)

Then you need to configure the following file, and set the PKG_ CONFIG_PATH by modifying the bashrc file (it turns out that you still need to change the LD_LIBRARY_PATH)

Sudo gedit / .bashrc

Add at the end of the file

Export PKG_CONFIG_PATH=/usr/local/opencv331/lib/pkgconfig export LD_LIBRARY_PATH=/usr/local/opencv331/lib

After saving, use the command

Source / .bashrc

At this time, using the command, the opencv version has been changed to 3.3.

Pkg-config-modversion opencv

Configuration

When you are using the cmake tool, add a path to CMakeLists.txt to use opencv3.3, as shown below:

When you want to return to using opencv2, replace find_package (OpenCV 3.3REQUIRED) with find_package (OpenCV REQUIRED), and delete the top and bottom lines of the code.

These are all the contents of the article "how to achieve the coexistence of multiple versions of opencv2.4.8 and opencv3.3.1 in Ubuntu14.04". Thank you for reading! I believe we all have a certain understanding, hope to share the content to help you, if you want to learn more knowledge, welcome to follow the industry information channel!

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Servers

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report