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

The method of uninstalling and installing OpenCV3 under Linux

2025-01-17 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Internet Technology >

Share

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

This article mainly introduces "the method of uninstalling and installing OpenCV3 under Linux". In the daily operation, I believe that many people have doubts about the method of uninstalling and installing OpenCV3 under Linux. The editor consulted all kinds of materials and sorted out simple and easy-to-use operation methods. I hope it will be helpful to answer the doubts of "uninstall and installation methods of OpenCV3 under Linux". Next, please follow the editor to study!

1. Delete Opencv library

1. Go to the build folder where opencv was originally compiled

Sudo make uninstall

2. Go to the directory at the next level

Cd..

3. Delete the build folder

Sudo rm-r build

4. Delete other opencv related files

Sudo rm-r / usr/local/include/opencv2 / usr/local/include/opencv / usr/include/opencv / usr/include/opencv2 / usr/local/share/opencv / usr/local/share/OpenCV / usr/share/opencv / usr/share/OpenCV / usr/local/bin/opencv* / usr/local/lib/libopencv*

5. Check whether the deletion is clean.

Pkg-config opencv-libspkg-config opencv-modversion

If the relevant information of opencv can still be displayed, it needs to be further deleted.

Sudo apt-get autoremove opencv-doc opencv-data libopencv-dev libopencv2.4-java libopencv2.4-jni python-opencv libopencv-core2.4 libopencv-gpu2.4 libopencv-ts2.4 libopencv-photo2.4 libopencv-contrib2.4 libopencv-imgproc2.4 libopencv-superres2.4 libopencv-stitching2.4 libopencv-ocl2.4 libopencv-legacy2.4 libopencv-ml2.4 libopencv-video2.4 libopencv-videostab2.4 libopencv-objdetect2.4 libopencv-calib3d2.4 II. Reinstall Opencv

1. Go to the Opencv official website to download the corresponding installation package and decompress it.

2. Go to the opencv installation package directory and create a new build folder

Mkdir build

3. Compilation

Cd buildcmake-D CMAKE_BUILD_TYPE=RELEASE-D CMAKE_INSTALL_PREFIX=/usr/local. # I use-J4 here because my device is a 4-core sudo make-j4sudo make install

4. Add opencv's so library to the environment variable

# add / usr/local/lib at the end of the pop-up file, and then save and exit sudo gedit / etc/ld.so.conf.d/opencv.conf # to make the configuration effective sudo ldconfig

Then, open the file in the / etc/bash.bashrc directory:

Sudo gedit / etc/bash.bashrc

Add the following command to the end of the pop-up file to save the exit:

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

5. Update database

Sudo apt-get install mlocatesudo updatedb

At this point, our installation process is all over, the following can be a simple code test!

Third, simple test code

The following is a simple image display example, you can test whether the installation is successful.

# include / / header file using namespace cv; / / contains cv namespace void main () {/ / [1] reads a picture and loads the image Mat srcImage = imread ("1.jpg"); / / [2] displays the loaded image imshow ("[original image]", srcImage); / / [3] waits for any key to press waitKey (0);}

After running, the picture window is displayed, and the test is successful!

At this point, the study on "the method of uninstalling and installing OpenCV3 under Linux" is over. I hope to be able to solve your doubts. The collocation of theory and practice can better help you learn, go and try it! If you want to continue to learn more related knowledge, please continue to follow the website, the editor will continue to work hard to bring you more practical articles!

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

Internet Technology

Wechat

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

12
Report