hough.py 文件源码

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

项目:computer-vision-algorithms 作者: aleju 项目源码 文件源码
def main():
    """Create a noisy line image, recover the line via hough transform and
    plot an unnoise image with that line."""
    # generate example image (noisy lines)
    img = np.zeros((128, 128))
    for y in range(12, 120):
        img[y, y] = 1
    for y in range(40, 75):
        img[y, 12] = 1
    for x in range(16, 64):
        img[int(10 + x*0.2), x] = 1
    img = (img * 100) + np.random.binomial(80, 0.5, (img.shape))

    accumulator, local_maxima, img_hough = hough(img, 5)

    util.plot_images_grayscale(
        [img, accumulator, local_maxima, img_hough],
        ["Image", "Accumulator content", "Local Maxima", "Line from Hough Transform"]
    )
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号