mirror of
https://github.com/wassname/scikit-image.git
synced 2026-07-29 11:26:57 +08:00
fix names
This commit is contained in:
@@ -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,4 +1,4 @@
|
||||
__all__ = ['hough_peaks']
|
||||
__all__ = ['hough_line_peaks']
|
||||
|
||||
from itertools import izip as zip
|
||||
|
||||
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user