我有一个a类型的numpy数组float64.如何使用高斯滤波器模糊此数据?
我试过了
from PIL import Image, ImageFilter
image = Image.fromarray(a)
filtered = image.filter(ImageFilter.GaussianBlur(radius=7))
Run Code Online (Sandbox Code Playgroud)
,但这会产生ValueError: 'image has wrong mode'.(它有模式F.)
我可以通过乘以a一些常数,然后舍入到整数来创建合适模式的图像.这应该有效,但我希望有一个更直接的方式.
(我正在使用Pillow 2.7.0.)
我正在查看scipy.ndimage.gaussian_filter,但无法理解sigma这里的含义。sigma= n平均值是n像素数,因此n点所有边上像素数内的区域对平均贡献最大?