<commit_before>/*
 * MatHelper.cpp
 *
 *  Created on: Aug 24, 2013
 *      Author: zhonghua
 */

#include "MatHelper.h"

Mat MatHelper::resize(const Mat& org, int long_edge){

	double aspect = (double)org.cols/org.rows;

	int width, height;

	if(aspect >= 1){
		width = long_edge;
		height = width / aspect;
	}else {
		height = long_edge;
		width = height*aspect;
	}

	Mat out;
	cv::resize(org, out, Size(width, height), 0, 0, cv::INTER_AREA);

	return out;
}
<commit_msg>improve resize function when enlarge a image<commit_after>/*
 * MatHelper.cpp
 *
 *  Created on: Aug 24, 2013
 *      Author: zhonghua
 */

#include "MatHelper.h"

Mat MatHelper::resize(const Mat& org, int long_edge){

	double aspect = (double)org.cols/org.rows;

	int width, height;

	if(aspect >= 1){
		width = long_edge;
		height = width / aspect;
	}else {
		height = long_edge;
		width = height*aspect;
	}

	bool enarge = width > org.cols;

	Mat out;
	cv::resize(org, out, Size(width, height), 0, 0, (enarge ? cv::INTER_CUBIC : cv::INTER_AREA));

	return out;
}

{'fraction_non_alphanumeric': 0.1464354527938343, 'fraction_numerical': 0.017341040462427744, 'mean_word_length': 3.5973451327433628, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 6, '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': '6509005', 'n_tokens_mistral': 432, 'n_tokens_neox': 390, 'n_words': 104}