Compare commits

..

No commits in common. "109af854ef941461bac7a282d5e0dc1dd86e4b46" and "b5f3748dc3381db14ac3cd2c183981052d86200c" have entirely different histories.

5 changed files with 11 additions and 19 deletions

View File

@ -1,5 +1,5 @@
cmake_minimum_required(VERSION 3.25) cmake_minimum_required(VERSION 3.25)
project(image-gp-6 VERSION 0.0.24) project(image-gp-6 VERSION 0.0.22)
include(FetchContent) include(FetchContent)

View File

@ -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_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_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_log(make_single((float (*)(float)) &std::log), "log");
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_round(make_single((float (*)(float)) &std::round), "round");
inline blt::gp::operation_t op_v_mod([](const full_image_t& a, const full_image_t& b) { inline blt::gp::operation_t op_v_mod([](const full_image_t& a, const full_image_t& b) {
full_image_t img{}; full_image_t img{};
for (blt::size_t i = 0; i < DATA_CHANNELS_SIZE; i++) for (blt::size_t i = 0; i < DATA_CHANNELS_SIZE; i++)
@ -102,22 +102,21 @@ inline blt::gp::operation_t dissolve([](const full_image_t& a, const full_image_
return img; return img;
}, "dissolve"); }, "dissolve");
//inline blt::gp::operation_t band_pass([](const full_image_t& a, blt::u64 lp, blt::u64 hp) {
inline blt::gp::operation_t band_pass([](const full_image_t& a, float fa, float fb, blt::u64 size) { inline blt::gp::operation_t band_pass([](const full_image_t& a, float fa, float fb, blt::u64 size) {
cv::Mat src(IMAGE_SIZE, IMAGE_SIZE, CV_32FC3, const_cast<float*>(a.rgb_data)); cv::Mat src(IMAGE_SIZE, IMAGE_SIZE, CV_32FC3, const_cast<float*>(a.rgb_data));
full_image_t img{}; full_image_t img{};
std::memcpy(img.rgb_data, a.rgb_data, DATA_CHANNELS_SIZE * sizeof(float)); std::memcpy(img.rgb_data, a.rgb_data, DATA_CHANNELS_SIZE * sizeof(float));
cv::Mat dst{IMAGE_SIZE, IMAGE_SIZE, CV_32FC3, img.rgb_data}; cv::Mat dst{IMAGE_SIZE, IMAGE_SIZE, CV_32FC3, img.rgb_data};
if (size % 2 == 0) if (size % 2 == 0)
size++; size++;
auto min = fa < fb ? fa : fb; auto min = fa < fb ? fa : fb;
auto max = fa > fb ? fa : fb; auto max = fa > fb ? fa : fb;
auto low = cv::getGaussianKernel(static_cast<int>(size), min * ((static_cast<int>(size) - 1) * 0.5 - 1) + 0.8, CV_32F); auto low = cv::getGaussianKernel(static_cast<int>(size), min * ((static_cast<int>(size) - 1) * 0.5 - 1) + 0.8, CV_32F);
auto high = cv::getGaussianKernel(static_cast<int>(size), max * ((static_cast<int>(size) - 1) * 0.5 - 1) + 0.8, CV_32F); auto high = cv::getGaussianKernel(static_cast<int>(size), max * ((static_cast<int>(size) - 1) * 0.5 - 1) + 0.8, CV_32F);
auto func = high - low; auto func = high - low;
cv::Mat funcY; cv::Mat funcY;
cv::transpose(func, funcY); cv::transpose(func, funcY);
@ -128,11 +127,10 @@ inline blt::gp::operation_t band_pass([](const full_image_t& a, float fa, float
inline blt::gp::operation_t high_pass([](const full_image_t& a, blt::u64 size) { inline blt::gp::operation_t high_pass([](const full_image_t& a, blt::u64 size) {
full_image_t blur{}; full_image_t blur{};
full_image_t base{};
full_image_t ret{};
std::memcpy(blur.rgb_data, a.rgb_data, DATA_CHANNELS_SIZE * sizeof(float)); std::memcpy(blur.rgb_data, a.rgb_data, DATA_CHANNELS_SIZE * sizeof(float));
std::memcpy(base.rgb_data, a.rgb_data, DATA_CHANNELS_SIZE * sizeof(float)); full_image_t base{};
std::memcpy(blur.rgb_data, a.rgb_data, DATA_CHANNELS_SIZE * sizeof(float));
full_image_t ret{};
cv::Mat blur_mat{IMAGE_SIZE, IMAGE_SIZE, CV_32FC3, blur.rgb_data}; cv::Mat blur_mat{IMAGE_SIZE, IMAGE_SIZE, CV_32FC3, blur.rgb_data};
cv::Mat base_mat{IMAGE_SIZE, IMAGE_SIZE, CV_32FC3, base.rgb_data}; cv::Mat base_mat{IMAGE_SIZE, IMAGE_SIZE, CV_32FC3, base.rgb_data};
@ -143,10 +141,7 @@ inline blt::gp::operation_t high_pass([](const full_image_t& a, blt::u64 size) {
for (blt::u64 i = 1; i < size; i += 2) for (blt::u64 i = 1; i < size; i += 2)
cv::GaussianBlur(blur_mat, blur_mat, cv::Size(static_cast<int>(i), static_cast<int>(i)), 0, 0); cv::GaussianBlur(blur_mat, blur_mat, cv::Size(static_cast<int>(i), static_cast<int>(i)), 0, 0);
const static cv::Mat half{IMAGE_SIZE, IMAGE_SIZE, CV_32FC3, 0.5f};
cv::subtract(base_mat, blur_mat, ret_mat); cv::subtract(base_mat, blur_mat, ret_mat);
cv::add(ret_mat, half, ret_mat);
return ret; return ret;
}, "high_pass"); }, "high_pass");
@ -381,7 +376,7 @@ void create_image_operations(blt::gp::operator_builder<context>& builder)
builder.add_operator(op_exp); builder.add_operator(op_exp);
builder.add_operator(op_log); builder.add_operator(op_log);
builder.add_operator(op_abs); builder.add_operator(op_abs);
builder.add_operator(op_round); //builder.add_operator(op_round);
builder.add_operator(op_v_mod); builder.add_operator(op_v_mod);
builder.add_operator(bitwise_and); builder.add_operator(bitwise_and);
builder.add_operator(bitwise_or); builder.add_operator(bitwise_or);

@ -1 +1 @@
Subproject commit 64e8d71468c632d17e01750083f1e5ebd5236910 Subproject commit 407273d0dcd86cb3f2030ca9b470cfa78958f23d

View File

@ -358,9 +358,6 @@ void update(const blt::gfx::window_data& data)
{ {
run_generation = true; run_generation = true;
} }
ImGui::Button("Reset Program");
if (ImGui::IsItemClicked())
program.reset_program(type_system.get_type<full_image_t>().id(), true);
ImGui::InputInt("Time Between Runs", &time_between_runs, 16); ImGui::InputInt("Time Between Runs", &time_between_runs, 16);
ImGui::Checkbox("Run", &is_running); ImGui::Checkbox("Run", &is_running);
auto& stats = program.get_population_stats(); auto& stats = program.get_population_stats();

Binary file not shown.

Before

Width:  |  Height:  |  Size: 535 KiB