Home  >  Article  >  Backend Development  >  [OpenCV introductory tutorial 2] A glance at the small mountains: Full analysis of the component structure of OpenCV 2.4.8 or OpenCV 2.4.9 (transfer), opencv2.4.9_PHP tutorial

[OpenCV introductory tutorial 2] A glance at the small mountains: Full analysis of the component structure of OpenCV 2.4.8 or OpenCV 2.4.9 (transfer), opencv2.4.9_PHP tutorial

WBOY
WBOYOriginal
2016-07-12 09:03:35991browse

[OpenCV introductory tutorial part 2] Take a look at the small mountains: Full analysis of the component structure of OpenCV 2.4.8 or OpenCV 2.4.9 (translated), opencv2.4.9

<p>本系列文章由zhmxy555(毛星云)编写,转载请注明出处。  </p>
<p><span><span> 文章链接: http://blog.csdn.net/poem_qianmo/article/details/19925819</span></span></p>
<p> </p>
<p><span><span><span> 作者:毛星云(浅墨)    邮箱: happylifemxy@163.com </span></span></span></p>
<p><span><span><span> 写作当前博文时配套使用OpenCV版本:2.4.8</span></span></span></p>
<p> </p>
<p> </p>
<p> </p>
<p> </p>
<p>之前啃了不少OpenCV的官方文档,发现如果了解了一些OpenCV整体的模块架构后,再重点学习自己感兴趣的部分的话,就会有一览众山小的感觉,于是,就决定写出这篇文章,作为启程OpenCV系列博文的第二篇。</p>
<p> </p>
<p>至于OpenCV组件结构的研究方法,我们不妨管中窥豹,通过opencv安装路径下include目录里面头文件的分类存放,来一窥OpenCV这些年迅猛发展起来的庞杂组件架构。</p>
<p>我们进入到D:\ProgramFiles\opencv\build\include目录,可以看到有opencv和opencv2这两个文件夹。显然,opencv这个文件夹里面包含着旧版的头文件。而opencv2这个文件夹里面包含着具有时代意义的新版OpenCV2系列的头文件。</p>
<p> </p>
<p> <img src="http://img.blog.csdn.net/20140225181139578?watermark/2/text/aHR0cDovL2Jsb2cuY3Nkbi5uZXQvcG9lbV9xaWFubW8=/font/5a6L5L2T/fontsize/400/fill/I0JBQkFCMA==/dissolve/70/gravity/SouthEast" alt="" /></p>
<p>在opencv这个文件夹里面,也就是D:\Program Files\opencv\build\include\opencv目录下,可以看到如下的各种头文件。这里面大概就是opencv 1.0最核心的,而且保留下来的内容的头文件,可以把它们整体理解为一个组件。</p>
<p> </p>
<p> <img src="http://img.blog.csdn.net/20140225181220281?watermark/2/text/aHR0cDovL2Jsb2cuY3Nkbi5uZXQvcG9lbV9xaWFubW8=/font/5a6L5L2T/fontsize/400/fill/I0JBQkFCMA==/dissolve/70/gravity/SouthEast" alt="" data-pinit="registered" /></p>
<p> </p>
<p> 再来看看我们重点关注的opencv2这边,在D:\ProgramFiles\opencv\build\include\opencv2目录下,我们可以看到这些文件夹:</p>
<p><img src="http://img.blog.csdn.net/20140225181302390?watermark/2/text/aHR0cDovL2Jsb2cuY3Nkbi5uZXQvcG9lbV9xaWFubW8=/font/5a6L5L2T/fontsize/400/fill/I0JBQkFCMA==/dissolve/70/gravity/SouthEast" alt="" data-pinit="registered" /></p>
<p> </p>
<p> </p>
<p> </p>
<p>我们灵机一动,发现下面有个叫opencv_modules.hpp的hpp文件,一看就知道里面存放的是opencv2中的新模块构造相关的说明代码,打开一看,果不其然,定义的是OpenCV2所有组件的宏:</p>
<p> </p>


<strong>[cpp]</strong> view plaincopyprint?<img src="https://code.csdn.net/assets/CODE_ico.png" alt="[OpenCV introductory tutorial 2] A glance at the small mountains: Full analysis of the component structure of OpenCV 2.4.8 or OpenCV 2.4.9 (transfer), opencv2.4.9_PHP tutorial"    style="max-width:90%"  style="max-width:90%" /><img src="https://code.csdn.net/assets/ico_fork.svg" alt="[OpenCV introductory tutorial 2] A glance at the small mountains: Full analysis of the component structure of OpenCV 2.4.8 or OpenCV 2.4.9 (transfer), opencv2.4.9_PHP tutorial"    style="max-width:90%"  style="max-width:90%" />
 


