remove heapq

This commit is contained in:
François Boulogne
2013-10-12 14:09:52 +02:00
parent 313bf0ea9a
commit df2ee4d636
3 changed files with 23 additions and 23 deletions
+3 -9
View File
@@ -3,7 +3,6 @@
#cython: nonecheck=False
#cython: wraparound=False
import numpy as np
import heapq
cimport numpy as cnp
cimport cython
@@ -132,12 +131,8 @@ def hough_ellipse(cnp.ndarray img, int threshold=4, double accuracy=1,
>>> img = np.zeros((25, 25), dtype=int)
>>> rr, cc = draw.ellipse_perimeter(10, 10, 6, 8)
>>> img[cc, rr] = 1
>>> result = hough_ellipse(img, threshold=4)
>>> # extract the highest accumulator
>>> heapq.nlargest(1, result)
[(10, 10.0, 10.0, 6.0, 8.0, 0.0)]
>>> # To sort them all
>>> results = [heappop(results) for i in range(len(results))]
>>> result = hough_ellipse(img, threshold=8)
[(10, 10.0, 8.0, 6.0, 0.0, 10.0)]
Notes
-----
@@ -221,8 +216,7 @@ def hough_ellipse(cnp.ndarray img, int threshold=4, double accuracy=1,
if angle > np.pi:
angle = angle - np.pi / 2.
a, b = b, a
heapq.heappush(results,
(hist_max, # Accumulator
results.append((hist_max, # Accumulator
y0,
x0,
a,