mirror of
https://github.com/wassname/scikit-image.git
synced 2026-07-21 12:50:27 +08:00
Merge pull request #453 from cgohlke/patch-1
Fix `ValueError: Buffer dtype mismatch` on win-amd64
This commit is contained in:
@@ -126,7 +126,7 @@ def polygon(y, x, shape=None):
|
||||
rr.append(r)
|
||||
cc.append(c)
|
||||
|
||||
return np.array(rr), np.array(cc)
|
||||
return np.array(rr, dtype=np.intp), np.array(cc, dtype=np.intp)
|
||||
|
||||
|
||||
def ellipse(double cy, double cx, double yradius, double xradius, shape=None):
|
||||
@@ -174,7 +174,7 @@ def ellipse(double cy, double cx, double yradius, double xradius, shape=None):
|
||||
rr.append(r)
|
||||
cc.append(c)
|
||||
|
||||
return np.array(rr), np.array(cc)
|
||||
return np.array(rr, dtype=np.intp), np.array(cc, dtype=np.intp)
|
||||
|
||||
|
||||
def circle(double cy, double cx, double radius, shape=None):
|
||||
@@ -281,7 +281,7 @@ def circle_perimeter(Py_ssize_t cy, Py_ssize_t cx, Py_ssize_t radius,
|
||||
y = y - 1
|
||||
x = x + 1
|
||||
|
||||
return np.array(rr) + cy, np.array(cc) + cx
|
||||
return np.array(rr, dtype=np.intp) + cy, np.array(cc, dtype=np.intp) + cx
|
||||
|
||||
|
||||
def ellipse_perimeter(Py_ssize_t cy, Py_ssize_t cx, Py_ssize_t yradius,
|
||||
@@ -368,7 +368,7 @@ def ellipse_perimeter(Py_ssize_t cy, Py_ssize_t cx, Py_ssize_t yradius,
|
||||
err += ychange
|
||||
ychange += twobsquared
|
||||
|
||||
return np.array(py) + cy, np.array(px) + cx
|
||||
return np.array(py, dtype=np.intp) + cy, np.array(px, dtype=np.intp) + cx
|
||||
|
||||
|
||||
def set_color(img, coords, color):
|
||||
|
||||
@@ -31,7 +31,7 @@ def possible_hull(cnp.ndarray[dtype=cnp.uint8_t, ndim=2, mode="c"] img):
|
||||
# rows storage slots for right boundary pixels
|
||||
# cols storage slots for bottom boundary pixels
|
||||
cdef cnp.ndarray[dtype=cnp.intp_t, ndim=2] nonzero = \
|
||||
np.ones((2 * (rows + cols), 2), dtype=np.int)
|
||||
np.ones((2 * (rows + cols), 2), dtype=np.intp)
|
||||
nonzero *= -1
|
||||
|
||||
for r in range(rows):
|
||||
|
||||
@@ -73,7 +73,7 @@ def _felzenszwalb_grey(image, double scale=1, sigma=0.8, Py_ssize_t min_size=20)
|
||||
cdef cnp.intp_t *edges_p = <cnp.intp_t*>edges.data
|
||||
cdef cnp.float_t *costs_p = <cnp.float_t*>costs.data
|
||||
cdef cnp.ndarray[cnp.intp_t, ndim=1] segment_size \
|
||||
= np.ones(width * height, dtype=np.int)
|
||||
= np.ones(width * height, dtype=np.intp)
|
||||
# inner cost of segments
|
||||
cdef cnp.ndarray[cnp.float_t, ndim=1] cint = np.zeros(width * height)
|
||||
cdef int seg0, seg1, seg_new, e
|
||||
|
||||
@@ -164,7 +164,7 @@ def hough_circle(img, radius, normalize=True):
|
||||
Hough transform accumulator for each radius
|
||||
|
||||
"""
|
||||
return _hough_circle(img, radius, normalize)
|
||||
return _hough_circle(img, radius.astype(np.intp), normalize)
|
||||
|
||||
def hough_peaks(hspace, angles, dists, min_distance=10, min_angle=10,
|
||||
threshold=None, num_peaks=np.inf):
|
||||
|
||||
Reference in New Issue
Block a user