diff --git a/skimage/transform/_hough_transform.pyx b/skimage/transform/_hough_transform.pyx index 601ac0ea..6ce69d8e 100644 --- a/skimage/transform/_hough_transform.pyx +++ b/skimage/transform/_hough_transform.pyx @@ -308,14 +308,17 @@ def hough_line(cnp.ndarray img, # finally, run the transform cdef Py_ssize_t nidxs, nthetas, i, j, x, y, accum_idx - nidxs = y_idxs.shape[0] # x and y are the same shape - nthetas = theta.shape[0] - for i in range(nidxs): - x = x_idxs[i] - y = y_idxs[i] - for j in range(nthetas): - accum_idx = round((ctheta[j] * x + stheta[j] * y)) + offset - accum[accum_idx, j] += 1 + + with nogil: + nidxs = y_idxs.shape[0] # x and y are the same shape + nthetas = theta.shape[0] + for i in range(nidxs): + x = x_idxs[i] + y = y_idxs[i] + for j in range(nthetas): + accum_idx = round((ctheta[j] * x + stheta[j] * y)) + offset + accum[accum_idx, j] += 1 + return accum, theta, bins diff --git a/skimage/transform/tests/test_hough_transform.py b/skimage/transform/tests/test_hough_transform.py index ea9eac42..e7030494 100644 --- a/skimage/transform/tests/test_hough_transform.py +++ b/skimage/transform/tests/test_hough_transform.py @@ -16,6 +16,7 @@ def append_desc(func, description): return func +@test_parallel() def test_hough_line(): # Generate a test image img = np.zeros((100, 150), dtype=int)