Python – Wand 中的自适应模糊
自适应模糊是一种模糊。唯一的区别是图像中可检测边缘周围的模糊强度较小,而在没有边缘的区域则较大。自适应模糊可以使用adaptive_blur函数来完成。
Syntax :
Python3
Python3
Python3
# 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.blur(radius = 8, sigma = 3)
# save final image
img.save(filename ="adblur_koala.jpeg")
Parameters :
Parameter Input Type Description radius numbers.real the radius of the, in pixels, not counting the center pixel. Default is 0.0. sigma numbers.real the standard deviation of the, in pixels. Default value is 0.0. channel basestring Optional color channel to apply blur.
示例 #1:
Python3
wand.image.adaptive_blur(radius="radius_value",
sigma="sigma_value",
channel = "optional_channel_value")
# radius should always be greater than sigma(standard deviation)
输出:
示例 #2:
Python3
# import Image from wand.image module
from wand.image import Image
# read file using Image function
with Image(filename ="gfg.png") as img:
# perform adaptive blur effect using adaptive_blur() function
img.adaptive_blur(radius = 8, sigma = 4)
# save final image
img.save(filename ="adblur_gfg.png")
输出: