a floating median filter to filter floating point data such as analog inputs

Dependents:   Quadcopter_mk2

Fork of filter by Ad van der Weiden

Revision:
0:46a72e790df8
Child:
1:9ce370b360ba
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/filter.h	Wed Feb 16 20:05:42 2011 +0000
@@ -0,0 +1,24 @@
+#ifndef FILTER_H
+#define FILTER_H
+
+class filter {
+public:
+    virtual float process(float in) {
+        return in;
+    }
+};
+
+class medianFilter: public filter {
+    int N;
+    float *val;
+    bool *big;
+    int med, i;
+    float median;
+    int findmax();
+    int findmin();
+public:
+    medianFilter(int window = 3); //every window >= 1 is allowed but the behaviour for even window sizes is not well defined
+    virtual float process(float);
+};
+
+#endif
\ No newline at end of file