From 579c3d5aa3e2c0438772ec11c669772d5f9c3467 Mon Sep 17 00:00:00 2001 From: Vighnesh Birodkar Date: Thu, 6 Mar 2014 13:04:09 +0530 Subject: [PATCH] added get_local_maxima to feature --- skimage/feature/__init__.py | 5 +++-- skimage/feature/blob.py | 10 ++++++++++ 2 files changed, 13 insertions(+), 2 deletions(-) diff --git a/skimage/feature/__init__.py b/skimage/feature/__init__.py index 3c33ffb2..ef4aa113 100644 --- a/skimage/feature/__init__.py +++ b/skimage/feature/__init__.py @@ -14,7 +14,7 @@ from .censure import CENSURE from .orb import ORB from .match import match_descriptors from .util import plot_matches -from .blob import blob_dog +from .blob import blob_dog, get_local_maxima __all__ = ['daisy', @@ -42,4 +42,5 @@ __all__ = ['daisy', 'ORB', 'match_descriptors', 'plot_matches', - 'blob_dog'] + 'blob_dog', + 'get_local_maxima'] diff --git a/skimage/feature/blob.py b/skimage/feature/blob.py index d1ab9ecc..23ce7452 100644 --- a/skimage/feature/blob.py +++ b/skimage/feature/blob.py @@ -41,6 +41,16 @@ def get_local_maxima(ar, threshold, connectivity=3): A 2d array in which each row contains 3 values, the indices of local maxima. + Examples + -------- + >>> a = np.array([[ 0 , 0 , 0 , 0 , 0], + ... [ 0 , 0 , 3 , 0 , 0], + ... [ 0 , 0 , 1 , 0 , 0], + ... [ 0 , 1 , 0 , 0 , 0], + ... [ 0 , 0 , 0 , 0 , 0]]) + >>> get_local_maxima(a, threshold = 1, connectivity = 2) + array([[1, 2]]) + """ # computing max filter using all neighbors in cube fp = generate_binary_structure(ar.ndim, connectivity)