fix names

This commit is contained in:
François Boulogne
2013-03-24 15:22:42 +01:00
parent a68434b330
commit 42e872f926
3 changed files with 19 additions and 20 deletions
+2 -2
View File
@@ -1,6 +1,6 @@
from ._hough_transform import hough_circle,
from ._hough_transform import (hough_circle,
hough_line,
probabilistic_hough_line
probabilistic_hough_line)
from .hough_transform import *
from .radon_transform import *
from .finite_radon_transform import *
+1 -1
View File
@@ -1,4 +1,4 @@
__all__ = ['hough_peaks']
__all__ = ['hough_line_peaks']
from itertools import izip as zip
+16 -17
View File
@@ -3,7 +3,6 @@ from numpy.testing import *
import skimage.transform as tf
import skimage.transform.hough_transform as ht
from skimage.transform import probabilistic_hough
from skimage.draw import circle_perimeter, line
@@ -50,7 +49,7 @@ def test_probabilistic_hough():
# decrease default theta sampling because similar orientations may confuse
# as mentioned in article of Galambos et al
theta = np.linspace(0, np.pi, 45)
lines = probabilistic_hough(img, theta=theta, threshold=10, line_length=10,
lines = tf.probabilistic_hough_line(img, theta=theta, threshold=10, line_length=10,
line_gap=1)
# sort the lines according to the x-axis
sorted_lines = []
@@ -62,59 +61,59 @@ def test_probabilistic_hough():
assert([(25, 25), (74, 74)] in sorted_lines)
def test_hough_peaks():
def test_hough_line_peaks():
img = np.zeros((100, 150), dtype=int)
rr, cc = line(60, 130, 80, 10)
img[rr, cc] = 1
out, angles, d = tf.hough_line(img)
out, theta, dist = tf.hough_peaks(out, angles, d)
out, theta, dist = tf.hough_line_peaks(out, angles, d)
assert_equal(len(dist), 1)
assert_almost_equal(dist[0], 80.723, 1)
assert_almost_equal(theta[0], 1.41, 1)
def test_hough_peaks_dist():
def test_hough_line_peaks_dist():
img = np.zeros((100, 100), dtype=np.bool_)
img[:, 30] = True
img[:, 40] = True
hspace, angles, dists = tf.hough_line(img)
assert len(tf.hough_peaks(hspace, angles, dists, min_distance=5)[0]) == 2
assert len(tf.hough_peaks(hspace, angles, dists, min_distance=15)[0]) == 1
assert len(tf.hough_line_peaks(hspace, angles, dists, min_distance=5)[0]) == 2
assert len(tf.hough_line_peaks(hspace, angles, dists, min_distance=15)[0]) == 1
def test_hough_peaks_angle():
def test_hough_line_peaks_angle():
img = np.zeros((100, 100), dtype=np.bool_)
img[:, 0] = True
img[0, :] = True
hspace, angles, dists = tf.hough_line(img)
assert len(tf.hough_peaks(hspace, angles, dists, min_angle=45)[0]) == 2
assert len(tf.hough_peaks(hspace, angles, dists, min_angle=90)[0]) == 1
assert len(tf.hough_line_peaks(hspace, angles, dists, min_angle=45)[0]) == 2
assert len(tf.hough_line_peaks(hspace, angles, dists, min_angle=90)[0]) == 1
theta = np.linspace(0, np.pi, 100)
hspace, angles, dists = tf.hough_line(img, theta)
assert len(tf.hough_peaks(hspace, angles, dists, min_angle=45)[0]) == 2
assert len(tf.hough_peaks(hspace, angles, dists, min_angle=90)[0]) == 1
assert len(tf.hough_line_peaks(hspace, angles, dists, min_angle=45)[0]) == 2
assert len(tf.hough_line_peaks(hspace, angles, dists, min_angle=90)[0]) == 1
theta = np.linspace(np.pi / 3, 4. / 3 * np.pi, 100)
hspace, angles, dists = tf.hough_line(img, theta)
assert len(tf.hough_peaks(hspace, angles, dists, min_angle=45)[0]) == 2
assert len(tf.hough_peaks(hspace, angles, dists, min_angle=90)[0]) == 1
assert len(tf.hough_line_peaks(hspace, angles, dists, min_angle=45)[0]) == 2
assert len(tf.hough_line_peaks(hspace, angles, dists, min_angle=90)[0]) == 1
def test_hough_peaks_num():
def test_hough_line_peaks_num():
img = np.zeros((100, 100), dtype=np.bool_)
img[:, 30] = True
img[:, 40] = True
hspace, angles, dists = tf.hough_line(img)
assert len(tf.hough_peaks(hspace, angles, dists, min_distance=0,
assert len(tf.hough_line_peaks(hspace, angles, dists, min_distance=0,
min_angle=0, num_peaks=1)[0]) == 1
def test_houghcircle():
def test_hough_circle():
# Prepare picture
img = np.zeros((120, 100), dtype=int)
radius = 20