Skip to content
Related Articles

Related Articles

Wand image.edge function in Python
  • Last Updated : 22 Apr, 2020

Edge Extraction is an effect after which the edges present in image gets highlighted. It is done in order to detect all the edges present in image. edge() function highlight edges on black and white images with a simple convolution filter. Generally, Edge Detection is used by Computer Vision and Machine Learning.

Syntax :

wand.image.edge(radius=radius)

Parameters :

ParameterInput TypeDescription
radiusnumbers.Realthe radius of the, in pixels, not counting the center pixel.

Image Used :

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:
    # transform image to grayscale image
    img.transform_colorspace('gray')
  
    # edge extraction using edge() function
    img.edge(1)
    img.save(filename ="edgekoala.jpeg")

Output:

Example #: Increasing radius Value.




# import Image from wand.image module
from wand.image import Image
  
# read image using Image() function
with Image(filename ="koala.jpeg") as img:
  
    # transform image to grayscale image
    img.transform_colorspace('gray')
  
    # edge extraction using edge() function
    img.edge(3)
    img.save(filename ="edgekoala.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 :