16 #ifndef MEDIAN_FILTER_H
17 #define MEDIAN_FILTER_H
51 std::cerr <<
"WARNING: MedianFilter::push: attempt to push NaN, pushing zero instead" << std::endl;
71 int ix = int((
m_size * percentile) / 100.f);
82 static std::vector<T>
filter(
int size,
const std::vector<T> &in) {
85 for (
int i = 0; i < int(in.size()); ++i) {
88 if (i >= size/2) out.push_back(median);
90 while (out.size() < in.size()) {
92 out.push_back(f.
get());
109 for (
int i = n; i > 0; --i) point[i] = point[i-1];
117 if (*point != value) {
118 std::cerr <<
"WARNING: MedianFilter::drop: *point is " << *point
119 <<
", expected " << value << std::endl;
122 for (
int i = 0; i < n; ++i) point[i] = point[i+1];