Ubuntu 14.04安装OpenCV 3.1

时间:2022-04-29 16:29:45

从OpenCV官网上下载OpenCV官网上下载OpenCV的未编译源代码:

点击这里

国内很多网络打开OpenCV官网速度缓慢,可以点击如下地址直接从GitHub上下载OpenCV 3.1的源代码

下载地址

下载完成后解压缩,然后在Terminal中转到该目录下,执行

mkdir build
cd build
cmake -D CMAKE_BUILD_TYPE=Release -D CMAKE_INSTALL_PREFIX=/usr/local ..
make -j10

PS:上一句代码中的-j10指10线程同时编译,根据自己CPU的特点调整该参数,如果不了解自己CPU,直接执行make即可。

sudo make install

如果需要卸载OpenCV,执行:

make uninstall
cd ..
sudo rm -r build
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*