How to gauss-filter (blur) a floating point numpy array

后端 未结 3 650
小鲜肉
小鲜肉 2021-02-01 04:39

I have got a numpy array a of type float64. How can I blur this data with a Gauss filter?

I have tried

from PIL import Image,          


        
3条回答
  •  梦谈多话
    2021-02-01 04:47

    If you have a two-dimensional numpy array a, you can use a Gaussian filter on it directly without using Pillow to convert it to an image first. scipy has a function gaussian_filter that does the same.

    from scipy.ndimage.filters import gaussian_filter
    
    blurred = gaussian_filter(a, sigma=7)
    

提交回复
热议问题