mirror of
https://github.com/wassname/scikit-image.git
synced 2026-08-12 12:30:16 +08:00
Change threshold test from >= to >.
This commit is contained in:
@@ -51,7 +51,7 @@ def peak_local_max(image, min_distance=10, threshold='deprecated',
|
||||
threshold_rel = threshold
|
||||
# find top corner candidates above a threshold
|
||||
corner_threshold = max(np.max(image.ravel()) * threshold_rel, threshold_abs)
|
||||
image_t = (image >= corner_threshold) * 1
|
||||
image_t = (image > corner_threshold) * 1
|
||||
|
||||
# get coordinates of peaks
|
||||
coordinates = np.transpose(image_t.nonzero())
|
||||
|
||||
@@ -22,7 +22,7 @@ def test_noisy_peaks():
|
||||
def test_relative_threshold():
|
||||
image = np.zeros((5, 5), dtype=np.uint8)
|
||||
image[1, 1] = 10
|
||||
image[3, 3] = 21
|
||||
image[3, 3] = 20
|
||||
peaks = peak.peak_local_max(image, min_distance=1, threshold_rel=0.5)
|
||||
assert len(peaks) == 1
|
||||
assert_close(peaks, [(3, 3)])
|
||||
@@ -31,8 +31,8 @@ def test_relative_threshold():
|
||||
def test_absolute_threshold():
|
||||
image = np.zeros((5, 5), dtype=np.uint8)
|
||||
image[1, 1] = 10
|
||||
image[3, 3] = 21
|
||||
peaks = peak.peak_local_max(image, min_distance=1, threshold_abs=11)
|
||||
image[3, 3] = 20
|
||||
peaks = peak.peak_local_max(image, min_distance=1, threshold_abs=10)
|
||||
assert len(peaks) == 1
|
||||
assert_close(peaks, [(3, 3)])
|
||||
|
||||
|
||||
Reference in New Issue
Block a user