mirror of
https://github.com/wassname/scikit-image.git
synced 2026-08-16 11:27:48 +08:00
Fix division by zero bug in corner detectors
This commit is contained in:
@@ -5,7 +5,8 @@ from skimage import data
|
||||
from skimage import img_as_float
|
||||
|
||||
from skimage.feature import (corner_moravec, corner_harris, corner_shi_tomasi,
|
||||
corner_subpix, peak_local_max, corner_peaks)
|
||||
corner_subpix, peak_local_max, corner_peaks,
|
||||
corner_kitchen_rosenfeld, corner_foerstner)
|
||||
|
||||
|
||||
def test_square_image():
|
||||
@@ -124,6 +125,21 @@ def test_corner_peaks():
|
||||
assert len(corners) == 4
|
||||
|
||||
|
||||
def test_blank_image_nans():
|
||||
"""Some of the corner detectors had a weakness in terms of returning
|
||||
NaN when presented with regions of constant intensity. This should
|
||||
be fixed by now. We test whether each detector returns something
|
||||
finite in the case of constant input"""
|
||||
|
||||
detectors = [corner_moravec, corner_harris, corner_shi_tomasi,
|
||||
corner_kitchen_rosenfeld, corner_foerstner]
|
||||
constant_image = np.zeros((20, 20))
|
||||
|
||||
for det in detectors:
|
||||
response = det(constant_image)
|
||||
assert np.all(np.isfinite(response))
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
from numpy import testing
|
||||
testing.run_module_suite()
|
||||
|
||||
Reference in New Issue
Block a user