diff --git a/skimage/transform/_hough_transform.pyx b/skimage/transform/_hough_transform.pyx index e51085cb..601ac0ea 100644 --- a/skimage/transform/_hough_transform.pyx +++ b/skimage/transform/_hough_transform.pyx @@ -79,22 +79,24 @@ def _hough_circle(cnp.ndarray img, num_circle_pixels = circle_x.size - if normalize: - incr = 1.0 / num_circle_pixels - else: - incr = 1 + with nogil: - # For each non zero pixel - for p in range(num_pixels): - # Plug the circle at (px, py), - # its coordinates are (tx, ty) - for c in range(num_circle_pixels): - tx = circle_x[c] + x[p] - ty = circle_y[c] + y[p] - if offset: - acc[i, tx, ty] += incr - elif 0 <= tx < xmax and 0 <= ty < ymax: - acc[i, tx, ty] += incr + if normalize: + incr = 1.0 / num_circle_pixels + else: + incr = 1 + + # For each non zero pixel + for p in range(num_pixels): + # Plug the circle at (px, py), + # its coordinates are (tx, ty) + for c in range(num_circle_pixels): + tx = circle_x[c] + x[p] + ty = circle_y[c] + y[p] + if offset: + acc[i, tx, ty] += incr + elif 0 <= tx < xmax and 0 <= ty < ymax: + acc[i, tx, ty] += incr return acc diff --git a/skimage/transform/tests/test_hough_transform.py b/skimage/transform/tests/test_hough_transform.py index 884d7957..ea9eac42 100644 --- a/skimage/transform/tests/test_hough_transform.py +++ b/skimage/transform/tests/test_hough_transform.py @@ -4,6 +4,7 @@ from numpy.testing import assert_almost_equal, assert_equal import skimage.transform as tf from skimage.draw import line, circle_perimeter, ellipse_perimeter from skimage._shared._warnings import expected_warnings +from skimage._shared.testing import test_parallel def append_desc(func, description): @@ -129,6 +130,7 @@ def test_hough_line_peaks_num(): min_angle=0, num_peaks=1)[0]) == 1 +@test_parallel() def test_hough_circle(): # Prepare picture img = np.zeros((120, 100), dtype=int)