bugfix dim + unittest

This commit is contained in:
François Boulogne
2013-02-23 11:08:23 +01:00
parent 928468b999
commit ecb762c9e4
2 changed files with 4 additions and 4 deletions
+1 -1
View File
@@ -45,7 +45,7 @@ def _hough_circle(np.ndarray img, \
# compute the nonzero indexes
cdef np.ndarray[ndim=1, dtype=np.npy_intp] x, y
y, x = np.nonzero(img)
x, y = np.nonzero(img)
# Offset the image
cdef int max_radius = radius.max()
@@ -111,15 +111,15 @@ def test_hough_peaks_num():
def test_houghcircle():
# Prepare picture
img = np.zeros((100, 100), dtype=int)
img = np.zeros((120, 100), dtype=int)
radius = 20
x_0, y_0 = (50, 50)
x_0, y_0 = (99, 50)
x, y = circle_perimeter(y_0, x_0, radius)
img[y, x] = 1
out = tf.hough_circle(img, np.array([radius]))
y, x = np.where(out[0] == out[0].max())
x, y = np.where(out[0] == out[0].max())
# Offset for x_0, y_0
assert_equal(x[0], x_0 + radius)
assert_equal(y[0], y_0 + radius)