<commit_before>#include "encoder.hpp"

ImageEncoder::ImageEncoder(std::string inputFilename) {
  cv::Mat show_img;
  src_img = cv::imread(inputFilename, cv::IMREAD_GRAYSCALE);

  cv::adaptiveThreshold(src_img, adaptive_img, 255, cv::ADAPTIVE_THRESH_GAUSSIAN_C, cv::THRESH_BINARY, 7, 8);

  cv::resize(adaptive_img, show_img, cv::Size(), 0.6, 0.6);

  cv::imshow("transmit", show_img);
  cv::moveWindow("transmit", 0, 0);
  cv::waitKey(0);
}

std::string ImageEncoder::get_bytes_of_image() {
  std::string dst;
  uchar *p;

  for (int y = 0; y < adaptive_img.rows; y++) {
    p = adaptive_img.ptr<uchar>(y);
    for (int x = 0; x < adaptive_img.cols; x++) {
      dst += (p[x] == 255) ? "1" : "0";
      dst += " ";
    }
  }

  dst.pop_back();  // 最後の空白を除去

  return dst;
}

itpp::bvec ImageEncoder::convert(std::string bytes) {
  return itpp::bvec(bytes);
}


void ImageEncoder::decode(itpp::bvec received) {<commit_msg>Display message to guide<commit_after>#include "encoder.hpp"

ImageEncoder::ImageEncoder(std::string inputFilename) {
  cv::Mat show_img;
  src_img = cv::imread(inputFilename, cv::IMREAD_GRAYSCALE);

  cv::adaptiveThreshold(src_img, adaptive_img, 255, cv::ADAPTIVE_THRESH_GAUSSIAN_C, cv::THRESH_BINARY, 7, 8);

  cv::resize(adaptive_img, show_img, cv::Size(), 0.6, 0.6);

  cv::imshow("transmit", show_img);
  cv::moveWindow("transmit", 0, 0);

  std::cout << "Press enter key on \"transmit\" window." << std::endl;

  cv::waitKey(0);
}

std::string ImageEncoder::get_bytes_of_image() {
  std::string dst;
  uchar *p;

  for (int y = 0; y < adaptive_img.rows; y++) {
    p = adaptive_img.ptr<uchar>(y);
    for (int x = 0; x < adaptive_img.cols; x++) {
      dst += (p[x] == 255) ? "1" : "0";
      dst += " ";
    }
  }

  dst.pop_back();  // 最後の空白を除去

  return dst;
}

itpp::bvec ImageEncoder::convert(std::string bytes) {
  return itpp::bvec(bytes);
}


void ImageEncoder::decode(itpp::bvec received) {
{'fraction_non_alphanumeric': 0.18483904465212878, 'fraction_numerical': 0.01973001038421599, 'mean_word_length': 4.521489971346705, 'pattern_counts': {'":': 0, '<': 13, '<?xml version=': 0, '>': 5, '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': '3479857', 'n_tokens_mistral': 820, 'n_tokens_neox': 761, 'n_words': 145}