<commit_before>
#include "tp2/common.hpp"

using namespace tp2;

// decoup: reformats a 2D image (i.e. always single channel) to a block array
std::vector<cv::Mat_<uchar>> tp2::decoup(const cv::Mat_<uchar>& oImage) {
	constexpr size_t nBlockSize = tp2::s_nBlockSize;
	CV_Assert(!oImage.empty() && (oImage.rows % nBlockSize) == 0 &&
	          (oImage.cols % nBlockSize) == 0 && oImage.isContinuous());
	std::vector<cv::Mat_<uchar>> vOutput;

	// @@@@ TODO (fill vOutput)

	return vOutput;
}<commit_msg>Ajout de la classe decoup<commit_after>
#include "tp2/common.hpp"

using namespace tp2;

// decoup: reformats a 2D image (i.e. always single channel) to a block array
std::vector<cv::Mat_<uchar>> tp2::decoup(const cv::Mat_<uchar>& oImage) {
	constexpr size_t nBlockSize = tp2::s_nBlockSize;
	CV_Assert(!oImage.empty() && (oImage.rows % nBlockSize) == 0 &&
	          (oImage.cols % nBlockSize) == 0 && oImage.isContinuous());
	std::vector<cv::Mat_<uchar>> vOutput;

	// @@@@ TODO (fill vOutput)

	for(int i = 0; i < oImage.cols; i+=8)
	{
		cv::Mat_<uchar> block8x8;
		for(int j = 0; j < oImage.rows; j+=8)
		{

			for(int iBlock = 0; i < nBlockSize; iBlock++)
			{
				for(int jBlock = 0; j < nBlockSize; jBlock++)
				{
					if( (i+iBlock < oImage.cols) && (j+jBlock < oImage.rows) )
					{
						block8x8.at<cv::Vec3b>(i,j) = oImage.at<cv::Vec3b>(i+iBlock,j+jBlock);
					}
				}
			}
		}
		vOutput.push_back(block8x8);
	}

	return vOutput;
}
{'fraction_non_alphanumeric': 0.177731673582296, 'fraction_numerical': 0.019363762102351315, 'mean_word_length': 3.8557046979865772, 'pattern_counts': {'":': 0, '<': 22, '<?xml version=': 0, '>': 16, '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': '5173066', 'n_tokens_mistral': 636, 'n_tokens_neox': 586, 'n_words': 122}