<commit_before>/*M///////////////////////////////////////////////////////////////////////////////////////
//
// Copyright (c) 2015, <NAME>
// Copyright (c) 2015, ELM Library Project
// 3-clause BSD License
//
//M*/
/** Non-template utility definitions
 * For template inline definitions see *_inl*
  */
#ifndef _ELM_CORE_CV_MAT_UTILS_H_
#define _ELM_CORE_CV_MAT_UTILS_H_

#include "elm/core/typedefs_fwd.h"

namespace elm {

/**
 * @brief Converts matrix to 8U and scales elements
 * so that min=0 and max=255.
 * If all input elements are identical, yield matrix of zeros
 *
 * Useful for preparing matrix to use with highgui's cv::imshow()
 *
 * @param src
 * @return Mat_<uchar>
 */
cv::Mat_<unsigned char> ConvertTo8U(const cv::Mat &src);

/**
 * @brief Cumulative sum
 * @param src matrix
 * @param dst matrix
 */
void CumSum(const cv::Mat1f &src, cv::Mat1f &dst);

/**<commit_msg>add not on all-zeros input for CumSum()<commit_after>/*M///////////////////////////////////////////////////////////////////////////////////////
//
// Copyright (c) 2015, <NAME>
// Copyright (c) 2015, ELM Library Project
// 3-clause BSD License
//
//M*/
/** Non-template utility definitions
 * For template inline definitions see *_inl*
  */
#ifndef _ELM_CORE_CV_MAT_UTILS_H_
#define _ELM_CORE_CV_MAT_UTILS_H_

#include "elm/core/typedefs_fwd.h"

namespace elm {

/**
 * @brief Converts matrix to 8U and scales elements
 * so that min=0 and max=255.
 * If all input elements are identical, yield matrix of zeros
 *
 * Useful for preparing matrix to use with highgui's cv::imshow()
 *
 * @param src
 * @return Mat_<uchar>
 */
cv::Mat_<unsigned char> ConvertTo8U(const cv::Mat &src);

/**
 * @brief Cumulative sum
 *
 * Input of zeros yields cumulative sum of zeros
 *
 * @param src matrix
 * @param dst matrix
 */
void CumSum(const cv::Mat1f &src, cv::Mat1f &dst);

/**
{'fraction_non_alphanumeric': 0.21262817053426875, 'fraction_numerical': 0.01834862385321101, 'mean_word_length': 2.5930232558139537, 'pattern_counts': {'":': 0, '<': 9, '<?xml version=': 0, '>': 9, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6589772', 'n_tokens_mistral': 630, 'n_tokens_neox': 587, 'n_words': 190}