Giter VIP home page Giter VIP logo

medianfilter's Introduction

MedianFilter

Simple Median Filter library designed for the Arduino platform.

LIMITATIONS:

  1. Minimum window size is 3

  2. Maximum window size is 255

  3. Only accepts arduino data type INT

USAGE:

Object Creation:

MedianFilter filterObject(size, seed); 
  • Use the smallest window that provides acceptable results, large windows use more memory and take more time
  • Seed allows for initializing the filer to the desired or expected starting value

Input Data:

filterResult = filterObject.in(newValue);
  • This will return the median value after the new sample has been processed

Read Current Value:

filterResult = filterObject.out();
  • this allows for reading the current median value without submitting a new sample

Other Statistics

filterObject.getMin();
filterObject.getMax();
filterObject.getMean();
filterObject.getStDev();

OPERATION OVERVIEW

This median filter attempts to minimize processing time by maintaining a data list that is sorted from smallest value to largest value. When a new sample is submitted, it replaces the oldest sample. The new sample is then shifted in the sorted list to bring it to the correct location. Map arrays are used to track the age and location of each sample.

Static memory usage grows linearly with window size at a rate of 4bytes per window width unit (for 16bit int data types). A filter with window size of 7 will require 28bytes plus a couple more bytes for other variables. At maximum window size of 255, the filter will require over 1KB of memory. If this large of a filter is needed, then a median filter is probably not the right tool.

Processing time of any single sample is random but bounded. Best case is where the old sample that is replaced is where the new sample needs to be, requiring no shifting. The worst case is where the new sample needs to travers the entire list to get sorted into it's place. Regardless of this variability, over a large number of samples the average time required by the filter increases proprtionately to the square of the window size. (ToDo: add table of average processing time based on window size)

medianfilter's People

Contributors

daphoosa avatar dirksoet avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.