mirror of
https://github.com/wassname/scikit-image.git
synced 2026-08-07 11:28:14 +08:00
Merge
This commit is contained in:
@@ -3,6 +3,7 @@ from numpy.testing import *
|
||||
|
||||
import scikits.image.transform as tf
|
||||
import scikits.image.transform.hough_transform as ht
|
||||
from scikits.image.transform import probabilistic_hough
|
||||
|
||||
def append_desc(func, description):
|
||||
"""Append the test function ``func`` and append
|
||||
@@ -43,6 +44,23 @@ def test_py_hough():
|
||||
|
||||
tf._hough = fast_hough
|
||||
|
||||
def test_probabilistic_hough():
|
||||
# Generate a test image
|
||||
img = np.zeros((100, 100), dtype=int)
|
||||
for i in range(25, 75):
|
||||
img[100 - i, i] = 100
|
||||
img[i, i] = 100
|
||||
lines = probabilistic_hough(img, 10, line_length=10, line_gap=1)
|
||||
# sort the lines according to the x-axis
|
||||
sorted_lines = []
|
||||
for line in lines:
|
||||
line = list(line)
|
||||
line.sort(lambda x,y: cmp(x[0], y[0]))
|
||||
sorted_lines.append(line)
|
||||
assert([(25, 75), (74, 26)] in sorted_lines)
|
||||
assert([(25, 25), (74, 74)] in sorted_lines)
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
run_module_suite()
|
||||
|
||||
|
||||
Reference in New Issue
Block a user