mirror of
https://github.com/wassname/scikit-image.git
synced 2026-08-06 13:30:21 +08:00
Merge pull request #166 from 'vincent-albufera/exemple_modif'
DOC: Improve harris corners and peak detection examples and docstrings.
This commit is contained in:
@@ -9,7 +9,7 @@ detection in multiple directions.
|
||||
.. [1] http://en.wikipedia.org/wiki/Corner_detection
|
||||
.. [2] http://en.wikipedia.org/wiki/Interest_point_detection
|
||||
"""
|
||||
|
||||
import numpy as np
|
||||
from matplotlib import pyplot as plt
|
||||
|
||||
from skimage import data, img_as_float
|
||||
@@ -19,16 +19,24 @@ from skimage.feature 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.')
|
||||
y, x = np.transpose(filtered_coords)
|
||||
plt.plot(x, y, 'b.')
|
||||
plt.axis('off')
|
||||
plt.show()
|
||||
|
||||
# display results
|
||||
plt.figure(figsize=(8, 3))
|
||||
im_lena = img_as_float(data.lena())
|
||||
im_text = img_as_float(data.text())
|
||||
|
||||
im = img_as_float(data.lena())
|
||||
filtered_coords = harris(im, min_distance=6)
|
||||
plot_harris_points(im, filtered_coords)
|
||||
filtered_coords = harris(im_lena, min_distance=4)
|
||||
|
||||
plt.axes([0, 0, 0.3, 0.95])
|
||||
plot_harris_points(im_lena, filtered_coords)
|
||||
|
||||
filtered_coords = harris(im_text, min_distance=4)
|
||||
|
||||
plt.axes([0.2, 0, 0.77, 1])
|
||||
plot_harris_points(im_text, filtered_coords)
|
||||
|
||||
plt.show()
|
||||
|
||||
Reference in New Issue
Block a user