jacobian.py 文件源码

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

项目:rasl 作者: welch 项目源码 文件源码
def image_gradient(image, horv):
    """apply a sobel filter to the image to approximate the gradient

    Parameters
    ----------
    image : ndarray(h, v)
        image as an ndarray
    horv : string
        "h" or "v", direction of gradient.

    Returns
    -------
    image_dir : ndarray(h, v)
        directional gradient magnitude at each pixel

    """
    axis = 1 if horv == 'h' else 0
    grad = ndi.sobel(image, axis, mode='constant', cval=np.nan) / 8.0
    return np.nan_to_num(grad)
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号