Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Dependents: optWingforHAPS_Eigen hexaTest_Eigen
Revision 7:148420c0b1e2, committed 2022-03-02
- Comitter:
- NaotoMorita
- Date:
- Wed Mar 02 15:06:54 2022 +0000
- Parent:
- 5:9083665c67d8
- Commit message:
- vector3 to float
Changed in this revision
| MedianFilter.cpp | Show annotated file Show diff for this revision Revisions of this file |
| MedianFilter.hpp | Show annotated file Show diff for this revision Revisions of this file |
--- 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
--- a/MedianFilter.hpp Mon Oct 10 06:27:16 2016 +0000
+++ b/MedianFilter.hpp Wed Mar 02 15:06:54 2022 +0000
@@ -17,3 +17,29 @@
deque<float> _window;
};
#endif
+
+/*
+#ifndef MEDIANFILTER_H
+#define MEDIANFILTER_H
+
+#include "mbed.h"
+#include <deque>
+#include <algorithm>
+#include "Vector3.hpp"
+
+class MedianFilter
+{
+public:
+ MedianFilter(int size = 3);
+
+ Vector3 Process(Vector3 val);
+
+private:
+ int _size;
+ deque<float> _windowx;
+ deque<float> _windowy;
+ deque<float> _windowz;
+};
+#endif
+
+*/