How to obtain a gaussian filter in python

后端 未结 8 1377
广开言路
广开言路 2021-01-31 03:57

I am using python to create a gaussian filter of size 5x5. I saw this post here where they talk about a similar thing but I didn\'t find the exact way to get equivalent python c

8条回答
  •  醉酒成梦
    2021-01-31 04:41

    This function implements functionality similar to fspecial in matlab

    http://docs.scipy.org/doc/scipy/reference/generated/scipy.signal.get_window.html from scipy import signal

    >>>signal.get_window(('gaussian',2),3)
    >>>array([ 0.8824969,  1.       ,  0.8824969])
    

    This function appears to generate only 1D kernels

    I guess you could implement code to generate a Gaussian mask yourself as well as other have pointed out.

提交回复
热议问题