From 53c9e3e6e4f77eb84ffc710958fa656330f31fcb Mon Sep 17 00:00:00 2001 From: Ankit Agrawal Date: Thu, 22 Aug 2013 00:37:34 +0530 Subject: [PATCH] Adding additional parameter for setting shape for Non-max suppression --- skimage/feature/corner.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/skimage/feature/corner.py b/skimage/feature/corner.py index f2864d8b..5525a8b3 100644 --- a/skimage/feature/corner.py +++ b/skimage/feature/corner.py @@ -547,7 +547,7 @@ def corner_peaks(image, min_distance=10, threshold_abs=0, threshold_rel=0.1, return peaks -def corner_fast(image, n=12, threshold=0.15): +def corner_fast(image, n=12, threshold=0.15, non_max_shape=(3, 3)): """Extract FAST corners for a given image. @@ -564,6 +564,9 @@ def corner_fast(image, n=12, threshold=0.15): Threshold used in deciding whether the pixels on the circle are brighter, darker or similar w.r.t. the test pixel. Decrease the threshold when more corners are desired and vice-versa. + non_max_shape : tuple of two odd int + Represents the area in which Non-maximal suppression is applied. + By default, a 3 x 3 area is used. Returns ------- @@ -587,7 +590,7 @@ def corner_fast(image, n=12, threshold=0.15): # Non-maximal Suppression corner_zero_mask = corner_response != 0 - maximas = (maximum_filter(corner_response, (3, 3)) == corner_response) & corner_zero_mask + maximas = (maximum_filter(corner_response, non_max_shape) == corner_response) & corner_zero_mask x, y = np.where(maximas == True) corners = np.squeeze(np.dstack((x, y)))