# Filter Variables

The Filter Variables module provides a way to filter a variable's value over time in order to remove noise generated in a given image. For example, when tracking a color object using the Center of Gravity module the actual COG_X and COG_Y reported will tend to vibrate somewhat even in a stable image due to pixel noise. Using the Filter Variable module you can specify that the current value is in fact the current value plus a combination from previous values of that variable. This allows you to smooth the current value based on previous values to provide a more stable representation of what the current value is.

## Interface

## Instructions

1. Variables to Process - Select which variables you wish to filter using the provided "Available Variables" listbox. Either double click on a variable of select a variable and click on the appropriate yellow arrow to move the variable into the Process variables listbox. As soon as the variable shows in the Process Variables listbox it will be filtered. Note that if you wish to preserve the current unfiltered value you will need to create a copy of the variable. See the Set Variable module to do so.

2. Method - Once your variables are selected you will need to select which filtering method to apply to the variable.

- Mean - Calculates the mean of the last X and current variable values and
substitutes the current value for that result.
- Median - Calculates the middle value of the last X and current variable
value from a sorted list of the past values and substitutes the current
value for that result.
- Mode - Determines the most frequent value of the last X values and
substitutes the current value for that result. If no values occur more than
once then the Median is used instead.
- Bilateral - Calculates the bilateral value of the last X values
and substitutes the current value for that result. Note the Bilateral
threshold is used during this calculation.
- Max - Substitutes the current value for the maximum value seen in the
last X and current values.
- Min - Substitutes the current value for the minimum value seen in the
last X and current values.
- Midpoint - Substitutes the current value for the midpoint value seen in the
last X and current values. The midpoint value is calculated by determining
the average of the max and min value of the last X values.
- Peak - Determines the value of the last peak seen in the last X values.
A peak is defined as an increase followed by a decrease in value around a single
point. Due to this the current value can NEVER be a peak as the definition
requires at least one previous and one next value around a point to determine
if it is a peak or not.
- Valley - Opposite of a peak, a valley is defined as a decrease followed
by an increase in value around a single point. Again, the current value cannot
be defined as a valley as the next value is not yet known.
- Change - A combination of a peak or valley that indicates the last value
when either a peak or a valley was detected.
- Line - Calculates a line that best fits the last X values and uses that
equation to determine what the current value would be if placed on that line.
- Delta - Calculates the difference between the current value and the average of the last X values.

## See Also

Set Variable

Chart Variables

New Post |

Filter_Variables Related Forum Posts | Last post | Posts | Views |

If statement with time variablr
Hello, I've been wanting write an if statement that also includes a time variable. For example in would like to write...If angle... |
1 year | 3 | 352 |

Filter array variables
Hi there, I'm having difficulty with filtering an array of variables. I have multiple blob COGs bei... |
1 year | 2 | 369 |

Certainty
Is there a simple way to integrate the result of a test? When I move my camera to a ... |
5 years | 4 | 1095 |

Spark_Fun Mega Pan/Tilt camera: Pan going in wrong direction!
I am trying to use the Sparkfun Arduino mega as downloaded from Roborealm website. I believe the VBscript code i am u... |
6 years | 6 | 2208 |

Smoothing Data
I'm sending COG_X and COG_BOX_SIZE serially to an arduino to run some motors. I'd like to have a VR script to smooth or do a r... |
8 years | 7 | 2094 |

IMAGE_TIME
I have a question regarding IMAGE_TIME. I am currently working on a project for school and using a variety of methods to try and... |
9 years | 7 | 2318 |

Kalman filter
Hi, I've heard that the Kalamn filter is a very good filter and it predicts the current positio... |
9 years | 7 | 3458 |