Image Blur Filter Kuwahara

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

    Algorithm


    1. In the vicinity 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, size 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 value of the intensity of the region with the smallest dispersion

    Filter mask


    Application


    Segmentation of homogeneous color areas

    Suppose we have the task of finding reservoirs in space. At the pre-processing stage, it is necessary to clean the image from noise and make it smoother and more uniform. Moreover, information about the boundaries of objects in the image should be saved. Apply the kuwahara filter to the original image.
    Original image
    image
    Kuwahara 21x21

    After filtering, the borders became sharper, and you can apply some kind of contour filter to the image, for example, a Canny detector.
    Canny detector applied after kuwahara filtering
    image
    For comparison, if we were to use a Gaussian filter as preprocessing, we would get the following images:
    Gaussian filter 21x21
    image

    image

    Apply a filter to create the effect of a painted picture

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

    References



    Also popular now: