mirror of
https://github.com/wassname/scikit-image.git
synced 2026-07-14 11:18:06 +08:00
extend test cases for num_peaks parameter of peak_local_max
This commit is contained in:
@@ -51,15 +51,23 @@ def test_flat_peak():
|
||||
|
||||
|
||||
def test_num_peaks():
|
||||
image = np.zeros((3, 7), dtype=np.uint8)
|
||||
image = np.zeros((7, 7), dtype=np.uint8)
|
||||
image[1, 1] = 10
|
||||
image[1, 3] = 11
|
||||
image[1, 5] = 12
|
||||
assert len(peak.peak_local_max(image, min_distance=1)) == 3
|
||||
image[3, 5] = 8
|
||||
image[5, 3] = 7
|
||||
assert len(peak.peak_local_max(image, min_distance=1)) == 5
|
||||
peaks_limited = peak.peak_local_max(image, min_distance=1, num_peaks=2)
|
||||
assert len(peaks_limited) == 2
|
||||
assert (1, 3) in peaks_limited
|
||||
assert (1, 5) in peaks_limited
|
||||
peaks_limited = peak.peak_local_max(image, min_distance=1, num_peaks=4)
|
||||
assert len(peaks_limited) == 4
|
||||
assert (1, 3) in peaks_limited
|
||||
assert (1, 5) in peaks_limited
|
||||
assert (1, 1) in peaks_limited
|
||||
assert (3, 5) in peaks_limited
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
|
||||
Reference in New Issue
Block a user