简介
OpenCV是一个基于BSD许可( 开源 )发行的跨平台计算机视觉库,可以运行在Linux、Windows、Android和Mac OS操作系统上。它轻量级而且高效——由一系列C函数和少量C++类构成,同时提供了Python、Ruby、MATLAB等语言的接口,实现了图像处理和计算机视觉方面的很多通用算法。
编译和测试方式
1.配置编译环境
1)安装wget工具。
yum install wget -y
2)安装OpenCV依赖库和工具
yum install -y git gcc-c++ -y
3)安装cmake依赖
yum install -y git gcc-c++ cmake
----结束
2.获取源码
获取“OpenCV-3.0.0”源码包。
cd /usr/local/src
wget https://github.com/opencv/opencv/archive/3.0.0.tar.gz
3.编译和安装
编译“OpenCV-3.0.0”并进行安装。
cd /usr/local/src/
tar -zxvf 3.0.0.tar.gz
cd opencv-3.0.0/
mkdir build
cd build/
cmake ..
make -j8 && make instal
4.运行和验证
查看安装OpenCV所生成的库文件和头文件。
ll /usr/local/lib
回显内容如下,表示安装正常。
[root@ecs-teukh-1 lib]# ll /usr/local/lib
total 44868
lrwxrwxrwx 1 root root 24 Aug 31 10:56 libopencv_calib3d.so -> libopencv_calib3d.so.3.0
lrwxrwxrwx 1 root root 26 Aug 31 10:56 libopencv_calib3d.so.3.0 -> libopencv_calib3d.so.3.0.0
-rwxr-xr-x 1 root root 1242280 Aug 31 10:53 libopencv_calib3d.so.3.0.0
lrwxrwxrwx 1 root root 21 Aug 31 10:56 libopencv_core.so -> libopencv_core.so.3.0
lrwxrwxrwx 1 root root 23 Aug 31 10:56 libopencv_core.so.3.0 -> libopencv_core.so.3.0.0
-rwxr-xr-x 1 root root 2886784 Aug 31 10:48 libopencv_core.so.3.0.0
lrwxrwxrwx 1 root root 27 Aug 31 10:56 libopencv_features2d.so -> libopencv_features2d.so.3.0
lrwxrwxrwx 1 root root 29 Aug 31 10:56 libopencv_features2d.so.3.0 -> libopencv_features2d.so.3.0.0