下载并解压,配置CMake并生成Makefile文件
wget https://github.com/opencv/opencv/archive/3.3.0.tar.gz
tar -zxvf 3.3.0.tar.gz
cd opencv-3.3.0/
mkdir build
cd build
cmake .. -D CMAKE_BUILD_TYPE=RELEASE -D CMAKE_INSTALL_PREFIX=/usr/local
编译安装
make
sudo make install
# 配置动态链接库共享
sudo touch /etc/ld.so.conf.d/opencv.conf
sudo echo " /usr/local/lib" >> /etc/ld.so.conf.d/opencv.conf
sudo ldconfig -v
测试程序
不使用IDE,手动编写Makefile进行编译
main.cpp
#include <highgui.h&g