矩阵和图象的基本操作
表3-3列出了对矩阵操作的多个例程,它们中大部分也可以很好的对图象进行处理。它们可以做几乎所有常规的事情,例如矩阵的对角化(diagonalizing)和转置(transposing),以及一些复杂的操作,例如计算图象的统计值。原文是按字母顺序排列的,这里本人按函数的用途进行了整理。
表3-3,矩阵和图象的基本操作
函数 | Description | 说明 |
cvAdd | Elementwise addition of two arrays | 两个数组对应元素的和 |
cvAddS | Elementwise addition of an array and a scalar | 一个数组和一个标量对应元素的和 |
cvAddWeighted | Elementwise weighted addition of two arrays (alpha blending) | 两个数组对元素的加权求和(alpha混合) |
cvSub | Elementwise subtraction of one array from another | 把两个数组的对应元素相减 |
cvSubS | Elementwise subtraction of a scalar from an array | 把一个数组的元素减去一个标量 |
cvSubRS | Elementwise subtraction of an array from a scalar | 把一个标量减去一个数组中的元素 |
cvMul | Elementwise multiplication of two arrays | 两个数组对应元素的乘法 |
cvDotProduct | Compute dot product of two vectors | 计算两个向量的点乘 |
cvCrossProduct | Compute cross product of two three-dimensional vectors | 对两个三维向量做叉乘 |
cvGEMM | Generalized matrix multiplication | 广义矩阵的乘法 |
cvDiv | Elementwise division of one array by another | 一个数组和另一个数组对应元素的除法 |
cvAbs | Absolute value of all elements in an array | 数组中所有元素的绝对值 |
cvAbsDiff | Absolute value of diff erences between two arrays | 两个数组差值的绝对值 |
cvAbsDiffS | Absolute value of diff erence between an array and a scalar | 一个数组和一个标量的差值的绝对值 |
cvMin | Elementwise min operation on two arrays | 对两个数组中的对应元素做最小值操作 |
cvMinS | Elementwise min operation between an array and a scalar | 一个数组的元素和一个向量做最小值操作 |
cvMax | Elementwise max operation on two arrays | 对两个数组中的对应元素做最大值操作 |
cvMaxS | Elementwise max operation between an array and a scalar | 一个数组的元素和一个向量做最大值操作 |
cvMinMaxLoc | Find minimum and maximum values in an array | 寻找数组中的最大值和最小值 |
cvAvg | Average value of all elements in an array | 数组中所有元素的平均值 |
cvAvgStd | Absolute value and standard deviation of all elements in an array | 数组中所有元素的平均值和标准差 |
cvSum | Sum all elements of an array | 对数组的所有元素求和 |
cvCountNonZero | Count nonzero elements in an array | 对数组中非零元素计数 |
cvGetRow | Copy elements from row slice of an array | 拷贝数组中一行元素 |
cvGetRows | Copy elements from multiple adjacent rows of an array | 拷贝数组中相邻的多行元素 |
cvGetCol | Copy elements from column slice of an array | 拷贝数组中一列元素 |
cvGetCols | Copy elements from multiple adjacent columns of an array | 拷贝数组中相邻的多列元素 |
cvGetSubRect | Copy elements from subregion of an array | 拷贝一个数组中子区域的元素 |
cvGetDiag | Copy elements from an array diagonal | 拷贝数组对角线元素 |
cvAnd | Elementwise bit-level AND of two arrays | 把两个数组的对应元素做位与操作 |
cvNot | Bitwise inversion of every element of an array | 对数组中每个元素逐位取反 |
cvOr | Elementwise bit-level OR of two arrays | 把两个数组的对应元素做位取反 |
cvOrS | Elementwise bit-level OR of an array and a scalar | 把一个数组中的元素和一个标量取反 |
cvXor | Elementwise bit-level XOR between two arrays | 把两个数组中的对应元素做异或运算 |
cvXorS | Elementwise bit-level XOR between an array and a scalar | 把一个数组中的元素和一个标量做异或运算 |
cvGetDims | Return the number of dimensions of an array | 返回数组的维数 |
cvGetDimSize | Return the sizes of all dimensions of an array | 返回数组所有维的尺寸 |
cvGetSize | Get size of a two-dimensional array and return as CvSize | 获取二维数组的尺寸,返回一个CvSize结构 |
cvCopy | Copy elements of one array to another | 把一个数组中的元素拷贝到另一个数组 |
cvRepeat | Tile the contents of one array into another | 把一个数组的内容铺到另一个中 |
cvSplit | Split a multichannel array into multiple single-channel arrays | 把一个多通道数组分解为多个单通道数组 |
cvMerge | Merge several single-channel images into one multichannel image | 把数个单通道图象合并为一个多通道图象 |
cvCvtColor | Convert channels of an array from one color space to another | 把数组中通道从一个色彩空间转换到另一个色彩空间 |
cvReduce | Reduce a two-dimensional array to a vector by a given operation | 根据一个给定操作,把一个二维数组缩减为一个向量 |
cvConvertScale | Convert array type with optional rescaling of the value | |
cvConvertScaleAbs | Convert array type after absolute value with optional rescaling | |
cvSet | Set all elements of an array to a given value | 把数组中所有元素赋一个给定的值 |
cvSetZero | Set all elements of an array to 0 | 把数组中所有元素赋值为0 |
cvZero | Set all elements of an array to 0 | 把数组中所有元素置0 |
cvFlip | Flip an array about a selected axis | 把数组相对一个选定的轴做翻转 |
cvNormalize | Normalize elements in an array to some value | 把数组中的元素规一化到某一值 |
cvTranspose | Transpose all elements of an array across the diagonal | 把所有元素相对对角线转置 |
cvSetIdentity | Set all elements of an array to 1 for the diagonal and 0 otherwise | 对数组的对角线元素赋1,其它的为0 |
cvCalcCovarMatrix | Compute covariance of a set of n-dimensional vectors | 一组n维向量的协方差 |
cvDet | Compute determinant of a square matrix | 计算一个方阵行列式的值 |
cvEigenVV | Compute eigenvalues and eigenvectors of a square matrix | 计算一个方阵的特征值和特征向量 |
cvInvert | Invert a square matrix | 计算方阵的逆矩阵 |
cvMahalonobis | Compute Mahalonobis distance between two vectors | 计算两个向量的马氏距离( Mahalonobis distance) |
cvNorm | Compute normalized correlations between two arrays | 计算两相数组的规一化系数 |
cvSVD | Compute singular value decomposition of a two-dimensional array | 计算一个二维数组的奇异值分解 |
cvSVBkSb | Compute singular value back-substitution | 计算奇异值回代 |
cvTrace | Compute the trace of an array | 计算数组的迹 |
cvSolve | Solve a system of linear equations | 求解一个线性方程 |
cvInRange | Test if elements of an array are within values of two other arrays | 测试一个数组中的元素的值是否在另两个数组的值之间 |
cvInRangeS | Test if elements of an array are in range between two scalars | 测试一个数组上的元素是否在两个标量之间 |
cvCmp | Apply selected comparison operator to all elements in two arrays | 对两个数组中所有元素进行选中的比较操作 |
cvCmpS | Apply selected comparison operator to an array relative to a scalar | 一个数组和一个标量之间进行选中的比较操作 |