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

Dependents:   df-2013-minihack-slingshot SPK-DVIMXR QuadCopter Projeto ... more

filter.h

Committer:
networker
Date:
2011-02-16
Revision:
0:46a72e790df8

File content as of revision 0:46a72e790df8:

#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