mirror of
https://github.com/wassname/scikit-image.git
synced 2026-09-12 12:50:49 +08:00
remove heapq
This commit is contained in:
@@ -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,
|
||||
|
||||
Reference in New Issue
Block a user