Skip to content
Related Articles

Related Articles

Improve Article

Python – sharpen() function in Wand

  • Last Updated : 08 May, 2020

sharpen() function is used in order to enhance blurry edges into more distinct(sharp) edges. This is achieved using a Gaussian function. The radius value should always less than the standard deviation(sigma). Sharpen effect image more clearer and defined.

Syntax :

wand.image.sharpen(radius, sigma, channel)

Parameters :

ParameterInput TypeDescription
radiusnumbers.RealSize of gaussian aperture.
sigmanumbers.realStandard deviation of the gaussian filter.
channelbasestringOptional color channel to target. Default is none

Source Image:

Example 1:






# import Image from wand.image module
from wand.image import Image
  
# Read image using Image function
with Image(filename ="koala.jpeg") as img:
    # generating sharp image using sharpen() function.
    img.sharpen(radius = 8, sigma = 4)
    img.save(filename ="sharpkoala.jpeg")

Output:

Example 2:
Increasing the value of radius and standard deviation.




# import Image from wand.image module
from wand.image import Image
  
# Read image using Image function
with Image(filename ="koala.jpeg") as img:
  
    # generating sharp image using sharpen() function.
    img.sharpen(radius = 16, sigma = 8)
    img.save(filename ="sharpkoala.jpeg")

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. And to begin with your Machine Learning Journey, join the Machine Learning – Basic Level Course




My Personal Notes arrow_drop_up
Recommended Articles
Page :