From 53a339e4f4fcc0fba56d5898f5f6c934575c1301 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Johannes=20Sch=C3=B6nberger?= Date: Tue, 27 Aug 2013 16:09:13 +0200 Subject: [PATCH] Add examples for structure tensor and hessian matrix functions --- skimage/feature/corner.py | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) diff --git a/skimage/feature/corner.py b/skimage/feature/corner.py index 887de425..5628972d 100644 --- a/skimage/feature/corner.py +++ b/skimage/feature/corner.py @@ -69,6 +69,19 @@ def structure_tensor(image, sigma=1, mode='constant', cval=0): Ayy : ndarray Element of the structure tensor for each pixel in the input image. + Examples + -------- + >>> from skimage.feature import structure_tensor + >>> square = np.zeros((5, 5)) + >>> square[2, 2] = 1 + >>> Axx, Axy, Ayy = structure_tensor(square, sigma=0.1) + >>> Axx + array([[ 0., 0., 0., 0., 0.], + [ 0., 1., 0., 1., 0.], + [ 0., 4., 0., 4., 0.], + [ 0., 1., 0., 1., 0.], + [ 0., 0., 0., 0., 0.]]) + """ image = np.squeeze(image) @@ -118,6 +131,19 @@ def hessian_matrix(image, sigma=1, mode='constant', cval=0): Hyy : ndarray Element of the Hessian matrix for each pixel in the input image. + Examples + -------- + >>> from skimage.feature import hessian_matrix, hessian_matrix_eigvals + >>> square = np.zeros((5, 5)) + >>> square[2, 2] = 1 + >>> Hxx, Hxy, Hyy = hessian_matrix(square, sigma=0.1) + >>> Hxx + array([[ 0., 0., 0., 0., 0.], + [ 0., 0., 0., 0., 0.], + [ 0., 0., 1., 0., 0.], + [ 0., 0., 0., 0., 0.], + [ 0., 0., 0., 0., 0.]]) + """ image = np.squeeze(image)