mirror of
https://github.com/wassname/scikit-image.git
synced 2026-09-09 11:33:41 +08:00
Added tests
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
#
|
||||
# Harris detector
|
||||
#
|
||||
# Inspired from Solem's implementation
|
||||
# http://www.janeriksolem.net/2009/01/harris-corner-detector-in-python.html
|
||||
|
||||
import numpy as np
|
||||
@@ -56,7 +57,7 @@ def harris_corner_detector(image, min_distance=10, threshold=0.1, eps=1e-6):
|
||||
|
||||
params
|
||||
-------
|
||||
harrisim: ndarray
|
||||
harrisim: ndarray of floats
|
||||
|
||||
min_distance: int, optional, default: 10
|
||||
minimum number of pixels separating corners and image boundary
|
||||
|
||||
@@ -0,0 +1,23 @@
|
||||
import numpy as np
|
||||
|
||||
import unittest
|
||||
|
||||
from skimage.filter import harris_corner_detector
|
||||
|
||||
|
||||
class TestHarris(unittest.TestCase):
|
||||
|
||||
def test_square_image(self):
|
||||
im = np.zeros((50, 50)).astype(float)
|
||||
im[:25, :25] = 1.
|
||||
results = harris_corner_detector(im)
|
||||
self.assertTrue(results.any())
|
||||
self.assertTrue(len(results) == 1)
|
||||
|
||||
def test_noisy_square_image(self):
|
||||
im = np.zeros((50, 50)).astype(float)
|
||||
im[:25, :25] = 1.
|
||||
im = im + np.random.uniform(size=im.shape) * .5
|
||||
results = harris_corner_detector(im)
|
||||
assert results.any()
|
||||
assert len(results) == 1
|
||||
Reference in New Issue
Block a user