📜 ⬆️ ⬇️

Image Blur Filter Kuwahara

The Kuwahara filter performs non-linear filtering of images with sharp edges retained. After filtering, the image looks like a roughly painted picture.
image

Algorithm


  1. In the neighborhood of each pixel, apply a mask of size (2r + 1) * (2r + 1)
  2. The neighborhood is divided into 4 areas indicated by the numbers I, II, III, IV, the size of r * r
  3. Calculate the average intensity and variance in each of the areas I, II, III, IV
  4. Assign to the central pixel X the average intensity value of the region, the dispersion of which is the smallest

Filter mask


Application


Segmentation of uniform color areas

Suppose we have the task of finding water in a space image. At the preprocessing stage, it is necessary to clear the image of noise and make it smoother and more uniform. And the information about the borders of objects in the image should be saved. Apply to the original image filter kuwahara.
Source image
image
Kuwahara 21x21

After filtering, the boundaries became clearer, and some loop filter, such as a Canny detector, can be applied to the image.
Kanni detector applied after kuwahara filtering
image
For comparison, if we used a Gaussian filter as a pre-processing, we would get the following images:
Gauss filter 21x21
image

image
')
Apply a filter to create the effect of a painted picture.

Although it is not the best filter to create a watercolor or gouache effect, but in many cases, in my opinion, a very beautiful effect is obtained.
Source image
image
Kuwahara 21x21
image

Links


Source: https://habr.com/ru/post/151112/


All Articles