📄 opencvref_cxcore.cn.htm
字号:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3c.org/TR/1999/REC-html401-19991224/loose.dtd"><html><head><title>CXCORE Reference Manual</title><meta http-equiv="Content-Type" content="text/plain; charset=gb2312"><link href="opencvref_cxcore_chinese_files/opencvref.css" type="text/css" charset="ISO-8859-1" rel="STYLESHEET"><meta content="Microsoft FrontPage 4.0" name="GENERATOR"></head><body><h1>CXCORE 参考手册</h1> <hr><p><a href="http://blog.csdn.net/hunnish">HUNNISH</a> 注:</p><p>本翻译是直接根据 OpenCV Beta 4.0 版本的用户手册翻译的,原文件是:<opencv_directory>/doc/ref/opencvref_cxcore.htm, 可以从 SOURCEFORG 上面的 OpenCV 项目下载,也可以直接从 <a href="http://www.assuredigit.com/">阿须数码</a> 中下载:<a href="http://www.assuredigit.com/incoming/sourcecode/opencv/chinese_docs/ref/opencvref_cv.htm">http://www.assuredigit.com/incoming/sourcecode/opencv/chinese_docs/ref/opencvref_cxcore.htm</a>。</p><p>翻译中肯定有不少错误,另外也有些术语和原文语义理解不透导致翻译不准确或者错误,也请有心人赐教。</p><p>翻译由Y.Q.Zhang, J.H.Tan, X.C.Qin, M.Liu 和 Z.T.Fan 鼎力完成,全文由Hunnish做统一修改校正。</p><p>翻译由张兆翔,于示琪进一步校正完成。<p><hr><p></p><ul> <li><a href="#cxcore_basic_structures">基础结构</a> </li><li><a href="#cxcore_arrays">数组操作</a> <ul> <li><a href="#cxcore_arrays_alloc_free">初始化</a> </li><li><a href="#cxcore_arrays_get_set">获取元素和数组子集</a> </li><li><a href="#cxcore_arrays_copying">拷贝和填充</a> </li><li><a href="#cxcore_arrays_permute">变换和置换</a> </li><li><a href="#cxcore_arrays_arithm_logic">算术、逻辑和比较</a> </li><li><a href="#cxcore_arrays_stat">统计</a> </li><li><a href="#cxcore_arrays_matrix">线性代数</a> </li><li><a href="#cxcore_arrays_math">数学函数</a> </li><li><a href="#cxcore_arrays_rng">随机数生成</a> </li><li><a href="#cxcore_arrays_dxt">离散变换</a> </li></ul> </li><li><a href="#cxcore_ds">动态结构</a> <ul> <li><a href="#cxcore_ds_storages">内存存储</a> </li><li><a href="#cxcore_ds_sequences">序列</a> </li><li><a href="#cxcore_ds_sets">集合</a> </li><li><a href="#cxcore_ds_graphs">图</a> </li><li><a href="#cxcore_ds_trees">树</a> -----------------------</li></ul> </li><li><a href="#cxcore_drawing">绘图函数</a> ****************************************<ul> <li><a href="#cxcore_drawing_shapes">曲线和形状</a> </li><li><a href="#cxcore_drawing_text">文本</a> </li><li><a href="#cxcore_drawing_seq">点集和轮廓</a> </li></ul> </li><li><a href="#cxcore_persistence">数据保存和运行时类型信息</a> <ul> <li><a href="#cxcore_persistence_ds">文件存储</a> </li><li><a href="#cxcore_persistence_writing">写数据</a> </li><li><a href="#cxcore_persistence_reading">读数据</a> </li><li><a href="#cxcore_persistence_rtti">运行时类型信息和通用函数</a> ---------------</li></ul> </li><li><a href="#cxcore_misc">其它混合函数</a> *********************************************</li><li><a href="#cxcore_system">错误处理和系统函数</a> <ul> <li><a href="#cxcore_system_error">错误处理</a> </li><li><a href="#cxcore_system_sys">系统函数</a> </li></ul> </li><li><a href="#cxcore_func_index">依字母顺序函数列表</a> </li><li><a href="#cxcore_sample_index">例子列表</a> ---------------------------</li></ul><!-- ***************************************************************************************** ***************************************************************************************** ***************************************************************************************** --><hr><h1><a name="cxcore_basic_structures">基础结构</a></h1><hr><h3><a name="decl_CvPoint">CvPoint</a></h3><p class="Blurb">基于二维整形坐标轴的点</p><pre> typedef struct CvPoint</pre><pre><span style=""> </span>{</pre><pre><span style=""> </span>int x; /* X<span style="font-family: 宋体;">坐标</span>, <span style="font-family: 宋体;">通常以</span>0<span style="font-family: 宋体;">为基点</span> */</pre><pre><span style=""> </span>int y; /* y<span style="font-family: 宋体;">坐标,通常以</span>0<span style="font-family: 宋体;">为基点</span> */</pre><pre><span style=""> </span>}</pre><pre><span style=""> </span>CvPoint;</pre><pre> <span style=""> </span>/* <span style="font-family: 宋体;">构造函数</span> */</pre><pre><span style=""> </span>inline CvPoint cvPoint( int x, int y );</pre><pre><span style=""> </span>/* <span style="font-family: 宋体;">从</span> CvPoint2D32f<span style="font-family: 宋体;">类型转换得来</span> */</pre><pre><span style=""> </span>inline CvPoint cvPointFrom32f( CvPoint2D32f point );</pre><hr><h3><a name="decl_CvPoint2D32f">CvPoint2D32f</a></h3><p class="Blurb">二维浮点坐标上的点</p><pre>typedef struct CvPoint2D32f</pre><pre><span style=""> </span>{</pre><pre><span style=""> </span>float x; /* X<span style="font-family: 宋体;">坐标</span>, <span style="font-family: 宋体;">通常以</span>0<span style="font-family: 宋体;">为基点</span>*/</pre><pre><span style=""> </span>float y; /* Y<span style="font-family: 宋体;">坐标</span>, <span style="font-family: 宋体;">通常以</span>0<span style="font-family: 宋体;">为基点</span>*/</pre><pre><span style=""> </span>}</pre><pre><span style=""> </span>CvPoint2D32f;</pre><pre> <span style=""> </span>/* <span style="font-family: 宋体;">构造函数</span> */</pre><pre><span style=""> </span>inline CvPoint2D32f cvPoint2D32f( double x, double y );</pre><pre><span style=""> </span>/* <span style="font-family: 宋体;">从</span>CvPoint<span style="font-family: 宋体;">转换来</span> */</pre><pre><span style=""> </span>inline CvPoint2D32f cvPointTo32f( CvPoint point );</pre><hr><h3><a name="decl_CvPoint3D32f">CvPoint3D32f</a></h3><p class="Blurb">三维浮点坐标上的点</p><pre> typedef struct CvPoint3D32f { float x; /* x-坐标,通常基于0 */ float y; /* y-坐标, 通常基于0*/ float z; /* z-坐标,通常基于0 */ } CvPoint3D32f; /* 构造函数 */ inline CvPoint3D32f cvPoint3D32f( double x, double y, double z );</pre><hr><hr><h3><a name="decl_CvPoint2D64f">CvPoint2D64f</a></h3><p class="Blurb">2D point with double precision floating-point coordinates</p><pre> typedef struct CvPoint2D64f { double x; /* x-坐标,通常基于0 */ double y; /* y-坐标,通常基于0 */ } CvPoint2D64f; /* 构造函数 */ inline CvPoint2D64f cvPoint2D64f( double x, double y ); /* 从 CvPoint转换得来 */ inline CvPoint2D64f cvPointTo64f( CvPoint point );</pre><hr><h3><a name="decl_CvPoint3D64f">CvPoint3D64f</a></h3><p class="Blurb">3D point with double precision floating-point coordinates</p><pre> typedef struct CvPoint3D64f { double x; /* x-坐标,通常基于0 */ double y; /* y-坐标,通常基于0 */ double z; /* z-坐标,通常基于0 */ } CvPoint3D64f; /* 构造函数 */ inline CvPoint3D64f cvPoint3D64f( double x, double y, double z );</pre><hr><h3><a name="decl_CvSize">CvSize</a></h3><p class="Blurb">矩形框大小,以像素为精度</p><pre> typedef struct CvSize { int width; /* 矩形宽 */ int height; /* 矩形高 */ } CvSize; /* 构造函数 */ inline CvSize cvSize( int width, int height );</pre><hr><h3><a name="decl_CvSize2D32f">CvSize2D32f</a></h3><p class="Blurb">以低像素精度标量矩形框大小</p><pre> typedef struct CvSize2D32f { float width; /* 矩形宽 */ float height; /* 矩形高 */ } CvSize2D32f; /* 构造函数*/ inline CvSize2D32f cvSize2D32f( double width, double height );</pre><hr><h3><a name="decl_CvRect">CvRect</a></h3><p class="Blurb">矩形框的偏移和大小</p><pre> typedef struct CvRect { int x; /* <span style="font-family: 宋体;">方形的最左角的</span>x-<span style="font-family: 宋体;">坐标</span><span style=""> </span>*/</pre><pre> int y; /* <span style="font-family: 宋体;">方形的最上或者最下角的</span>y-<span style="font-family: 宋体;">坐标</span> */</pre><pre> int width; /* 宽 */ int height; /* 高 */ } CvRect; /* 构造函数*/ inline CvRect cvRect( int x, int y, int width, int height );</pre><hr><h3><a name="decl_CvScalar">CvScalar</a></h3><p class="Blurb">可存放在1-,2-,3-,4-TUPLE类型的捆绑数据的容器</p><pre> typedef struct CvScalar { double val[4] } CvScalar; <span style="font-size: 12pt; font-family: 'Times New Roman';" lang="EN-US">/* </span><span style="font-size: 12pt; font-family: 宋体;">构造函数:用</span><span style="font-size: 12pt; font-family: 'Times New Roman';" lang="EN-US">val0</span><span style="font-size: 12pt; font-family: 宋体;">初始化</span><span style="font-size: 12pt; font-family: 'Times New Roman';" lang="EN-US">val[0]</span><span style="font-size: 12pt; font-family: 宋体;">用</span><span style="font-size: 12pt; font-family: 'Times New Roman';" lang="EN-US">val1</span><span style="font-size: 12pt; font-family: 宋体;">初始化</span><span style="font-size: 12pt; font-family: 'Times New Roman';" lang="EN-US">val[1]</span><span style="font-size: 12pt; font-family: 宋体;">等等</span><span style="font-size: 12pt; font-family: 'Times New Roman';" lang="EN-US">*/</span> inline CvScalar cvScalar( double val0, double val1=0, double val2=0, double val3=0 ); <span style="font-size: 12pt; font-family: 'Times New Roman';" lang="EN-US">/* </span><span style="font-size: 12pt; font-family: 宋体;">构造函数:用</span><span style="font-size: 12pt; font-family: 'Times New Roman';" lang="EN-US">val0123</span><span style="font-size: 12pt; font-family: 宋体;">初始化</span><span style="font-size: 12pt; font-family: 'Times New Roman';" lang="EN-US">val0123 */</span> inline CvScalar cvScalarAll( double val0123 ); <span style="font-size: 12pt; font-family: 'Times New Roman';" lang="EN-US">/* </span><span style="font-size: 12pt; font-family: 宋体;">构造函数:用</span><span style="font-size: 12pt; font-family: 'Times New Roman';" lang="EN-US">val0</span><span style="font-size: 12pt; font-family: 宋体;">初始化</span><span style="font-size: 12pt; font-family: 'Times New Roman';" lang="EN-US">val[0],val[1]…val[3]</span><span style="font-size: 12pt; font-family: 宋体;">用</span><span style="font-size: 12pt; font-family: 'Times New Roman';" lang="EN-US">0</span><span style="font-size: 12pt; font-family: 宋体;">初始化</span><span style="font-size: 12pt; font-family: 'Times New Roman';" lang="EN-US"> */</span> inline CvScalar cvRealScalar( double val0 );</pre><hr><h3><a name="decl_CvTermCriteria">CvTermCriteria</a></h3><p class="Blurb">迭代算法的终止标准</p><pre>#define CV_TERMCRIT_ITER 1#define CV_TERMCRIT_NUMBER CV_TERMCRIT_ITER#define CV_TERMCRIT_EPS 2typedef struct CvTermCriteria{ int type; /* CV_TERMCRIT_ITER 和 CV_TERMCRIT_EPS的联合 */ int max_iter; /* 迭代的最大数 */ double epsilon; /* 结果的精确性 */}CvTermCriteria;/* 构造函数 */inline CvTermCriteria cvTermCriteria( int type, int max_iter, double epsilon );/* 检查终止标准并且转换使type=CV_TERMCRIT_ITER+CV_TERMCRIT_EPS,并且满足max_iter 和 epsilon 限制条件 */CvTermCriteria cvCheckTermCriteria( CvTermCriteria criteria, double default_eps, int default_max_iters );</pre><!-- ***************************************************************************************** ***************************************************************************************** ***************************************************************************************** --><!-- <hr><h2><a name="ch1_array_structs">Array structures</a></h2> --><hr><h3><a name="decl_CvMat">CvMat</a></h3><p class="Blurb">多通道矩阵</p><pre> typedef struct CvMat { int type; /* CvMat 标识 (CV_MAT_MAGIC_VAL), 元素类型和标记 */ int step; /* 以字节为单位的行数据长度*/ int* refcount; /* 数据参考计数 */ union { uchar* ptr; short* s; int* i; float* fl; double* db; } data; /* data 指针 */ #ifdef __cplusplus union { int rows; int height; }; union { int cols; int width; }; #else int rows; /* 行数 */ int cols; /* 列数*/ #endif } CvMat;</pre><hr><h3><a name="decl_CvMatND">CvMatND</a></h3><p class="Blurb">多维、多通道密集数组</p><pre> typedef struct CvMatND { int type; /* CvMatND 标识(CV_MATND_MAGIC_VAL), 元素类型和标号*/ int dims; /* 数组维数 */ int* refcount; /* 数据参考计数 */ union { uchar* ptr; short* s; int* i; float* fl; double* db; } data; /* data 指针*/ /* 每维的数据结构 (元素号,以字节为单位的元素之间的距离)是配套定义的 */ struct { int size; int step; } dim[CV_MAX_DIM]; } CvMatND;</pre><hr><h3><a name="decl_CvSparseMat">CvSparseMat</a></h3><p class="Blurb">多维、多通道稀疏数组</p><pre> typedef struct CvSparseMat { int type; /* CvSparseMat 标识 (CV_SPARSE_MAT_MAGIC_VAL), 元素类型和标号 */
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -