Files
scikit-image/doc/examples/plot_harris.py
T
Tony S Yu fd0e88b986 Minor modifications to Harris corner detector
* Add some references.
* Make keyword argument explicit in example.
* Remove test class in favor of functions since no setup was required.
* Clean up docstrings.
2012-02-02 22:33:56 -05:00

35 lines
918 B
Python

"""
===============================================================================
Harris Corner detector
===============================================================================
The Harris corner filter [1]_ detects "interest points" [2]_ using edge
detection in multiple directions.
.. [1] http://en.wikipedia.org/wiki/Corner_detection
.. [2] http://en.wikipedia.org/wiki/Interest_point_detection
"""
from matplotlib import pyplot as plt
from skimage import data, img_as_float
from skimage.filter import harris
def plot_harris_points(image, filtered_coords):
""" plots corners found in image"""
plt.plot()
plt.imshow(image)
plt.plot([p[1] for p in filtered_coords],
[p[0] for p in filtered_coords],
'b.')
plt.axis('off')
plt.show()
im = img_as_float(data.lena())
filtered_coords = harris(im, min_distance=6)
plot_harris_points(im, filtered_coords)