diff --git a/skimage/feature/tests/test_corner.py b/skimage/feature/tests/test_corner.py index a7ee01ff..9c59f704 100644 --- a/skimage/feature/tests/test_corner.py +++ b/skimage/feature/tests/test_corner.py @@ -100,6 +100,19 @@ def test_subpix(): assert_array_equal(subpix[0], (24.5, 24.5)) +def test_num_peaks(): + """For a bunch of different values of num_peaks, check that + peak_local_max returns exactly the right amount of peaks. Test + is run on Lena in order to produce a sufficient number of corners""" + + lena = data.lena() + + for i in xrange(20): + n = np.random.random_integers(20) + results = peak_local_max(corner_harris(lena), num_peaks=n) + assert (results.shape[0] == n) + + def test_corner_peaks(): response = np.zeros((5, 5)) response[2:4, 2:4] = 1