/** @brief Reduces a matrix to a vector.
The function reduce reduces the matrix to a vector by treating the matrix rows/columns as a set of
1D vectors and performing the specified operation on the vectors until a single row/column is
obtained. For example, the function can be used to compute horizontal and vertical projections of a
raster image. In case of REDUCE_SUM and REDUCE_AVG , the output may have a larger element
bit-depth to preserve accuracy. And multi-channel arrays are also supported in these two reduction
modes.
@param src input 2D matrix.
@param dst output vector. Its size and type is defined by dim and dtype parameters.
@param dim dimension index along which the matrix is reduced. 0 means that the matrix is reduced to
a single row. 1 means that the matrix is reduced to a single column.
@param rtype reduction operation that could be one of cv::ReduceTypes
@param dtype when negative, the output vector will have the same type as the input matrix,
otherwise, its type will be CV_MAKE_TYPE(CV_MAT_DEPTH(dtype), src.channels()).
@sa repeat
*/
CV_EXPORTS_W void reduce(InputArray src, OutputArray dst, int dim, int rtype, int dtype = -1);
前两个参数没什么好说的,dim,等于0时,把矩阵变为只有一行的,等于1时,把矩阵变成只有一列的,rtype这里可选参
数,若为CV_REDUCE_SUM,则是求和,还有其他参数在cv:ReduceTypes里可选。最后一个参数为输出矩阵的参数类型,默
认为-1时,输出与输入一致,但是有的时候比如几个数相加超过原始格式的范围,会溢出,此时必须指定输出格式。