utils.py 文件源码

python
阅读 23 收藏 0 点赞 0 评论 0

项目:FingerNet 作者: felixTY 项目源码 文件源码
def gaussian2d(shape=(5,5),sigma=0.5):
    """
    2D gaussian mask - should give the same result as MATLAB's
    fspecial('gaussian',[shape],[sigma])
    """
    m,n = [(ss-1.)/2. for ss in shape]
    y,x = np.ogrid[-m:m+1,-n:n+1]
    h = np.exp( -(x*x + y*y) / (2.*sigma*sigma) )
    h[ h < np.finfo(h.dtype).eps*h.max() ] = 0
    sumh = h.sum()
    if sumh != 0:
        h /= sumh
    return h
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号