How to install two versions of OpenCV under ubuntu?

Click on "Xiaobai Learn Vision" above, select "Stars" public account

Heavy dry goods, delivered immediately

Foreword

As in the development and research process of many vision projects, the installation of different versions of OpenCV under the ubuntu system is often involved. Therefore, Xiaofan briefly summarizes the steps of the two versions of OpenCV under the ubuntu system for quick reference when reinstalling the system in the future. If there are any shortcomings, please criticize and correct.

A download of OpenCV source code

The OpenCV version we chose to install in this article is OpenCV3.3.1. The source code download link can be obtained by following the WeChat official account "3D Vision Workshop" and replying to "OpenCV3.3.1_linux" in the background to get the download link of the installation package.

Second, check the currently installed OpenCV version

Open the terminal and enter the following command to view the currently installed version of OpenCV.

$ pkg-config --modversion opencv

It can be found that the path of our current version of OpenCV installation is: /usr/local/include

Next, we want to install OpenCV3.3.1 in our own newly created folder directory /home/yongqi/workspace/2_ProgramFiles/OpenCV3.3.1, so how do we operate?

Three start to install OpenCV

In the preface, we explained how to obtain the source code installation package of OpenCV3.3.1. After downloading and decompressing, we can install it as follows:

step-1:$ cd  ***/opencv-3.3.1//To opencv-3.3.Step under the unzipped directory of 1-2:$ mkdir buildstep-3:$ cmake -D CMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=/home/yongqi/workspace/2_ProgramFiles/OpenCV3.3.1 .. //Note here..Don't forget step-4:$ make -j8step-5:sudo make install -j6

In this way, opencv3.3.1 will be installed in the directory you specify.

Four configure OpenCV environment

Next, we also need to configure some environment variables of OpenCV.

step-1:gedit ~/.bashrcstep-2:Write it down and add the following at the end of the above opened file: export PKG_CONFIG_PATH=/home/yongqi/workspace/2_ProgramFiles/OpenCV3.3.1/lib/pkgconfigexport LD_LIBRARY_PATH=/home/yongqi/workspace/2_ProgramFiles/OpenCV3.3.1/After lib is saved and executed: step-3:$ source ~/.bashrc

Next, configure the lib path of OpenCV

step-1: $ cd /etc/ld.so.conf.dstep-2: $ sudo gedit  opencv.confstep-3:Opencv opened above.Write opencv3 in conf.3.1 lib path/home/yongqi/workspace/2_ProgramFiles/OpenCV3.3.1/libstep-4: $ sudo ldconfig

Five test the current version of OpenCV

step-1: $ pkg-config --modversion opencvstep-2: $ pkg-config --cflags opencvstep-3: $ pkg-config --libs opencv

Through the above, we can see that OpenCV in the system has become OpenCV 3.3.1 version.

**Remarks: **

If you still want to use the original OpenCV2.4.9, just modify the fourth step to the pkgconfig path of OpenCV2.4.9.

Reference blog post:

https://blog.csdn.net/c20081052/article/details/87911559

If the above content infringes copyright, please contact the author and the article will be deleted.

Learn OpenCV 4 from zero recommended in the past

