Do not acquire GIL for hough_line

This commit is contained in:
Johannes Schönberger
2015-05-19 18:57:20 -07:00
parent 83fe07097f
commit 7337a3e14b
2 changed files with 12 additions and 8 deletions
+11 -8
View File
@@ -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)