Mathematica 9 is now available
THIS IS DOCUMENTATION FOR AN OBSOLETE PRODUCT.
SEE THE DOCUMENTATION CENTER FOR THE LATEST INFORMATION.
Mathematica > Data Manipulation > Image Processing & Analysis > Image Filtering & Neighborhood Processing >

CommonestFilter

CommonestFilter[image, r]
transforms image by replacing each pixel with the most common pixel value in its range r neighborhood.
CommonestFilter[data, r]
applies commonest filtering to an array of data.
  • CommonestFilter[image, r] computes the commonest value in (2r+1)×(2r+1) blocks centered on each pixel.
  • CommonestFilter[image, {r1, r2}] uses neighborhoods with vertical range r1 and horizontal range r2.
  • In CommonestFilter[data, ...], 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
Ask a question about this page  |  Suggest an improvement  |  Leave a message for the team