Wand gaussian_blur() function in Python
Another type of blur is Gaussian Blur. Difference of Gaussian blur with normal is that Gaussian Blur is achieved by using Gaussian Function. Simply any equation of the form :
is called Gaussian Function.
Syntax :
wand.image.gaussian_blur(radius="radius_value",sigma="sigma_value",channel="optional_channel_value")# radius should always be greater than sigma(standard deviation)Parameters :
Parameter Input Type Description radius numbers.real the radius of the, in pixels, not counting the center pixel. sigma numbers.real the standard deviation, in pixels channel basestring Optional color channel to apply blur. Image Used :
Example #1:
# import display() to show final imagefromwand.displayimportdisplay# import Image from wand.image modulefromwand.imageimportImage# read file using Image functionwith Image(filename="koala.jpeg") as img:# perform adaptive blur effect using adaptive_blur() functionimg.gaussian_blur(radius=5, sigma=4)# save final imageimg.save(filename="gb_koala.jpeg")# display final imagedisplay(img)Output :
Example #2: Reduced radius and sigma
# import display() to show final imagefromwand.displayimportdisplay# import Image from wand.image modulefromwand.imageimportImage# read file using Image functionwith Image(filename="koala.jpeg") as img:# perform adaptive blur effect using adaptive_blur() functionimg.gaussian_blur(radius=2, sigma=3)# save final imageimg.save(filename="gb_koala.jpeg")# display final imagedisplay(img)Output :
Attention geek! Strengthen your foundations with the Python Programming Foundation Course and learn the basics.
To begin with, your interview preparations Enhance your Data Structures concepts with the Python DS Course.





