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"]
)
评论列表
文章目录