last
parent
a81d01113c
commit
22bb4d0981
|
@ -1,5 +1,5 @@
|
||||||
cmake_minimum_required(VERSION 3.25)
|
cmake_minimum_required(VERSION 3.25)
|
||||||
project(image-gp-6 VERSION 0.0.25)
|
project(image-gp-6 VERSION 0.0.26)
|
||||||
|
|
||||||
include(FetchContent)
|
include(FetchContent)
|
||||||
|
|
||||||
|
|
54
src/main.cpp
54
src/main.cpp
|
@ -247,33 +247,33 @@ constexpr auto create_fitness_function()
|
||||||
fitness.raw_fitness += 400;
|
fitness.raw_fitness += 400;
|
||||||
else
|
else
|
||||||
fitness.raw_fitness += raw.total + raw.combined + 1.0;
|
fitness.raw_fitness += raw.total + raw.combined + 1.0;
|
||||||
|
//
|
||||||
cv::Mat base_image_large{full_base_image.get_width(), full_base_image.get_height(), CV_32FC3, full_base_image.get_data()};
|
// cv::Mat base_image_large{full_base_image.get_width(), full_base_image.get_height(), CV_32FC3, full_base_image.get_data()};
|
||||||
cv::Mat templ{IMAGE_SIZE, IMAGE_SIZE, CV_32FC3, v.rgb_data};
|
// cv::Mat templ{IMAGE_SIZE, IMAGE_SIZE, CV_32FC3, v.rgb_data};
|
||||||
cv::Mat result;
|
// cv::Mat result;
|
||||||
|
//
|
||||||
int result_cols = base_image_large.cols - templ.cols + 1;
|
// int result_cols = base_image_large.cols - templ.cols + 1;
|
||||||
int result_rows = base_image_large.rows - templ.rows + 1;
|
// int result_rows = base_image_large.rows - templ.rows + 1;
|
||||||
|
//
|
||||||
result.create(result_rows, result_cols, CV_32FC1);
|
// result.create(result_rows, result_cols, CV_32FC1);
|
||||||
|
//
|
||||||
double minVal;
|
// double minVal;
|
||||||
double maxVal;
|
// double maxVal;
|
||||||
cv::matchTemplate(base_image_large, templ, result, match_method);
|
// cv::matchTemplate(base_image_large, templ, result, match_method);
|
||||||
|
//
|
||||||
minMaxLoc(result, &minVal, &maxVal, nullptr, nullptr, cv::Mat());
|
// minMaxLoc(result, &minVal, &maxVal, nullptr, nullptr, cv::Mat());
|
||||||
|
//
|
||||||
/// For SQDIFF and SQDIFF_NORMED, the best matches are lower values. For all the other methods, the higher the better
|
// /// For SQDIFF and SQDIFF_NORMED, the best matches are lower values. For all the other methods, the higher the better
|
||||||
if (match_method == cv::TM_SQDIFF || match_method == cv::TM_SQDIFF_NORMED)
|
// if (match_method == cv::TM_SQDIFF || match_method == cv::TM_SQDIFF_NORMED)
|
||||||
{
|
// {
|
||||||
if (std::isinf(minVal) || std::isnan(minVal))
|
// if (std::isinf(minVal) || std::isnan(minVal))
|
||||||
minVal = 200000;
|
// minVal = 200000;
|
||||||
fitness.raw_fitness += minVal * 0.01f;
|
// fitness.raw_fitness += minVal * 0.01f;
|
||||||
//BLT_TRACE("%lf, %lf", minVal, maxVal);
|
// //BLT_TRACE("%lf, %lf", minVal, maxVal);
|
||||||
} else
|
// } else
|
||||||
{
|
// {
|
||||||
BLT_WARN("Hello!");
|
// BLT_WARN("Hello!");
|
||||||
}
|
// }
|
||||||
|
|
||||||
fitness.raw_fitness += last_fitness;
|
fitness.raw_fitness += last_fitness;
|
||||||
} else
|
} else
|
||||||
|
|
Loading…
Reference in New Issue