mirror of
https://github.com/wassname/scikit-image.git
synced 2026-07-09 06:06:36 +08:00
Add test case for subpixel corner detection
This commit is contained in:
@@ -1,10 +1,11 @@
|
||||
import numpy as np
|
||||
from numpy.testing import assert_array_equal
|
||||
|
||||
from skimage import data
|
||||
from skimage import img_as_float
|
||||
|
||||
from skimage.feature import (corner_moravec, corner_harris, corner_shi_tomasi,
|
||||
peak_local_max)
|
||||
corner_subpix, peak_local_max)
|
||||
|
||||
|
||||
def test_square_image():
|
||||
@@ -89,6 +90,15 @@ def test_rotated_lena():
|
||||
assert (np.sort(results[:, 1]) == np.sort(results_rotated[:, 0])).all()
|
||||
|
||||
|
||||
def test_subpix():
|
||||
img = np.zeros((50, 50))
|
||||
img[:25,:25] = 255
|
||||
img[25:,25:] = 255
|
||||
corner = peak_local_max(corner_harris(img), num_peaks=1)
|
||||
subpix = corner_subpix(img, corner)
|
||||
assert_array_equal(subpix[0], (24.5, 24.5))
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
from numpy import testing
|
||||
testing.run_module_suite()
|
||||
|
||||
Reference in New Issue
Block a user