Python中的魔杖image.edge函数
边缘提取是一种效果,之后图像中存在的边缘会被突出显示。这样做是为了检测图像中存在的所有边缘。 edge()函数使用简单的卷积过滤器突出显示黑白图像的边缘。通常,计算机视觉和机器学习使用边缘检测。
Syntax :
Parameters :
Parameter | Input Type | Description |
---|---|---|
radius | numbers.Real | the radius of the, in pixels, not counting the center pixel. |
使用的图像:
示例 #1:
wand.image.edge(radius=radius)
输出:
示例#:增加半径值。
# 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")
输出:
在评论中写代码?请使用 ide.geeksforgeeks.org,生成链接并在此处分享链接。