<ol class="dp-cpp" start="1">
<li class="alt"><span class="comment">/* </span></li>
<li><span class="comment"> *     ** File generated automatically, do not modify ** </span></li>
<li class="alt"><span class="comment"> * </span></li>
<li><span class="comment"> *This file defines the list of modules available in current build configuration </span></li>
<li class="alt"><span class="comment"> * </span></li>
<li><span class="comment"> * </span></li>
<li class="alt"><span class="comment">*/  </span></li>
<li>   </li>
<li class="alt"><span class="preprocessor">#define HAVE_OPENCV_CALIB3D  </span></li>
<li><span class="preprocessor">#define HAVE_OPENCV_CONTRIB  </span></li>
<li class="alt"><span class="preprocessor">#define HAVE_OPENCV_CORE  </span></li>
<li><span class="preprocessor">#define HAVE_OPENCV_FEATURES2D  </span></li>
<li class="alt"><span class="preprocessor">#define HAVE_OPENCV_FLANN  </span></li>
<li><span class="preprocessor">#define HAVE_OPENCV_GPU  </span></li>
<li class="alt"><span class="preprocessor">#define HAVE_OPENCV_HIGHGUI  </span></li>
<li><span class="preprocessor">#define HAVE_OPENCV_IMGPROC  </span></li>
<li class="alt"><span class="preprocessor">#define HAVE_OPENCV_LEGACY  </span></li>
<li><span class="preprocessor">#define HAVE_OPENCV_ML  </span></li>
<li class="alt"><span class="preprocessor">#define HAVE_OPENCV_NONFREE  </span></li>
<li><span class="preprocessor">#define HAVE_OPENCV_OBJDETECT  </span></li>
<li class="alt"><span class="preprocessor">#define HAVE_OPENCV_OCL  </span></li>
<li><span class="preprocessor">#define HAVE_OPENCV_PHOTO  </span></li>
<li class="alt"><span class="preprocessor">#define HAVE_OPENCV_STITCHING  </span></li>
<li><span class="preprocessor">#define HAVE_OPENCV_SUPERRES  </span></li>
<li class="alt"><span class="preprocessor">#define HAVE_OPENCV_TS  </span></li>
<li><span class="preprocessor">#define HAVE_OPENCV_VIDEO  </span></li>
<li class="alt"><span class="preprocessor">#define HAVE_OPENCV_VIDEOSTAB  </span></li>
</ol>
<p> </p>
<p> </p>
<p>OK,就不多客套了,下面就是OpenCV的所有模块介绍,按照顺序来:</p>
<p> </p>
<p>【calib3d】&mdash;&mdash;其实就是就是Calibration(校准)加3D这两个词的组合缩写。这个模块主要是相机校准和三维重建相关的内容。基本的多视角几何算法,单个立体摄像头标定,物体姿态估计,立体相似性算法,3D信息的重建等等。</p>
<p> </p>
<p>【contrib】&mdash;&mdash;也就是Contributed/Experimental Stuf的缩写, 该模块包含了一些最近添加的不太稳定的可选功能,不用去多管。2.4.8里的这个模块有新型人脸识别,立体匹配,人工视网膜模型等技术。</p>
<p> </p>
<p>【core】&mdash;&mdash;核心功能模块,包含如下内容:</p>
<pre class="code">
<pre class="code">
<h2></h2>
<p> </p>
<p> </p>
<ul>
<li>OpenCV基本数据结构</li>
<li>动态数据结构</li>
<li>绘图函数</li>
<li>数组操作相关函数</li>
<li>辅助功能与系统函数和宏</li>
<li>与OpenGL的互操作</li>
</ul>
<h2></h2>
<p> </p>
<p> </p>
<p> 【imgproc】&mdash;&mdash;Image和Processing这两个单词的缩写组合。图像处理模块,这个模块包含了如下内容:</p>
<pre class="code">
<pre class="code">
<h2></h2>
<p> </p>
<p> </p>
<ul>
<li>线性和非线性的图像滤波</li>
<li>图像的几何变换</li>
<li>其它(Miscellaneous)图像转换</li>
<li>直方图相关</li>
<li>结构分析和形状描述</li>
<li>运动分析和对象跟踪</li>
<li>特征检测</li>
<li>目标检测等内容</li>
</ul>
<h2></h2>
<p> </p>
<p> </p>
<p>【features2d】 &mdash;&mdash;也就是Features2D, 2D功能框架 ,包含如下内容:</p>
<pre class="code">
<pre class="code">
<ul>
<li><strong>特征检测和描述</strong></li>
<li><strong>特征检测器(Feature Detectors)通用接口</strong></li>
<li><strong>描述符提取器(Descriptor Extractors)通用接口</strong></li>
<li><strong>描述符匹配器(Descriptor Matchers)通用接口</strong></li>
<li><strong>通用描述符(Generic Descriptor)匹配器通用接口</strong></li>
<li><strong>关键点绘制函数和匹配功能绘制函数</strong></li>
</ul>
<pre class="code">
<pre class="code">
<pre class="code">
<pre class="code">
<h2></h2>
<p> </p>
<p> </p>
<h2></h2>
<p>【flann】&mdash;&mdash; Fast Library for Approximate Nearest Neighbors,高维的近似近邻快速搜索算法库,包含两个部分:</p>
<pre class="code">
<pre class="code">
<h2></h2>
<p> </p>
<p> </p>
<ul>
<li>快速近似最近邻搜索</li>
<li>聚类</li>
</ul>
<pre class="code">
<pre class="code">
<h2></h2>
<p> </p>
<p> </p>
<p> </p>
<p>【gpu】&mdash;&mdash;运用GPU加速的计算机视觉模块</p>
<p> </p>
<p>【highgui】&mdash;&mdash;也就是high gui,高层GUI图形用户界面,包含媒体的I / O输入输出,视频捕捉、图像和视频的编码解码、图形交互界面的接口等内容</p>
<p> </p>
<p>【legacy】&mdash;&mdash;一些已经废弃的代码库,保留下来作为向下兼容,包含如下相关的内容: </p>
<pre class="code">
<pre class="code">
<ul>
<li><strong>运动分析</strong></li>
<li><strong>期望最大化</strong></li>
<li><strong>直方图</strong></li>
<li><strong>平面细分(C API)</strong></li>
<li><strong>特征检测和描述(Feature Detection and Description)</strong></li>
<li><strong>描述符提取器(Descriptor Extractors)的通用接口</strong></li>
<li><strong>通用描述符(Generic Descriptor Matchers)的常用接口</strong></li>
<li><strong>匹配器</strong></li>
</ul>
<h2></h2>
<p> </p>
<p> </p>
<p>【ml】&mdash;&mdash;Machine Learning,机器学习模块, 基本上是统计模型和分类算法,包含如下内容:</p>
<pre class="code">
<pre class="code">
<p> </p>
<p> </p>
<ul>
<li>统计模型 (Statistical Models)</li>
<li>一般贝叶斯分类器 (Normal Bayes Classifier)</li>
<li>K-近邻 (K-NearestNeighbors)</li>
<li>支持向量机 (Support Vector Machines)</li>
<li>决策树 (Decision Trees)</li>
<li>提升(Boosting)</li>
<li>梯度提高树(Gradient Boosted Trees)</li>
<li>随机树 (Random Trees)</li>
<li>超随机树 (Extremely randomized trees)</li>
<li>期望最大化 (Expectation Maximization)</li>
<li>神经网络 (Neural Networks)</li>
<li>MLData</li>
</ul>
<p>【nonfree】,也就是一些具有专利的算法模块 ,包含特征检测和GPU相关的内容。最好不要商用,可能会被告哦。</p>
<p> </p>
<p>【objdetect】&mdash;&mdash;目标检测模块,包含Cascade Classification(级联分类)和Latent SVM这两个部分。</p>
<p> </p>
<p>【ocl】&mdash;&mdash;即OpenCL-accelerated Computer Vision,运用OpenCL加速的计算机视觉组件模块</p>
<p> </p>
<p>【photo】&mdash;&mdash;也就是Computational Photography,包含图像修复和图像去噪两部分</p>
<p> </p>
<p>【stitching】&mdash;&mdash;images stitching,图像拼接模块,包含如下部分:</p>
<pre class="code">
<pre class="code">
<h2></h2>
<p> </p>
<p> </p>
  • 拼接流水线
  • 特点寻找和匹配图像
  • 估计旋转
  • 自动校准
  • 图片歪斜
  • 接缝估测
  • 曝光补偿
  • 图片混合
