diff --git a/CMakeLists.txt b/CMakeLists.txt index f9f0c4f..127361d 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,5 +1,5 @@ cmake_minimum_required(VERSION 3.25) -project(image-gp-6 VERSION 0.0.23) +project(image-gp-6 VERSION 0.0.24) include(FetchContent) diff --git a/include/image_operations.h b/include/image_operations.h index 936ea96..6bd8cca 100644 --- a/include/image_operations.h +++ b/include/image_operations.h @@ -46,7 +46,7 @@ inline blt::gp::operation_t op_atan(make_single((float (*)(float)) &std::atan), inline blt::gp::operation_t op_exp(make_single((float (*)(float)) &std::exp), "exp"); inline blt::gp::operation_t op_abs(make_single((float (*)(float)) &std::abs), "abs"); inline blt::gp::operation_t op_log(make_single((float (*)(float)) &std::log), "log"); -inline blt::gp::operation_t op_round(make_single((float (*)(float)) &std::round), "round"); +inline blt::gp::operation_t op_round(make_single([](float f) {return std::round(f * 255.0f) / 255.0f;}), "round"); inline blt::gp::operation_t op_v_mod([](const full_image_t& a, const full_image_t& b) { full_image_t img{}; for (blt::size_t i = 0; i < DATA_CHANNELS_SIZE; i++) @@ -124,39 +124,6 @@ inline blt::gp::operation_t band_pass([](const full_image_t& a, float fa, float cv::sepFilter2D(src, dst, 3, func, funcY); return img; -// if (hp % 2 == 0) -// hp++; -// if (lp % 2 == 0) -// lp++; -// -// auto min = lp < hp ? lp : hp; -// auto max = lp > hp ? lp : hp; -// -// full_image_t hp_blur{}; -// full_image_t lp_blur{}; -// full_image_t base{}; -// full_image_t ret{}; -// std::memcpy(hp_blur.rgb_data, a.rgb_data, DATA_CHANNELS_SIZE * sizeof(float)); -// std::memcpy(lp_blur.rgb_data, a.rgb_data, DATA_CHANNELS_SIZE * sizeof(float)); -// std::memcpy(base.rgb_data, a.rgb_data, DATA_CHANNELS_SIZE * sizeof(float)); -// -// cv::Mat hp_blur_mat{IMAGE_SIZE, IMAGE_SIZE, CV_32FC3, hp_blur.rgb_data}; -// cv::Mat lp_blur_mat{IMAGE_SIZE, IMAGE_SIZE, CV_32FC3, lp_blur.rgb_data}; -// cv::Mat base_mat{IMAGE_SIZE, IMAGE_SIZE, CV_32FC3, base.rgb_data}; -// cv::Mat ret_mat{IMAGE_SIZE, IMAGE_SIZE, CV_32FC3, ret.rgb_data}; -// -// for (blt::u64 i = 1; i < min; i += 2) -// cv::GaussianBlur(hp_blur_mat, hp_blur_mat, cv::Size(static_cast(i), static_cast(i)), 0, 0); -// for (blt::u64 i = 1; i < max; i += 2) -// cv::GaussianBlur(lp_blur_mat, lp_blur_mat, cv::Size(static_cast(i), static_cast(i)), 0, 0); -// -// const static cv::Mat half{IMAGE_SIZE, IMAGE_SIZE, CV_32FC3, 0.5f}; -// cv::subtract(base_mat, lp_blur_mat, ret_mat); -// cv::add(ret_mat, half, ret_mat); -// cv::subtract(ret_mat, hp_blur_mat, base_mat); -// cv::add(base_mat, half, ret_mat); -// -// return ret; }, "band_pass"); inline blt::gp::operation_t high_pass([](const full_image_t& a, blt::u64 size) { @@ -414,7 +381,7 @@ void create_image_operations(blt::gp::operator_builder& builder) builder.add_operator(op_exp); builder.add_operator(op_log); builder.add_operator(op_abs); - //builder.add_operator(op_round); + builder.add_operator(op_round); builder.add_operator(op_v_mod); builder.add_operator(bitwise_and); builder.add_operator(bitwise_or); diff --git a/lib/blt-gp b/lib/blt-gp index 407273d..64e8d71 160000 --- a/lib/blt-gp +++ b/lib/blt-gp @@ -1 +1 @@ -Subproject commit 407273d0dcd86cb3f2030ca9b470cfa78958f23d +Subproject commit 64e8d71468c632d17e01750083f1e5ebd5236910 diff --git a/src/main.cpp b/src/main.cpp index a868079..23cf79f 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -358,6 +358,9 @@ void update(const blt::gfx::window_data& data) { run_generation = true; } + ImGui::Button("Reset Program"); + if (ImGui::IsItemClicked()) + program.reset_program(type_system.get_type().id(), true); ImGui::InputInt("Time Between Runs", &time_between_runs, 16); ImGui::Checkbox("Run", &is_running); auto& stats = program.get_population_stats(); diff --git a/transgengar.png b/transgengar.png new file mode 100644 index 0000000..3232c85 Binary files /dev/null and b/transgengar.png differ