sift.py 文件源码

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

项目:computer-vision-algorithms 作者: aleju 项目源码 文件源码
def generate_dog(img, nb_octaves, nb_per_octave=4):
    """Generate the difference of gaussians of an image.
    Args:
        img    The input image
        nb_octaves   Number of octaves (groups of images with similar smoothing/sigmas)
        nb_per_octave Number of images in one octave (with increasing smoothing/sigmas)
    Returns:
        List of (difference image, sigma value)
    """
    spaces = []
    sigma_start = 1.6
    k_start = math.sqrt(2)
    for i in range(nb_octaves):
        sigma = sigma_start * (2 ** i)
        last_gauss = None
        for j in range(nb_per_octave+1):
            k = k_start ** (j+1)
            gauss = filters.gaussian_filter(img, k*sigma)
            if last_gauss is not None:
                diff = gauss - last_gauss
                spaces.append((diff, k*sigma))
            last_gauss = gauss
    return spaces
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号