Пример #1
0
//-----------------------------------------------------------------------------
int main(int argc, char *argv[]) {

  if (argc != 11) {
    show_help(argv[0]);
    return 0;
  }

  std::string filename = argv[1];

  main_params mp;
  mp.m_enable_cropper = true;
  // to test resizer manually swap m_enalbe_cropper/resizer
  mp.m_enable_resizer = false;
  mp.m_enable_augmenter = static_cast<bool>(atoi(argv[8]));
  mp.m_enable_colorizer = true;
  mp.m_enable_decolorizer = false;
  mp.m_enable_normalizer = static_cast<main_params::normalizer_type>(atoi(argv[9]));
  if (mp.is_pixel_wise_normalizer()) mp.m_mean_image_name = "mean.png";
  mp.m_mean_batch_size = atoi(argv[7]);
  mp.m_enable_mean_extractor = (mp.m_mean_batch_size > 0);
  mp.m_num_iter = atoi(argv[10]);

  cropper_params rp;
  if (mp.m_enable_cropper) {
    rp.m_is_set = true;
    rp.m_crop_sz.first = atoi(argv[2]);
    rp.m_crop_sz.second = atoi(argv[3]);
    rp.m_rand_center = static_cast<bool>(atoi(argv[4]));
    rp.m_roi_sz.first = atoi(argv[5]);
    rp.m_roi_sz.second = atoi(argv[6]);
    //rp.m_adaptive_interpolation = true;
  }

  resizer_params sp;
  if (mp.m_enable_resizer) {
    sp.m_is_set = true;
    sp.m_width = static_cast<unsigned int>(atoi(argv[2]));
    sp.m_height = static_cast<unsigned int>(atoi(argv[3]));
    //sp.m_adaptive_interpolation = true;
  }

  augmenter_params ap;
  if (mp.m_enable_augmenter) {
    ap.m_is_set = true;
    ap.m_rot = 0.1;
    ap.m_shear = 0.2;
    ap.m_vflip = true;
  }

  // read write test with converting to/from a serialized buffer
  bool ok = test_image_io(filename, mp, rp, sp, ap);
  if (!ok) {
    std::cout << "Test failed" << std::endl;
    return 0;
  }
  std::cout << "Complete!" << std::endl;

  return 0;
}
Пример #2
0
void unit_test(void)
{
    test_constants_and_sizes();
    test_rectangle();
    test_image();
    test_gray();
    test_streams();
    test_image_io();
    test_gray_io();
}
Пример #3
0
int main(int argc, char* argv[]) {
    test_pixel();
    test_channel();
    test_pixel_iterator();
    test_image_io();

    const char* local_name = "gil_reference_checksums.txt";
    const char* name_from_status = "../libs/gil/test/gil_reference_checksums.txt";

    std::ifstream file_is_there(local_name);
    if (file_is_there) {
        test_image(local_name);
    } else {
        std::ifstream file_is_there(name_from_status);
        if (file_is_there)
            test_image(name_from_status);
        else {
            std::cerr << "Unable to open gil_reference_checksums.txt"<<std::endl;
            return 1;
        }
    }

    return 0;
}