Adding additional parameter for setting shape for Non-max suppression

This commit is contained in:
Ankit Agrawal
2013-08-22 00:37:34 +05:30
committed by Johannes Schönberger
parent df43c5cfc7
commit 53c9e3e6e4
+5 -2
View File
@@ -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)))