mirror of
https://github.com/wassname/scikit-image.git
synced 2026-07-09 23:11:31 +08:00
Do not acquire GIL for hough_line
This commit is contained in:
@@ -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 = <int>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 = <int>round((ctheta[j] * x + stheta[j] * y)) + offset
|
||||
accum[accum_idx, j] += 1
|
||||
|
||||
return accum, theta, bins
|
||||
|
||||
|
||||
|
||||
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user