Skip to content
Related Articles

Related Articles

Python – motion_blur() in Wand
  • Last Updated : 08 May, 2020

Another kind of blur we can perform in Wand is Motion Blur. In this kind a Gaussia blur is performed in a single linear direction and it appears like image is moving in a linear direction. It takes a new angle parameter.

Syntax :




wand.image.motion_blur(radius= radius_value, sigma= sigma_value, 
             angle= angle_value, channel = "optional_channel_value")
# radius should always be greater than sigma(standard deviation)

Parametere :

ParameterInput TypeDescription
radiusnumbers.Realthe radius of the, in pixels, not counting the center pixel.
sigmanumbers.Realthe standard deviation, in pixels
anglenumber.RealApply the effect along this angle.
channelbasestringOptional color channel to apply blur.

Image Used :

Example 1:






# import display() to show final image
from wand.display import display
# import Image from wand.image module
from wand.image import Image
  
# read file using Image function
with Image(filename ="koala.jpeg") as img:
  
    # perform adaptive blur effect using adaptive_blur() function
    img.motion_blur(radius = 16, sigma = 8, angle = 90)
  
    # save final image
    img.save(filename ="mb_koala.jpeg")
  
    # display final image
    display(img)

Output :

Example 2: increase radius, sigma and changed angle to 45.




# import display() to show final image
from wand.display import display
# import Image from wand.image module
from wand.image import Image
  
# read file using Image function
with Image(filename ="koala.jpeg") as img:
  
    # perform adaptive blur effect using adaptive_blur() function
    img.motion_blur(radius = 22, sigma = 10, angle = 45)
  
    # save final image
    img.save(filename ="gb_koala.jpeg")
  
    # display final image
    display(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. And to begin with your Machine Learning Journey, join the Machine Learning – Basic Level Course

My Personal Notes arrow_drop_up
Recommended Articles
Page :