Python中的魔杖wavelet_denoise()函数
此方法与使用 soft()函数从图像中去除噪声相同。但是这种方法通过应用小波变换来去除噪声,更加方便和有效。阈值参数应该是一个介于 0.0 和quantum_range 之间的值,
Syntax :
Parameters :
Parameter Input Type Description threshold numbers.Real value between 0.0 & quantum_range softness numbers.Real apply softness to image
源图像:
示例 1:
Python3
wand.image.wave_denoise(threshold, softness)
Python3
# Import Image from wand.image module
from wand.image import Image
# Read image using Image function
with Image(filename ="koala.jpeg") as img:
# denoise image using wave_denoise() function
img.wavelet_denoise(threshold = 0.05 * img.quantum_range,
softness = 0.0)
img.save(filename ="vkoala.jpeg")
输出:
示例 2:增加阈值
Python3
# Import Image from wand.image module
from wand.image import Image
# Read image using Image function
with Image(filename ="koala.jpeg") as img:
# vignette image using vignette() function
img.wavelet_denoise(threshold = 0.065 * img.quantum_range,
softness = 0.00)
img.save(filename ="vkoala2.jpeg")
输出: