This is documentation for Mathematica 8, which was
based on an earlier version of the Wolfram Language.
View current documentation (Version 11.1)

CommonestFilter

CommonestFilter
transforms image by replacing each pixel with the most common pixel value in its range r neighborhood.
CommonestFilter
applies commonest filtering to an array of data.
  • CommonestFilter computes the commonest value in blocks centered on each pixel.
  • For multichannel images, CommonestFilter computes the commonest of the set of pixel vectors.
  • CommonestFilter uses neighborhoods with vertical range and horizontal range .
  • In CommonestFilter, data can be an array of any rank, and can contain symbolic as well as numerical entries.
Replacing each pixel with the most common color in its neighborhood creates a posterization effect:
Apply commonest filtering to a vector of numbers:
Replacing each pixel with the most common color in its neighborhood creates a posterization effect:
In[1]:=
Click for copyable input
Out[1]=
 
Apply commonest filtering to a vector of numbers:
In[1]:=
Click for copyable input
Out[1]=
Commonest filtering applied to arbitrary expressions:
Majority filtering removes noise from a binary image:
Commonest filtering applied to random noise:
New in 7