问题:
最近重装了Ubuntu 16.04系统,需要重新配置opencv2.4.13,配置完成后每次都出现cmake error,google了报错,尝试了各种方法,都未解决问题,于是重新git clone 了opencv2.4.9,发现出现了同样的问题和报错。
解决方法:
刚开始没更新版本之前折腾了两天,后来感觉特别没有成就感,便慢慢放下了这件事,开始学习自己的研究生课程,学习枯燥的时候又尝试重新安装了下,终于跑通了例程,贴出例程和测试结果:
测试例程:
新建demo文件夹
新建demo.cpp,把下面代码复制黏贴:
#include <opencv2/core/core.hpp>
#include <opencv2/viz/vizcore.hpp>
int main()
{
cv::viz::Viz3d window = cv::viz::Viz3d(“Viz demonstration”);
cv::Point3d min(0.25, 0.0, 0.25);
cv::Point3d max(0.75, 0.5, 0.75);
cv::viz::WCube cube(min, max, true, cv::viz::Color::blue());
cube.setRenderingProperty(cv::viz::LINE_WIDTH, 4.0);
window.showWidget(“Axis widget”, cv::viz::WCoordinateSystem());
window.showWidget(“Cube widget”, cube);
while(!window.wasStopped()) {
window.spinOnce(1, true);
}
return 0;
}
新建CMakeLists.txt文件夹,复制黏贴以下代码:
cmake_minimum_required(VERSION 2.8.12)
project(demo)
find_package(OpenCV REQUIRED)
include_directories(${OpenCV_INCLUDE_DIRS})
add_executable(demo demo.cpp)
target_link_libraries(demo ${OpenCV_LIBS})
编译
cd demo
mkdir build
cd build
cmake ..
make
./demo
测试结果如下:
OpenCV官方教程中文版(For Python) PDF http://www.linuxidc.com/Linux/2015-08/121400.htm
Ubuntu 14.04安装OpenCV2.4.9 http://www.linuxidc.com/Linux/2016-07/132884.htm
Ubuntu 16.04上用CMake图形界面交叉编译树莓派的OpenCV3.0 http://www.linuxidc.com/Linux/2016-10/135914.htm
Ubuntu 16.04中安装OpenCV 2.4.11 http://www.linuxidc.com/Linux/2016-07/132882.htm
Ubuntu 16.04下Matlab2014a+Anaconda2+OpenCV3.1+Caffe安装 http://www.linuxidc.com/Linux/2016-07/132860.htm
Linux上安装和编译OpenCV3.0.0 http://www.linuxidc.com/Linux/2017-07/145446.htm
Ubuntu 16.04下TensorFlow+Caffe+OpenCV3.1+Theano部署 http://www.linuxidc.com/Linux/2017-01/139503.htm
Ubuntu 16.04 编译安装OpenCV 3.1及OpenCV多版本切换 http://www.linuxidc.com/Linux/2017-01/139325.htm
[翻译]Ubuntu 14.04, 13.10 下安装 OpenCV 2.4.9 http://www.linuxidc.com/Linux/2014-12/110045.htm
Ubuntu 安装 OpenCV 2.4.9 http://www.linuxidc.com/Linux/2016-12/138293.htm
OpenCV的详细介绍:请点这里
OpenCV的下载地址:请点这里
本文永久更新链接地址:http://www.linuxidc.com/Linux/2017-08/146027.htm