CommonestFilter
CommonestFilter[data,r]
filters data by replacing every value with the most common value in its range-r neighborhood.
CommonestFilter[data,{r1,r2,…}]
uses ri for filtering the dimension in data.
Details

- CommonestFilter, also known as majority filter, is used to filter data by returning the commonest local value, where the extent of the effect is dependent on the value of r.
- The function applied to each range-r neighborhood is Commonest.
- If more than one commonest pixel exists and the center pixel is one of them, the center pixel is used. Otherwise, the pixel is replaced with a random commonest.
- The data can be any of the following:
-
list arbitrary-rank numerical array tseries temporal data such as TimeSeries, TemporalData, … image arbitrary Image or Image3D object audio an Audio object - For multichannel images, CommonestFilter replaces each pixel by the commonest pixel vector in the neighborhood.
- CommonestFilter[data,{r1,r2,…}] computes the commonest value in
blocks centered on each sample.
- CommonestFilter assumes the index coordinate system for lists and images.
- At the data boundaries, CommonestFilter uses smaller neighborhoods.


Examples
open allclose allBasic Examples (3)
Apply a majority filter to a vector of numbers:
Filter a TimeSeries:
Scope (11)
Data (7)
Commonest filtering applied to arbitrary expressions:
Majority filtering of a 2D array:
Filter an EventSeries:
Filter an Audio signal:
Parameters (4)
Applications (2)
Properties & Relations (1)
Commonest filter gives the same result as MedianFilter on binary images:
Possible Issues (1)
Text
Wolfram Research (2008), CommonestFilter, Wolfram Language function, https://reference.wolfram.com/language/ref/CommonestFilter.html (updated 2016).
CMS
Wolfram Language. 2008. "CommonestFilter." Wolfram Language & System Documentation Center. Wolfram Research. Last Modified 2016. https://reference.wolfram.com/language/ref/CommonestFilter.html.
APA
Wolfram Language. (2008). CommonestFilter. Wolfram Language & System Documentation Center. Retrieved from https://reference.wolfram.com/language/ref/CommonestFilter.html