Refuse to accept NaNs in MovingMedian, replacing them with zeros (and a warning) instead. (Must push something, to maintain filter length)
This commit is contained in:
@@ -30,6 +30,8 @@
|
||||
|
||||
#include <algorithm>
|
||||
|
||||
#include <iostream>
|
||||
|
||||
namespace RubberBand
|
||||
{
|
||||
|
||||
@@ -59,6 +61,10 @@ public:
|
||||
}
|
||||
|
||||
void push(T value) {
|
||||
if (value != value) {
|
||||
std::cerr << "WARNING: MovingMedian: NaN encountered" << std::endl;
|
||||
value = T();
|
||||
}
|
||||
drop(m_frame[0]);
|
||||
v_move(m_frame, m_frame+1, P::m_size-1);
|
||||
m_frame[P::m_size-1] = value;
|
||||
|
||||
Reference in New Issue
Block a user