diff --git a/skimage/feature/peak.py b/skimage/feature/peak.py index ebacfa3a..fe7ed081 100644 --- a/skimage/feature/peak.py +++ b/skimage/feature/peak.py @@ -10,6 +10,9 @@ def peak_local_max(image, min_distance=10, threshold='deprecated', Peaks are the local maxima in a region of `2 * min_distance + 1` (i.e. peaks are separated by at least `min_distance`). + NOTE: If peaks are flat (i.e. multiple pixels have exact same intensity), + the coordinates of all pixels are returned. + Parameters ---------- image: ndarray of floats diff --git a/skimage/feature/tests/test_peak.py b/skimage/feature/tests/test_peak.py index 7fb090ba..907370cc 100644 --- a/skimage/feature/tests/test_peak.py +++ b/skimage/feature/tests/test_peak.py @@ -43,6 +43,13 @@ def test_constant_image(): assert len(peaks) == 0 +def test_flat_peak(): + image = np.zeros((5, 5), dtype=np.uint8) + image[1:3, 1:3] = 10 + peaks = peak.peak_local_max(image, min_distance=1) + assert len(peaks) == 4 + + if __name__ == '__main__': from numpy import testing testing.run_module_suite()