安装cmake
因为高版本的openCV 需要高版本的cmake工具,所以先更新cmake
下载cmake自己编译安装
./configure –prefix=/usr/local
make
sudo make install
安装opencv3.30
下载openCV源码文件
cd ~/opencv-x.x.x
mkdir release
cd release
cmake -D CMAKE_BUILD_TYPE=RELEASE -D CMAKE_INSTALL_PREFIX=/usr/local ..
make
(make时出错,说找不到gst/video下的头文件 跟编译QGC,类似,把gst头文件复制过去)
sudo make install添加openCV库的路径
vim /etc/ld.so.conf
添加include /usr/local/lib
添加环境变量
vim /etc/profile
添加 exportPKG_CONFIG_PATH=$PKG_CONFIG_PATH:/usr/local/lib/pkgconfig
或则
vim /etc/.bashrc
exportPKG_CONFIG_PATH=$PKG_CONFIG_PATH:/usr/local/lib/pkgconfig
测试