32 m_offset.clip(threshold_image->getWidth(), threshold_image->getHeight());
34 auto max_pixel_copy = max_pixel;
35 max_pixel_copy.
clip(threshold_image->getWidth(), threshold_image->getHeight());
37 auto width = max_pixel_copy.m_x -
m_offset.m_x + 1;
38 auto height = max_pixel_copy.m_y -
m_offset.m_y + 1;
42 auto threshold_cutout = threshold_image->getChunk(
m_offset, max_pixel_copy);
44 for (
auto& pixel_coord : pixel_list) {
45 auto act_x = pixel_coord.m_x -
m_offset.m_x;
46 auto act_y = pixel_coord.m_y -
m_offset.m_y;
48 if (act_x >= 0 && act_y >= 0 && act_x < width && act_y < height) {
53 for (
int act_y = 0; act_y < height; ++act_y) {
54 for (
int act_x = 0; act_x < width; ++act_x) {
57 bool is_above_threshold = threshold_cutout->getValue(act_x, act_y) > 0;