computes for each pixel p in image the variance of the values in the four (r+1)×(r+1) squares that have p as a corner, and replaces p with the mean of the values of the square with least variance.


  • KuwaharaFilter is a non-linear local filter typically used for edge-preserving smoothing.
  • KuwaharaFilter works with binary, grayscale, and color images. For multi-channel images, KuwaharaFilter computes the sum of the variances in each channel.
  • At the edges of an image, KuwaharaFilter uses smaller neighborhoods.
  • KuwaharaFilter works with 3D as well as 2D images, and also with data arrays of any rank.
  • KuwaharaFilter[image,{rrow,rcol}] uses range rrow in height, and rcol in width.
  • KuwaharaFilter[image,{rslice,rrow,rcol}] uses range rslice in height, rrow in depth, and rcol in width.


open allclose all

Basic Examples  (1)

Smoothing the image, while preserving the edges:

Click for copyable input

Applications  (2)

See Also

MeanFilter  ImageFilter

Introduced in 2010
| Updated in 2012