medianFilter
syntax
<medianFilter numFilters="3" kernelSize="5" name="">
<source/>
</medianFilter>
brief
Output: numFilters median filter operations are performed. The first takes <source/> as its input, the second takes the result of the first, etc. The result of the last filtering is output. NOTE: kernelSize must be an odd (integer) number.
name may contain upper- and lowercase letters, numerals, underscore(_), and dash(-). It may not begin with a numeral or a dash.
details
Often, digital images have 'noise' in them. In the extreme case, this noise can present itself as pixels whose color values are obviously different from the values of their neighbors, such as magenta dots in a photo of a forest. What's more common these days is low intensity noise caused by physical imperfections in the image capture device (camera). A common solution to this random noise problem is a smoothing filter called the median filter.
Here's how the smoothing works. Consider the source image as a 2d array of numbers, where the intensity of the pixel (x,y) is the value of the array image[x][y]. The median filter looks up the intensities of the pixel in question and it's 'neighbors'. The pixel's neighborhood is the NxN matrix (or 'kernel') centered on the pixel. For example, if N=3, a pixel's neighborhood is the pixel itself, along with the 8 pixels immediately surrounding it (above, below, left, right and diagonals). The values of the pixel's neighborood are sorted, and the value in the middle of the sorted list (the median) becomes the value of the pixel in the destination image.
Imagine an pixel with intensity 128, whose neighbors are all value 64. Obviously, this pixel is the odd man out -- that's noise. Sorting the values in a 3x3 neighborhood gives (64,64,64,64,64,64,64,64,128). The median of this list (the item in the middle -- the fifth in this case) is 64, so the pixel value in the output will match its surroundings, eliminating the noise.
PlayMotion provides this functionality via medianFilter. The medainFilter tag has two attributes, kernelSize and numFilters. Neighborhood size determines the N of the NxN matrix of values to be sorted for the filter. The numFilters parameter is a convenience that allows you to perform multiple iterations of the median filter consecutively without having to put multiple <medianFilter/> tags in your siteXML file.
