template<typename INTER_SUM_T, int ROWS, int COLS, int SRC_T, int DST_ROWS, int DST_COLS, int DST_T>
void hls::Reduce( hls::Mat<ROWS, COLS, SRC_T>& src,
                  hls::Mat<DST_ROWS, DST_COLS, DST_T>& dst,
                  int dim,
                  int reduce_op=HLS_REDUCE_SUM );


  • src – the inputmatrix.
  • dst – the outputvector.
  • dim – dimension index along which the matrix is reduced. 0 means that the matrix isreduced to a single row. 1 means that the matrix is reduced to a single.
  • reduce_op – reduction operation that could be:
    • HLS_REDUCE_SUM The output is the sum of all of the matrix’s rows/columns.
    • HLS_REDUCE_AVG The output is the mean vector of all of the matrix’s rows/columns.
    • HLS_REDUCE_MAX The output is the maximum (column/row-wise) of all of the matrix’s rows/columns.
    • HLS_REDUCE_MIN The output is the minimum (column/row-wise) of all of the matrix’s rows/columns.


Reduces 2D image src along dimension dim to a vector dst.
Image data must be stored in src, the data of dst must be empty before invocations. Invoking this function will consume the data in src, and filling the image data of dst.

OpenCV reference

cvReduce, cv::reduce