MedianFilter: sliding window median filter component

Tip / Sign in to post questions, reply, level up, and achieve exciting badges. Know more

cross mob
lock attach
Attachments are accessible only for community members.
odissey1
Level 9
Level 9
First comment on KBA 1000 replies posted 750 replies posted

Hi,

Provided below is custom component (MedianFilter v0.0) for filtering streamed data.

 

The MedianFilter component implements Phil Extrom’s sliding window median algorithm for scalar data. Sampled signals with few amounts of erroneous data can be effectively de-noised using this filter. Component doesn’t consume hardware resources, performing all operations by CPU, which is useful for systems with little resources, such as PoC4. The filter is non-decimating, producing the output on every sample added. Multiple instances of the component can be added to the project for processing independent signal streams.

 

Component features:

   -Data range: int8, int16, int32, uint8, uint16, uint32

   -Has fixed execution time

   -Grows linear with size

   -Non-decimating

 

The component was tested using CY8CKIT-059 PSoC5 prototyping kit and CY8CKIT-042 PSoC4 Pioneer Kit. Demo projects are provided.

 

Attached archive contains component library, component datasheet and demo projects for PSoC5 and PSoC4. Please read installation instructions in the readme.txt.

 

The component provided as-is, no liabilities. It is free to use and modify.

/odissey1

 

P.S. Demo projects use optional annotation components (which are also provided here in Support_libs.zip):

   PSoC Annotation Library: PSoC Annotation Library v1.0

   KIT-042 annotation stub: KIT-042: annotation component for CY8CKIT-042 Pioneer Kit

   SerialPlot library: SerialPlot: interface to real-time data charts

 

SerialPlot open source charting tool for Linux/Windows can be downloaded here

SerialPlot charting SW: SerialPlot – Realtime Plotting Software for UART/Serial Port 

Download SerialPlot: Hackaday.io: SerialPlot - Realtime Plotting Software 

 

 

Figure 1. PSoC5 demo project schematic.

Median_basic_01a_A2.png

Figure 2. Data output using SerialPlot charting software. Black - signal w/o noise, Green - signal with disturbance, Red - FIR output, Blue - median filter output (recovered signal).

Median_basic_01a_D.png

Figure 3. Project annotation using PSoC Annotation Library.

SerialPlot_basic_01a_C1.png

1 Reply
Vasanth
Moderator
Moderator
Moderator
250 sign-ins 500 solutions authored First question asked

Hi odissey1,

Thanks for the contributing to the community code examples.

Best Regards,
Vasanth

0 Likes