Click on "Xiaobai Learn Vision" above, select "Stars" public account
Heavy dry goods, delivered immediately
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.
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.
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?
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.
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
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