mirror of
https://github.com/opencv/opencv.git
synced 2026-07-30 15:53:03 +04:00
Merge pull request #13879 from chacha21:REDUCE_SUM2
add REDUCE_SUM2 #13879 proposal to add REDUCE_SUM2 to cv::reduce, an operation that sums up the square of elements
This commit is contained in:
@@ -230,7 +230,8 @@ enum KmeansFlags {
|
||||
enum ReduceTypes { REDUCE_SUM = 0, //!< the output is the sum of all rows/columns of the matrix.
|
||||
REDUCE_AVG = 1, //!< the output is the mean vector of all rows/columns of the matrix.
|
||||
REDUCE_MAX = 2, //!< the output is the maximum (column/row-wise) of all rows/columns of the matrix.
|
||||
REDUCE_MIN = 3 //!< the output is the minimum (column/row-wise) of all rows/columns of the matrix.
|
||||
REDUCE_MIN = 3, //!< the output is the minimum (column/row-wise) of all rows/columns of the matrix.
|
||||
REDUCE_SUM2 = 4 //!< the output is the sum of all squared rows/columns of the matrix.
|
||||
};
|
||||
|
||||
//! @} core_array
|
||||
@@ -903,7 +904,7 @@ The function #reduce reduces the matrix to a vector by treating the matrix rows/
|
||||
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_MAX and #REDUCE_MIN , the output image should have the same type as the source one.
|
||||
In case of #REDUCE_SUM and #REDUCE_AVG , the output may have a larger element bit-depth to preserve accuracy.
|
||||
In case of #REDUCE_SUM, #REDUCE_SUM2 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.
|
||||
|
||||
The following code demonstrates its usage for a single channel matrix.
|
||||
|
||||
Reference in New Issue
Block a user