int main (int argc, char **argv) { char write_folder_c[1024]; std::string write_folder_prefix = "sequence"; time_t now = time(0); struct tm tstruct; tstruct = *localtime(&now); int year = 1900 + tstruct.tm_year; int month = tstruct.tm_mon; int day = tstruct.tm_mday; int hour = tstruct.tm_hour; int min = tstruct.tm_min; int sec = tstruct.tm_sec; if (argc > 1) write_folder_prefix = argv[1]; else printf("Usage: openni_grabber_save_images my_write_folder_prefix snapshot_mode_flag{0,1}"); sprintf(write_folder_c, "%s_%02d_%02d_%04d__%02dh_%02dm_%02ds",write_folder_prefix.c_str(),day,month,year,hour,min,sec); std::string write_folder(write_folder_c); mkdir(write_folder_c,0777); mkdir((write_folder + "/Depth").c_str(),0777); mkdir((write_folder + "/RGB").c_str(),0777); mkdir((write_folder + "/IR").c_str(),0777); OpenNIShoter v (write_folder); v.run (argc,argv); return (0); }
void gtsrb_toolset::prepare_training_data() { { boost::filesystem::path file_path = get_working_data_folder() / training_data_filename; std::cout << "Writing data to " << file_path.string() << std::endl; std::tr1::shared_ptr<std::ofstream> file_with_data(new boost::filesystem::ofstream(file_path, std::ios_base::out | std::ios_base::binary | std::ios_base::trunc)); nnforge::layer_configuration_specific input_configuration; input_configuration.feature_map_count = is_color ? 3 : 1; input_configuration.dimension_sizes.push_back(image_width); input_configuration.dimension_sizes.push_back(image_height); nnforge::layer_configuration_specific output_configuration; output_configuration.feature_map_count = class_count; output_configuration.dimension_sizes.push_back(1); output_configuration.dimension_sizes.push_back(1); nnforge::supervised_data_stream_writer writer( file_with_data, input_configuration, output_configuration); for(unsigned int folder_id = 0; folder_id < class_count; ++folder_id) { boost::filesystem::path subfolder_name = boost::filesystem::path("Final_Training") / "Images" / (boost::format("%|1$05d|") % folder_id).str(); std::string annotation_file_name = (boost::format("GT-%|1$05d|.csv") % folder_id).str(); write_folder( writer, subfolder_name, annotation_file_name.c_str(), true); } } { boost::filesystem::path file_path = get_working_data_folder() / validating_data_filename; std::cout << "Writing data to " << file_path.string() << std::endl; std::tr1::shared_ptr<std::ofstream> file_with_data(new boost::filesystem::ofstream(file_path, std::ios_base::out | std::ios_base::binary | std::ios_base::trunc)); nnforge::layer_configuration_specific input_configuration; input_configuration.feature_map_count = is_color ? 3 : 1; input_configuration.dimension_sizes.push_back(image_width); input_configuration.dimension_sizes.push_back(image_height); nnforge::layer_configuration_specific output_configuration; output_configuration.feature_map_count = class_count; output_configuration.dimension_sizes.push_back(1); output_configuration.dimension_sizes.push_back(1); nnforge::supervised_data_stream_writer writer( file_with_data, input_configuration, output_configuration); boost::filesystem::path subfolder_name = boost::filesystem::path("Final_Test") / "Images"; std::string annotation_file_name = "GT-final_test.csv"; write_folder( writer, subfolder_name, annotation_file_name.c_str(), false); } }