Add example to doc string of shi-tomasi

This commit is contained in:
Johannes Schönberger
2012-12-09 17:34:12 +01:00
parent 6593e27b4d
commit 3508aa9032
+22
View File
@@ -127,6 +127,28 @@ def shi_tomasi(image, sigma=1):
response : ndarray
Shi-Tomasi response image.
Examples
-------
>>> from skimage.feature import shi_tomasi, peak_local_max
>>> square = np.zeros([10, 10])
>>> square[2:8,2:8] = 1
>>> square
array([[ 0., 0., 0., 0., 0., 0., 0., 0., 0., 0.],
[ 0., 0., 0., 0., 0., 0., 0., 0., 0., 0.],
[ 0., 0., 1., 1., 1., 1., 1., 1., 0., 0.],
[ 0., 0., 1., 1., 1., 1., 1., 1., 0., 0.],
[ 0., 0., 1., 1., 1., 1., 1., 1., 0., 0.],
[ 0., 0., 1., 1., 1., 1., 1., 1., 0., 0.],
[ 0., 0., 1., 1., 1., 1., 1., 1., 0., 0.],
[ 0., 0., 1., 1., 1., 1., 1., 1., 0., 0.],
[ 0., 0., 0., 0., 0., 0., 0., 0., 0., 0.],
[ 0., 0., 0., 0., 0., 0., 0., 0., 0., 0.]])
>>> peak_local_max(shi_tomasi(square), min_distance=1)
array([[3, 3],
[3, 6],
[6, 3],
[6, 6]])
"""
Axx, Axy, Ayy = _compute_auto_correlation(image, sigma)