Filter Examples

[1]:
from easycv import Image
from easycv.transforms.filter import Blur, Sharpen, Sharpness

For this example we will load an image with random(). For more examples of image loading check Image examples.

[2]:
img = Image.random()
img
[2]:
../../_images/examples_transforms_filter_3_0.png

Blur

To blur an image we simply apply the Blur transform with the desired method, for more information check the reference.

[3]:
img.apply(Blur(method="gaussian", size=11))
[3]:
../../_images/examples_transforms_filter_6_0.png
[4]:
img.apply(Blur(method="bilateral"))
[4]:
../../_images/examples_transforms_filter_7_0.png

Sharpness

You can detect how sharpen an image image by applying the Sharpness transform, for more information check the reference.

[6]:
img
[6]:
../../_images/examples_transforms_filter_10_0.png
[5]:
img.apply(Sharpness())
[5]:
{'sharpness': 325.05299530543067, 'sharpen': True}

We can see that the image is sharpen. Now let’s test on a blurry image.

[7]:
img_blurry = Image('images/blurred.jpg')
img_blurry
[7]:
../../_images/examples_transforms_filter_13_0.png
[8]:
img_blurry.apply(Sharpness())
[8]:
{'sharpness': 14.315561379722062, 'sharpen': False}

Sharpen

To Sharpen an image we simply apply the Sharpen transform, for more information check the reference.

[9]:
img.apply(Sharpen())
[9]:
../../_images/examples_transforms_filter_17_0.png