41 auto bbox_min = bounds.getMin();
42 auto bbox_max = bounds.getMax();
44 auto value_function = [bbox_min, bbox_max, &stamp](
PixelCoordinate coord) {
45 if (coord.m_x < bbox_min.m_x || coord.m_x > bbox_max.m_x || coord.m_y < bbox_min.m_y || coord.m_y > bbox_max.m_y) {
48 auto offset_coord = coord - bbox_min;
49 return stamp.getValue(offset_coord.m_x, offset_coord.m_y);
54 pixel_coordinates.
reserve(pixel_list.size());
55 for (
auto& pixel : pixel_list) {
65 if (merged.size() == 1) {
69 for (
auto& source_pixels : merged) {
72 new_source->setProperty<
DetectionFrame>(detection_frame.getEncapsulatedFrame());
93 if (pixels_with_origin.size() == 0) {
99 for (
auto& pixel_origin : pixels_with_origin) {
100 auto pixel = pixel_origin.first;
101 auto origin = pixel_origin.second;
104 for (
int i=0; i<5; i++) {
105 values[i] = value_function(pixel + offsets[i]);
109 for (
int i=1; i<3; i++) {
110 if (values[i] > values[
max]) {
114 for (
int i=3; i<5; i++) {
115 if (values[i] >= values[
max]) {
122 attractors[pixel].push_back(origin);
128 attractPixels(pixels_to_be_processed, attractors, value_function);
137 for (
auto& attractor : attractors) {
138 auto coord = attractor.first;
139 auto& pixels = attractor.second;
142 for (
size_t i=0; i < merged.
size(); i++) {
143 if (coord.m_x >= bbox_min[i].m_x-1 && coord.m_x <= bbox_max[i].m_x+1 && coord.m_y >= bbox_min[i].m_y-1 && coord.m_y <= bbox_max[i].m_y+1) {
146 merged[i].
insert(merged[i].
begin(), pixels.begin(), pixels.end());
T emplace_back(T... args)