<p> </p>
<p>【superres】&mdash;&mdash;SuperResolution,超分辨率技术的相关功能模块</p>
<p> </p>
<p>【ts】&mdash;&mdash;opencv测试相关代码,不用去管他</p>
<p> </p>
<p>【video】&mdash;&mdash;视频分析组件,该模块包括运动估计,背景分离,对象跟踪等视频处理相关内容。</p>
<p> </p>
<p>【Videostab】&mdash;&mdash;Video stabilization,视频稳定相关的组件,官方文档中没有多作介绍,不管它了。</p>
<p> </p>
<p> </p>
<p>看到到这里,相信大家已经对OpenCV的模块架构设计有了一定的认识。</p>
<p>OpenCV其实就是这么多模块作为代码容器组合起来的一个SDK而已,没什么稀奇的,对吧。</p>
<p> </p>
<p>最后配张图,养养眼:</p>
<p><img src="http://img.blog.csdn.net/20140225205530656?watermark/2/text/aHR0cDovL2Jsb2cuY3Nkbi5uZXQvcG9lbV9xaWFubW8=/font/5a6L5L2T/fontsize/400/fill/I0JBQkFCMA==/dissolve/70/gravity/SouthEast" alt="" data-pinit="registered" /></p>
<p> </p>
<p> </p>
<p>好了,OpenCV的组件结构介绍大概就是这些。</p>
<p>下篇文章见 :)</p>

www.bkjia.comtruehttp: //www.bkjia.com/PHPjc/1080763.htmlTechArticle[OpenCV introductory tutorial part 2] Overview of the small mountains: OpenCV 2.4.8 or OpenCV 2.4.9 complete component structure Analysis (reprint), opencv2.4.9 This series of articles is written by zhmxy555 (Mao Xingyun), please note...
Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn