46 if (group.
size() <= 1) {
54 for (
auto it = group.
begin(); it != group.
end(); ++it) {
62 if (sources_to_clean.
size() > 0) {
63 if (remaining_sources.
size() > 1) {
65 for (
auto it : sources_to_clean) {
67 merging_map[influential_source].push_back(it);
70 for (
auto merging_pair : merging_map) {
71 if (merging_pair.second.size() > 0) {
72 auto new_source =
mergeSources(*merging_pair.first, merging_pair.second);
77 }
else if (remaining_sources.
size() == 1) {
78 auto new_source =
mergeSources(*remaining_sources[0], sources_to_clean);
83 for (
auto& it : sources_to_clean) {
128 for (
size_t i = 0; i < candidates.
size(); i++) {
130 for (
auto pixel : pixel_list) {
131 auto pixel_value = model.getValue(pixel.m_x, pixel.m_y);
132 total_influence_of_sources[i] += pixel_value;
137 double most_influential_source_value = 0;
138 for (
size_t i = 0; i < candidates.
size(); i++) {
139 if (total_influence_of_sources[i] >= most_influential_source_value) {
140 most_influential_source = candidates[i];
141 most_influential_source_value = total_influence_of_sources[i];
144 return most_influential_source;