dsb_utils.py 文件源码

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

项目:diagnose-heart 作者: woshialex 项目源码 文件源码
def gaussian_pdf(height, center_x, center_y, width_x, width_y, rotation):
    """Returns a pdf function with the given parameters"""
    width_x = float(width_x)
    width_y = float(width_y)
    rotation = np.deg2rad(rotation)
    center_x = center_x * np.cos(rotation) - center_y * np.sin(rotation)
    center_y = center_x * np.sin(rotation) + center_y * np.cos(rotation)
    def rotgauss(x,y):
        xp = x * np.cos(rotation) - y * np.sin(rotation)
        yp = x * np.sin(rotation) + y * np.cos(rotation)
        g = height*np.exp(
            -(((center_x-xp)/width_x)**2+
              ((center_y-yp)/width_y)**2)/2.)
        return g
    return rotgauss

# doesn't allow for flattening or mean shifting, otherwise occasionally
# we get gaussians that are in the wrong place or drastically the wrong shape
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号