[ Installation [from zero learning OpenCV 4] Windows system OpenCV 4] (http://mp.weixin.qq.com/s?__biz=MzU0NjgzMDIxMQ==&mid=2247486209&idx=1&sn=9f6f9c32e6bcb7687319b4e225019cfb&chksm=fb56e9edcc2160fbd97d33a7d304e843283734267f02441f2cb79a1579ab8cdbe2caba71ed0a&scene=21#wechat_redirect)

[ [Learning OpenCV 4 from Zero] Install OpenCV 4 in Ubuntu system](http://mp.weixin.qq.com/s?__biz=MzU0NjgzMDIxMQ==&mid=2247486217&idx=1&sn=21a42606779dc39c7b022646ffbfecc7&chksm=fb56804e9e5cc21508e26aecc7&chksm=fb56804e9e5cc72160531520611

[ [Learning OpenCV 4] from zero expansion module mounting opencv_contrib] (http://mp.weixin.qq.com/s?__biz=MzU0NjgzMDIxMQ==&mid=2247486223&idx=1&sn=120a033bab2db9a46c60e6902af107a9&chksm=fb56e9e3cc2160f504b4c488e0bce4295ca892d74cfe1f85186be97bfab04bb56254a9f548cb&scene=21#wechat_redirect)

[ [Learning OpenCV 4 from Zero] Introduction to Mat Classes](http://mp.weixin.qq.com/s?__biz=MzU0NjgzMDIxMQ==&mid=2247486288&idx=1&sn=720e6f6760ddf8d491097f9450e5b453&chksm=fb56e1e9bcd264benecevd21609scenes#8429sm=sn=720e6f6760ddf8d491097f9450e5b453&chksm=fb56e1e1ccd21609scenes#8429sm

[ [From zero learning OpenCV 4] Mat class constructor and assignment] (http://mp.weixin.qq.com/s?__biz=MzU0NjgzMDIxMQ==&mid=2247486299&idx=1&sn=14af1a1a7ae8ef752bd2e94d7b8f6dc5&chksm=fb56e9b7cc2160a1324ce04836457a4ce4ebf7d04d45085feb9e5e2681cdee8b0ff3981ef4f2&scene=21#wechat_redirect)

[ [Learning OpenCV 4 from scratch] Math supported operations](http://mp.weixin.qq.com/s?__biz=MzU0NjgzMDIxMQ==&mid=2247486325&idx=1&sn=ed7a612c035292d3e3a00fdb6191c207&chksm=fb60afedfc21608ddefd7fc21f5s

[ [Learning OpenCV 4 from scratch] Do you know these 4 ways to read Mat elements? ](http://mp.weixin.qq.com/s?__biz=MzU0NjgzMDIxMQ==&mid=2247486341&idx=1&sn=19d464a8683d41fa3b7b1d484353c556&chksm=fb56e969ccenebenef32f6af4402337b2121467f6af4402f35378f28b9797b7de61ed7f4

[ [Learning OpenCV 4 from Zero] The use of namedWindow function & imshow function](http://mp.weixin.qq.com/s?__biz=MzU0NjgzMDIxMQ==&mid=2247486375&idx=2&sn=ba3d290dfece425c4ae871c1c4ac3b28

[ [Learning OpenCV 4 from scratch] Color model and conversion](http://mp.weixin.qq.com/s?__biz=MzU0NjgzMDIxMQ==&mid=2247486482&idx=2&sn=38ddbc15770051d3a3f5b96137100f&cheeksm=fb56ee1666eebe17e1666e26e1666e1666e16f26e16f26e16f26e8f16f26ees directly

Recommended Posts

How to install two versions of OpenCV under ubuntu?
How to install OpenCV on Ubuntu 20.04
How to install Audacious under Ubuntu
How to install Tensorflow under ubuntu 16.04
How to install gcc compiler faster under Ubuntu
How to install Helm in Ubuntu
How to install Memcached on Ubuntu 20.04
How to install Java on Ubuntu 20.04
How to install MySQL on Ubuntu 20.04
How to install VirtualBox on Ubuntu 20.04
How to install Elasticsearch on Ubuntu 20.04
How to install Protobuf 3 on Ubuntu
How to install Nginx on Ubuntu 20.04
How to install Apache on Ubuntu 20.04
How to install Git on Ubuntu 20.04
How to install MySQL on Ubuntu 20.04
How to install Vagrant on Ubuntu 20.04
How to install Bacula-Web on Ubuntu 14.04
How to install PostgreSQL on Ubuntu 16.04
How to install Git on Ubuntu 20.04
How to compile ijkplayer-android under ubuntu
How to install Anaconda3 on Ubuntu 18.04
How to install mysql in Ubuntu 14.04
How to install Memcached on Ubuntu 18.04
How to install Jenkins on Ubuntu 16.04
How to install Go on Ubuntu 20.04
How to install Mailpile on Ubuntu 14.04
How to install PrestaShop on Ubuntu 16.04
How to install Skype on Ubuntu 20.04
How to install Jenkins on Ubuntu 20.04
How to install Python 3.8 on Ubuntu 18.04
How to install KVM on Ubuntu 18.04
How to install KVM on Ubuntu 20.04
How to install Anaconda on Ubuntu 20.04
How to install Prometheus on Ubuntu 16.04
How to install Jenkins on Ubuntu 18.04
How to install Apache on Ubuntu 20.04
How to install R on Ubuntu 20.04
How to install Moodle on Ubuntu 16.04
How to install Solr 5.2.1 on Ubuntu 14.04
How to install Teamviewer on Ubuntu 16.04
How to install MariaDB on Ubuntu 20.04
How to install Nginx on Ubuntu 20.04
How to install Mono on Ubuntu 20.04
How to install Go on Ubuntu 20.04
How to install Zoom on Ubuntu 20.04
How to install mysql in Ubuntu 14.04
How to install Nginx on Ubuntu 16.04
How to install Spotify on Ubuntu 20.04
How to install Postman on Ubuntu 18.04
How to install Go 1.6 on Ubuntu 16.04
How to install Go on Ubuntu 18.04
How to install OpenCV on CentOS 8
How to install MySQL on Ubuntu 14.04
How to install PostgreSQL on Ubuntu 20.04
How to install VLC on Ubuntu 18.04
How to install TeamViewer on Ubuntu 20.04
How to install Webmin on Ubuntu 20.04
How to install Docker Compose on Ubuntu 18.04
How to install Ubuntu on Raspberry Pi
How to install Bacula Server on Ubuntu 14.04