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.

DetailsDetails

  • CommonestFilter[image,r] computes the commonest value in blocks centered on each pixel.
  • For multichannel images, CommonestFilter computes the commonest of the set of pixel vectors.
  • At the edges of an image, CommonestFilter uses smaller neighborhoods.
  • CommonestFilter works with 3D as well as 2D images, and also with data arrays of any rank.
  • CommonestFilter[image,{rrow,rcol}] uses range rrow in height, and rcol in width.
  • CommonestFilter[image,{rslice,rrow,rcol}] uses range rslice in height, rrow in depth, and rcol in width.

ExamplesExamplesopen allclose all

Basic Examples  (3)Basic Examples  (3)

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 3D volume:

In[1]:=
Click for copyable input
Out[1]=

Apply commonest filtering to a vector of numbers:

In[1]:=
Click for copyable input
Out[1]=
Introduced in 2008
(7.0)
| Updated in 2012
(9.0)
Translate this page: