mirror of
https://github.com/wassname/scikit-image.git
synced 2026-07-20 12:40:31 +08:00
Merge pull request #539 from ahojnnes/bresenham-deprecate
Deprecate bresenham function
This commit is contained in:
@@ -29,10 +29,10 @@ image[-100:-10, 10:-10] = 1
|
||||
image[10:-10, -100:-10] = 1
|
||||
|
||||
# foreground object 2
|
||||
rs, cs = draw.bresenham(250, 150, 10, 280)
|
||||
rs, cs = draw.line(250, 150, 10, 280)
|
||||
for i in range(10):
|
||||
image[rs + i, cs] = 1
|
||||
rs, cs = draw.bresenham(10, 150, 250, 280)
|
||||
rs, cs = draw.line(10, 150, 250, 280)
|
||||
for i in range(20):
|
||||
image[rs + i, cs] = 1
|
||||
|
||||
|
||||
@@ -1,5 +1,2 @@
|
||||
from ._draw import line, polygon, ellipse, ellipse_perimeter, \
|
||||
circle, circle_perimeter, set_color
|
||||
|
||||
|
||||
bresenham = line
|
||||
circle, circle_perimeter, set_color, bresenham
|
||||
|
||||
@@ -8,6 +8,7 @@ import numpy as np
|
||||
cimport numpy as cnp
|
||||
from libc.math cimport sqrt
|
||||
from skimage._shared.geometry cimport point_in_polygon
|
||||
from skimage._shared.utils import deprecated
|
||||
|
||||
|
||||
def line(Py_ssize_t y, Py_ssize_t x, Py_ssize_t y2, Py_ssize_t x2):
|
||||
@@ -73,6 +74,9 @@ def line(Py_ssize_t y, Py_ssize_t x, Py_ssize_t y2, Py_ssize_t x2):
|
||||
return rr, cc
|
||||
|
||||
|
||||
bresenham = deprecated('skimage.draw.line')(line)
|
||||
|
||||
|
||||
def polygon(y, x, shape=None):
|
||||
"""Generate coordinates of pixels within polygon.
|
||||
|
||||
|
||||
@@ -142,10 +142,10 @@ def hog(image, orientations=9, pixels_per_cell=(8, 8),
|
||||
centre = tuple([y * cy + cy // 2, x * cx + cx // 2])
|
||||
dx = radius * cos(float(o) / orientations * np.pi)
|
||||
dy = radius * sin(float(o) / orientations * np.pi)
|
||||
rr, cc = draw.bresenham(int(centre[0] - dx),
|
||||
int(centre[1] - dy),
|
||||
int(centre[0] + dx),
|
||||
int(centre[1] + dy))
|
||||
rr, cc = draw.line(int(centre[0] - dx),
|
||||
int(centre[1] - dy),
|
||||
int(centre[0] + dx),
|
||||
int(centre[1] + dy))
|
||||
hog_image[rr, cc] += orientation_histogram[y, x, o]
|
||||
|
||||
"""
|
||||
|
||||
@@ -71,10 +71,10 @@ class TestSkeletonize():
|
||||
image[10:-10, -100:-10] = 1
|
||||
|
||||
# foreground object 2
|
||||
rs, cs = draw.bresenham(250, 150, 10, 280)
|
||||
rs, cs = draw.line(250, 150, 10, 280)
|
||||
for i in range(10):
|
||||
image[rs + i, cs] = 1
|
||||
rs, cs = draw.bresenham(10, 150, 250, 280)
|
||||
rs, cs = draw.line(10, 150, 250, 280)
|
||||
for i in range(20):
|
||||
image[rs + i, cs] = 1
|
||||
|
||||
|
||||
Reference in New Issue
Block a user