Vector3 Modified
Dependents: optWingforHAPS_Eigen hexaTest_Eigen
Diff: MedianFilter.cpp
- Revision:
- 7:148420c0b1e2
- Parent:
- 3:ec86928ff12d
diff -r 9083665c67d8 -r 148420c0b1e2 MedianFilter.cpp --- a/MedianFilter.cpp Mon Oct 10 06:27:16 2016 +0000 +++ b/MedianFilter.cpp Wed Mar 02 15:06:54 2022 +0000 @@ -19,3 +19,45 @@ return _temp[_size/2]; } + +/* +#include "MedianFilter.hpp" + +MedianFilter::MedianFilter(int size) +{ + _size = size; + + for( float i = 0; i < _size; i++) + { + _windowx.push_back(i); + _windowy.push_back(i); + _windowz.push_back(i); + } +} + +Vector3 MedianFilter::Process(Vector3 val) +{ + Vector3 out; + + _windowx.pop_front(); + _windowx.push_back(val.x); + deque<float> _tempx(_windowx); + sort(_tempx.begin(), _tempx.end()); + out.x = _tempx[_size/2]; + + _windowy.pop_front(); + _windowy.push_back(val.y); + deque<float> _tempy(_windowy); + sort(_tempy.begin(), _tempy.end()); + out.y = _tempy[_size/2]; + + _windowz.pop_front(); + _windowz.push_back(val.z); + deque<float> _tempz(_windowz); + sort(_tempz.begin(), _tempz.end()); + out.z = _tempz[_size/2]; + return out; +} + + +*/ \ No newline at end of file