简介
OpenCV的全称是:Open Source Computer Vision Library。opencv是一个基于BSD许可(开源)发行的跨平台计算机视觉库,可以运行在Linux、Windows和Mac
OS操作系统上。它轻量级而且高效——由一系列C 函数和少量
C++ 类构成,同时提供了Python、Ruby、MATLAB等语言的接口,实现了图像处理和计算机视觉方面的很多通用算法。
所有新的开发和算法都是用C++接口。一个使用CUDA的GPU接口也于2010年9月开始实现。
官方主页:http://opencv.org/
官方文档:http://docs.opencv.org/2.4/modules/refman.html
文件结构
在调用opencv时需要用到的头文件分布(默认安装情况下,同时下面都是基于2.4.x版本):
- 对
windows系统来说,一般在OPENCV_DIR/build/include/文件夹下,所以在VS中调用时需要配置附加库目录; - 对
ubuntu系统来说,一般在/usr/local/include/文件夹下,系统目录下,系统可以自动识别;
在include一般包含两个文件夹:
-
opencv文件夹下面的内容是OpenCV1.0保留下来的头文件,现在很少使用了,所以在这里不关注; -
opencv2文件夹下是以后主要用到的功能模块;opencv2文件夹下面的结构如下图:下面来单独介绍每个模块的功能(主要参考《OpenCV3编程入门》这本书,下面有下载链接,有兴趣的可以查看一下):
常用模块
-
core,核心功能模块,主要包含如下的内容:-
OpenCV基本数据结构(Basic Structures); - 基本的
C语言数据结构和操作(Basic C Structures and Operations); - 动态数据结构(
Dynamic Structures); - 数组操作相关函数(
Operations on Arrays); - 绘图功能(
Drawing Functions); -
XML和YAML语法的支持(XML/YAML Persistence); -
XML和YAML语法的支持的C语言接口(XML/YAML Persistence (C API)); - 聚类(
Clustering); - 辅助功能与系统函数和宏(
Utility and System Functions and Macros); - 与
OpenGL的互操作(OpenGL interoperability);
-
-
imgproc,是Image Processing的简写。图像处理模块,主要包含以下内容:- 线性和非线性的图像滤波(
Image Filtering); - 图像的几何变换(
Geometric Image Transformations); - 图像的其他变换(
Miscellaneous Image Transformations); - 直方图(
Histograms); - 结构分析和形状描述(
Structural Analysis and Shape Descriptors); - 运动分析和目标跟踪(
Motion Analysis and Object Tracking); - 特征检测(
Feature Detection); - 目标检测(
Object Detection);
- 线性和非线性的图像滤波(
-
highgui,是High-level GUI and Media I/O的简写。高层用户界面模块和媒体输入/输出模块,主要包含以下内容:- 用户界面(
User Interface); - 图片和视频的读写(
Reading and Writing Images and Video); - QT新功能(
Qt New Functions);
- 用户界面(
-
features2d,是2D Features Framework的简写。二维特征框架模块,主要包含以下内容:- 特征的检测和描述(
Feature Detection and Description); - 特征检测器的通用接口(
Common Interfaces of Feature Detectors); - 描述符提取器的通用接口(
Common Interfaces of Descriptor Extractors); - 描述符匹配器的通用接口(
Common Interfaces of Descriptor Matchers); - 通用描述符匹配器通用接口(
Common Interfaces of Generic Descriptor Matchers); - 关键点和匹配结果的绘制功能(
Drawing Function of Keypoints and Matches); - 目标分类(
Object Categorization);
- 特征的检测和描述(
-
flann,Clustering and Search in Multi-Dimensional Spaces,多维空间聚类和搜索模块,主要包含以下内容:- 快速近视最近邻搜索(
Fast Approximate Nearest Neighbor Search); - 聚类(
Clustering);
- 快速近视最近邻搜索(
-
video,是Video Analysis的简写。视频分析模块,主要包含以下内容:- 运动分析和目标跟踪(
Motion Analysis and Object Tracking),视频相关的,上面提到的是图片相关的;
- 运动分析和目标跟踪(
-
calib3d,是Camera Calibration and 3D Reconstruction的简写。这个模块主要是相机校准和三维重建相关的内容,包括基本的多视角几何算法、单个立体摄像头标定、物体姿态估计、立体相似性算法,3D信息的重建等。
加速模块
-
gpu,是GPU-accelerated Computer Vision的简写,利用GPU加速的视觉模块,主要包含以下内容:-
GPU模块介绍(GPU Module Introduction); - 初始化和信息(
Initalization and Information); - 数据结构(
Data Structures); - 矩阵操作(
Operations on Matrices); - 逐个元素操作(
Per-element Operations); - 图像处理(
Image Processing); - 矩阵降维(
Matrix Reductions); - 目标检测(
Object Detection); - 特征检测和描述(
Feature Detection and Description); - 图像滤波(
Image Filtering); - 相机标定和三维重建(
Camera Calibration and 3D Reconstruction); - 视频分析(
Video Analysis);
-
-
ocl,是OpenCL-accelerated Computer Vision的简写,运用OpenCL加速的视觉模块,主要包含以下内容:-
OpenCL模块介绍(OpenCL Module Introduction); - 数据结构和公用功能(
Data Structures and Utility Functions); - 数据结构(
Data Structures); - 矩阵操作(
Operations on Matrics); - 矩阵降维(
Matrix Reductions); - 图像滤波(
Image Filtering); - 图像处理(
Image Processing); - 机器学习(
ml.Machine Learning); - 目标检测(
Object Detection); - 特征检测和描述(
Feature Detection And Description); - 视频分析(
Video Analysis); - 相机标定和三维重建(
Camera Calibration and 3D Reconstruction);
-
其他模块
-
contrib,是Contributed/Experimental Stuff的简写。该模块包含了一些最近添加的不太稳定的可选的功能,一般用不着,不用太关注。主要包含如下的内容:- 立体匹配(
Stereo Correspondence); - 人脸识别模型(
FaceRecognizer Documentation); - 视网膜模型(
Retina Documentation); - 开源的快速外貌的映射算法(
OpenFABMAP,Fast Appearance-based Mapping algorithm);
- 立体匹配(
-
objdetect,是Object Detection的简写。目标检测模块,主要包含以下内容:- 级联分类(
Cascade Classification); - SVM分类模型(
Latent SVM);
- 级联分类(
-
ml,是Machine Learning简写。机器学习模块,主要包含以下内容:- 统计模型(
Statistical Models); - 一般贝叶斯分类器(
Normal Bayes Classifier); - K-近邻(
K-Nearest Neighbors); - 支持向量机(
Support Vector Machines); - 决策树(
Decision Trees); - 提升(
Boosting); - 梯度提高树(
Gradient Boosted Trees); - 随机数(
Random Trees); - 超随机树(
Extremely randomized trees); - 期望最大化(
Expectation Maximization); - 神经网络(
Neural Networks); - 机器学习数据(
MLData);
- 统计模型(
-
photo,Computational Photography,计算摄影模块,主要包含以下内容:- 修复(
Inpainting); - 去噪(
Denoising);
- 修复(
-
stitching,Images stitching,图像拼接模块,主要包含以下内容:- 拼接流水线(
Stitching Pipeline); - 参考文献(
References); - 高层功能,拼接器(
High Level Functionality); - 相机(
Camera); - 特征寻找和图像匹配(
Features Finding and Images Matching); - 旋转估计(
Rotation Estimation); - 自动校准(
Autocalibration); - 图像扭曲(
Images Warping); - 接缝估计(
Seam Estimation); - 曝光补偿(
Exposure Compensation); - 图形混合(
Image Blenders);
- 拼接流水线(
-
nonfree,Non-free functionality,不免费的功能,一些具有专利的算法模块,主要包含以下内容:- 特征提取和描述(
Feature Detection and Description);
- 特征提取和描述(
-
legacy,Deprecated stuff,一些废弃的代码模块,留下了为了向下兼容,主要包含以下内容:- 运动分析(
Motion Analysis); - 期望最大值(
Expectation Maximization); - 直方图(
Histograms); - 平面细分
C语言接口(Planar Subdivisions (C API)); - 特征提取和描述(
Feature Detection and Description); - 描述符提取器的通用接口(
Common Interfaces of Descriptor Extractors); - 通用描述符的通用接口(
Common Interfaces of Generic Descriptor Matchers);
- 运动分析(
-
superres,是Super Resolution的简写,超分辨率技术模块,主要包含以下内容:- 超分辨率(
Super Resolution);
- 超分辨率(
-
viz,是3D Visualizer的简写,三维可视化工具模块,主要包含以下内容:- 可视化(
Viz); - 组件(
Widget);
- 可视化(
参考资料
ubuntu上安装使用opencv请参考:http://blog.csdn.net/honyniu/article/details/46390097
参考书链接:http://download.csdn.net/detail/honyniu/9474159 (最新的关于OpenCV3的书)