18 #ifndef SOURCEXTRACTORPLUSPLUS_MEDIANFILTER_H
19 #define SOURCEXTRACTORPLUSPLUS_MEDIANFILTER_H
83 if (std::abs(median - value) >= threshold) {
84 out_img->setValue(
x,
y, median);
85 auto var_box =
getBox(variance,
x,
y);
89 out_img->setValue(
x,
y, value);
108 auto nitems = data.
size();
110 return data[nitems / 2];
111 return (data[nitems / 2] + data[nitems / 2 - 1]) / 2;
126 static int clip(
int position,
int box_size,
int image_size) {
128 if (box_size > position)
130 if (box_size > image_size - position - 1)
131 return image_size - position - 1;
143 for (
int iy = -hh; iy < hh + 1; ++iy) {
144 for (
int ix = -hw; ix < hw + 1; ++ix) {
155 #endif //SOURCEXTRACTORPLUSPLUS_MEDIANFILTER_H