查詢opencv版本
$ pkg-config --modversion opencv
下载OpenCV
首先去https://opencv.org/releases.html下载所需版本的Sources版
安裝
$ cd opencv-3.4.2
$ mkdir build
$ cd ..
$ mkdir installed
$ cmake -D CMAKE_BUILD_TYPE=Release -D CMAKE_INSTALL_PREFIX=/home/mirrorubuntu/workspace/opencv-3.4.2/installed ..
$ make -j4
$ sudo make install
也就是說opencv-3.4.2下有build和installed兩個文件夾
錯誤1:編譯文件夾位置錯誤
更改.bashrc
添加bashrc
$ export PKG_CONFIG_PATH=/home/mirrorubuntu/workspace/opencv-3.4.2/installed/lib/pkgconfig
$ export LD_LIBRARY_PATH=/home/mirrorubuntu/workspace/opencv-3.4.2/installed/lib
$ source ~/.bashrc
查看结果
$ pkg-config --modversion opencv
https://blog.csdn.net/learning_tortosie/article/details/80594399?spm=1001.2101.3001.6661.1&utm_medium=distribute.pc_relevant_t0.none-task-blog-2%7Edefault%7ECTRLIST%7ERate-1.pc_relevant_paycolumn_v3&depth_1-utm_source=distribute.pc_relevant_t0.none-task-blog-2%7Edefault%7ECTRLIST%7ERate-1.pc_relevant_paycolumn_v3&utm_relevant_index=1
运行工程: CMakelist.txt
project(slam-dynamic)
set(OpenCV_DIR "~/workspace/opencv-3.4.2/build")
如果想使用之前的版本,在~/.bashrc中注释掉增加的内容,然后source ~/.bashrc即可。
|